tweenux
RSS Feed Email Feed

Linking C++ object files with Fortran

If one is to ie. analyze performance between C++ and Fortran implementation of specific functions we need to create the desired function in C++ and compile it to an object file. This object file will then be linked together with the rest of the Fortran code that holds the rest of the system.

The main issue is that the C++ consortium never wanted to open up for an inter-language calling interface, not even to Fortran. There are ways to handle this though. C++ stems from C, so by wrapping the C++ code into C code, we can handle this gently.
(more…)

Find open ports on a network

Sometimes, it happens that I don’t remember the ip-adress of a server on a (local) network I need access to (because I haven’t added either a dns (eg. dyndns) or set a static ip to the server). This happend to me some time ago and I needed to figure out what ip-adresses had the port 22 open for login.

nmap -p 22 --open -sV 192.168.1.0/24 > ssh_servers.txt

Nmap scan report for 192.168.1.123
Host is up (0.0010s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.1p1 Debian 5 (protocol 2.0)
Service Info: OS: Linux

Along with information from nmap I could figure out which computer to log onto (nmap also displays what OS / ssh version is running on the computer that has the port open).

Note!
I do not encourage people to use this command to gain knowledge about what computers are open for hacking / cracking on a network. This should only be used in the best way intended.

Create timelaps

Create timelaps of images saved with timestamp as filename.

# FIrstly, find the files you need and tar them down (I don’t want to work on the real files, and in addition, they are on another linux box that doesn’t use ffmpeg.

:~$ find . -newer 1324482302.jpg | xargs tar --no-recursion -cvzf 2011-12-21_1.tar.gz

# Unpack the files, cd into directory and update filename with a incrementing number, that ffmpeg understands. use ffmpeg to create a timelaps with settings defined below. I use -b < huge number > to make sure ffmpeg doesn’t compress my frames more than they allready are from the webcam. Each image, represents a frame, so 25 images equals 1 second of video. I use mkv as video container, it could be whatever you prefer.

:~$ tar -xvzf 2011-12-21_1.tar.gz
:~$ cd 2011-12-21
:~$ for i in *; do mv $i $((a = a + 1)).jpg; done
:~$ ffmpeg -f image2 -i %d.jpg -vcodec copy video.mkv
:~$ ffmpeg -i video.mkv -vcodec mpeg4 -b 50000000 video_test.mkv

This was sufficient for me for now, maybe I will add more options later or other ways to create a timelaps with ffmpeg.

Revert date on files

Okay, NTP didn’t work as expected on a linux box that save images off a webcam. After a power-loss the date setting was not correctly set and this wasn’t corrected until a couple of hours had passed by. In the mean time, alot of images from the webcam had been saved with wrong date setting (I use unix timestamp as filename of the images). In order not to overwrite any images, I had to copy move the images with wrong timestamp to a new location and do some simple bash manipulation on those.
(more…)

Resetting Thomson Speedtouch routers

Hard Resetting a Thomson router if password is not obtainable: Telenor/NGT modems.
(Or upgrade your existing Speedtouch router to support bridging.)

Works for:
Thomson SpeedTouch 516i v6
Thomson SpeedTouch 546i v6

From a terminal window in Ubuntu (10.10):

:~$ sudo aptitude install bootp tftpd-hpa
:~$ sudo pico /etc/default/tftpd-hpa

(more…)

SparkleShare with gitosis on ubuntu 10.10

Installing gitosis

Install gitosis on a server where you would like to backup/store documents.
On my debian 5.08 (lenny) server, gitosis may simply be installed via aptitude.

my-git-server:~$ sudo aptitude install gitosis

Now, standard “home-dir” for gitosis is /srv/gitosis. I would like to store my git-repositories on a raid location called /storage/. To change home-directory for gitosis, run this command: (Be sure not to create the new home folder gitosis).

my-git-server:~$ sudo usermod -m -d /storage/gitosis gitosis

-m tells usermod to copy over what is already installed in the current home folder for the user.
-d specifies the new home directory for the user.

Now we want to configure gitosis, and create our first repository.
(more…)

Fully working remote control (HVR-4000) on kernel 2.6.35

Remote control support (input device events) is now handled by the kernel (>=2.6.17). However, not all remote buttons may work out of the box. The driver that handles input device events, xf86-input-evdev, needs to be patched in order to remap higher keycodes than the xserver may handle. x server (Xorg/x11) is built with 255 keycodes in mind, out from the fact that a keyboard rarely has so many keys (but perhaps >128). The problem arise when we use new special keys like on a remote control or extended keyboards or laptops that uses multimedia keys. These keys might have a keycode higher than the regular keycode space may interpret. (>255). (more…)

Authenticating Debian servers

Problem updating software depository with aptitude, a signature / public key changed.

W: GPG error: http://debian.samfundet.no etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B

:~$ sudo gpg --keyserver pgpkeys.mit.edu --recv-key 9AA38DCD55BE302B
:~$ sudo gpg -a --export 9AA38DCD55BE302B | sudo apt-key add -

Grails on Debian Lenny

Grails is an open source web application framework which uses the Groovy programming language (which is in turn based on the Java platform). It is intended to be a high-productivity framework by following the “coding by convention” paradigm, providing a stand-alone development environment and hiding much of the configuration detail from the developer.

Wikipedia

Install java-sdk/jdk:

:~$ sudo aptitude install openjdk6-jdk

http://www.grails.org/Download
Download grails.zip package, unzip and move to /usr/local/

:~$ unzip grails.zip
:~$ sudo mv grails-1.2.3.4/ /usr/local/

Symlink grails-1.2.3.4 to grails:

:/usr/local/$ sudo ln -s grails-1.2.3.4/ grails

Export paths to enviroment:

:~$ export GRAILS_HOME=/usr/local/grails
:~$ export PATH=${PATH}:${GRAILS_HOME}/bin
:~$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

To set the variables edit either (whether you want system wide changes or not):
/etc/profile or ~/.profile / ~/.bash_rc (~/.profile is disregarded if ~/.bash_rc exist! )

Example /etc/profile:

# GRAILS ENVIRONMENT
export GRAILS_HOME=/usr/local/grails
export PATH=${PATH}:${GRAILS_HOME}/bin
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

:~$ grails create-app YourApp

References: http://wiki.debian.org/Java

Hauppauge remote control issue (HVR-4000)

Ubuntu 10.10 (Maverick)

OUTDATED: go to http://archive.pfb.no/2010/12/14/fully-working-remote-control/

I have been quite frustrated over the lack of being able to navigate in media center menus for a long time since the back/exit button has failed to do the desired response, namely navigate back / go up one level / go to parent dir / go to parent menu. (more…)

« Older Entries