Tuesday, 29 June 2010

Setting processor affinity

http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html


apt-get install schedutils

taskset -c -p 1 13545

where 1 is the core number and 13545 is the process ID number.

To launch a program on core 3:

taskset -c 3 python

for example.

---------- Tips ----------

$ top

and press `1' to get SMP view, showing per processor results.

$ taskset -p 12345

returns the affinity of process 12345

Saturday, 26 June 2010

Secure chat

This guide explains how to set up a secure, point to point chat system. With two participants, one holds the conversation file and allows the other to login to their machine, via ssh. The holder sets up an account for the remote user, and provides themselves with access to the remote users files, but does not allow the reverse. The remote user then executes a remote tail or cat command to view the conversation file; and executes a remote,

echo "This is to be sent" >> ~/conversation

command, to add to the conversation.

The host is running a tail script, once a second to update the chat window also.

Secure, point to point transmission, without a third party software to worry about.

Two scripts, then. One to append to the conversation file, and one to loop on a viewing.

-----------------------------------------

add.sh

ssh login@ipaddress echo $1 >> ~/conversation

view.sh

while true ; ssh login@ipaddress tail ~/conversation; sleep 1 ; done


The host sets up port forwarding etc. Passwordless ssh is required.

-------------------------------

Add the new used: sudo adduser
Restrict access for the new user to only their local stuff: Easily said!

------------------------------

Python version: Check http://docs.python.org/library/socket.html for sockets programming, including a server / client example. Combine this with the Python encryption libraries.

pbs setup

http://www.webmo.net/support/pbs.html

http://www.open-mpi.org/faq/?category=rsh

Interesting SSH stuff:

http://support.suso.com/supki/SSH_Tutorial_for_Linux

Don't forget compression with ssh. Use,

ssh -C

or adjust the config file to include,

Compression yes

---------------

Thursday, 24 June 2010

Black screen, white cross

Computer ran for weeks. A reset, and fluxbox is no longer starting.

The symptom is a black screen, with a white cross which can be controlled with the mouse. Clicking has no effect. CTRL-ALT-F3, for example, opens a terminal and login is fine. So, it appears X is running, but fluxbox isn't.


http://fluxbox-wiki.org/index.php?title=Howtos

was a good start.

Start fluxbox from the command line:

Add:

exec startfluxbox

to ~/.xinitrc



I did this, but cannot reset at the moment. Further reading suggested things might be different for ubuntu, anyway:

sudo vi /usr/share/xsessions/fluxbox.desktop

and add:

[Desktop Entry]
Encoding=UTF-8
Name=Fluxbox
Comment=Highly configureable low resource X11 Window Manager
Exec=/usr/bin/startfluxbox
Terminal=False
TryExec=/usr/bin/startfluxbox
Type=Application



CTRL-ALT-backspace will reset GDM. Do not perform CTRL-ALT-DEL as this will also reset the computer.

Tuesday, 22 June 2010

mplayer bluray playback / mkv

mplayer -fs -lavdopts fast=1:skiploopfilter=all -framedrop *

Tuesday, 15 June 2010

and then,

python,

crypto

numpy

paramiko (ssh2)

Updating wow

Get the ip address of my machine. Create a temporary directory, say, `/home/me/wowtemp'

Change the permissions:

chmod 755 -R ~/wowtemp

On the remote machine running windows, install cygwin and make sure all the ssh stuff is installed, along with rsync. On that machine, test the ssh login to the linux machine. Once ok, navigate to the local wow directory, and do:

rsync -avz --progress ./* login@192.168.1.xxx:/home/login/wowtemp/

and cook dinner.

A 4.0MB/s transfer will take 20000/4 = 5000s = 83m = 1.4h to transfer 20 Gig.

Non native codecs etc.

https://help.ubuntu.com/community/Medibuntu

... and install the restricted extras. Details elsewhere on this blog.

Wednesday, 9 June 2010

Encrypted external drive

Skip to the lines below:

From http://www.hermann-uwe.de/blog/howto-disk-encryption-with-dm-crypt-luks-and-debian

and

http://www.ossramblings.com/ubuntu_external_encrypted_hard_drive


1. Overwrite the drive with random data to slow attacks and scan for badblocks.

badblocks -c 10240 -s -w -t random -v /dev/sdc

2. Install requirements, apply without restart.

sudo apt-get install cryptsetup hashalot hal pmount ivman
sudo modprobe dm-crypt

3. Replace the partition:
sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/[your partition]

This resulted in the partition being considered to be of type, `crypto_LUKS'.
Mounting it does not work, and the next step of the tutorial,

sudo mkfs.ext3 -j -m 1 -O dir_index,filetype,sparse_super /dev/mapper/luks_crypto_b6c6e0ae-4ec3-4ff9-9a7e-c1edf104d8e3

did not work as /dev/mapper is only showing `control'. Stumped. Try the other site.

4. cfdisk /dev/sdc1

-----------------------------------------------------

Days later, try again: this worked.

sudo apt-get install cryptsetup
sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb # Encrypt the partition
sudo cryptsetup luksOpen /dev/sdb sdb # attach it.
sudo mkfs.ext3 /dev/mapper/sdb # create filesystem
sudo cryptsetup luksClose sdb # close it.

Pull out the cable. Wait. Push back in. Provide password, then:

sudo chown me /media/driveLabel/ # change ownership from root.

And, bingo! Modified from http://www.emcken.dk/weblog/archives/164-encrypted-usb-drive-in-ubuntu.html


Alternatively, from the command line:

Plug in.
sudo cryptsetup luksOpen /dev/sde sde # Create decrypted device called /dev/mapper/sde
sudo mount /dev/mapper/sde /mnt/tmp # mount decrypted device

Gotta love linux. :)