Thursday 25 November 2010

Tuesday 9 November 2010

ubuntu startup scripts.

What a mess. Try this:

Copy the script into /etc/init.d

Edit it to include the following header:

#! /bin/sh
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO


Do:

$ sudo chmod +x scriptname

Run,

$ sudo update-rc.d scriptname defaults

`defaults' sets `scriptname' to run at runlevels 2,3,4,5
by creating links to the script in those levels; and
adds a link to the script to kill it at levels 0, 1, 6.

Remove the startup script via,

$ sudo update-rc.d -f scriptname remove

Correct display of aterm mutt mc finch etc

aterm displayed crappy characters with mc and mutt. This was fixed by calling them as,

$ LANG=C mutt

and

$ LANG=C mc


.bashrc now has aliases for mutt and mc as above.

Tidy up ubuntu, gnome

Ubuntu defaults to `pretty' borders, `nice' shadows and other bits of peripheral crap turned on; presumably to appeal to those using linux for prettyness rather than function.

To get rid of a few of them:

sudo apt-get install compizconfig-settings-manager

The executable is, ccsm

... and, it doesn't work. Making changes to ccsm has no effect on the display. Red herring.

Wednesday 27 October 2010

rip iso dvd

sudo apt-get install lsdvd gddrescue
lsdvd /dev/dvd
ddrescue /dev/dvd image.iso dvd.log

playback
sudo apt-get install vlc fuseiso
sudo adduser your_user_name fuse (close and reopen the terminal to update your group status)
sudo mkdir /media/fuseiso (create mount point)

Sunday 17 October 2010

sshfs sluggish?

Run like this:

-o ServerAliveInterval=15 -o cache_timeout=600

Saturday 16 October 2010

flash playback.

Finally, Adobe .... never mind. I get bored of saying the same stuff over and over.

Download:

http://labs.adobe.com/downloads/flashplayer10.html

Extract:

tar xvzf flashplayer_square_p1_64bit_linux_091510.tar.gz

Copy:

mkdir -p .mozilla/plugins
mv libflashplayer.so .mozilla/plugins

Run firefox and check it's found it:
about:plugins

This file is present on Dani's machine.

Wednesday 15 September 2010

openFoam notes

http://www.cfd-online.com/Forums/openfoam/76246-explanation-bounding-k-bounding-epsilon.html

// source in k or epsilon equations have this:
rho_*epsilon_/k_

// mut calculation has this:
rho_*Cmu_*sqr(k_)/epsilon_

from
src/finiteVolume/cfdTools/general/bound/bound.C

Dividing by zero is avoided by bounding the values of k and epsilon.

Gauss linear for all convection terms is accurate.
Change to limitedLinear(V) 1; may help remove negative k values.

Upwind differencing gives bounded results but numerical diffusion.
Gauss linear is a second order central-difference scheme and does not assure boundedness.

limitedLinear is a blend of upwind and central difference. No: It is a limited CDS.

Consider refining the mesh in the problem region.

Other options: limitedLinear; linearUpwind; QUICK

People have had problems with backward facing steps. That is what I have.

Central differencing shows oscillation for idrama. limitedLinear(V) 1
removes it. Limiters switch between UD and CD.

*Check the mesh with, `checkMesh' to find skewed / non-orthogonal cells*
*Refine the mesh in problem regions*

*my note:  i also found cells with small determinants caused real problems in the boundary
layer.  These **really** should be avoided.  They made my simulations unstable but not immediately:
sometimes after many iterations*

Suggestions: Gradients use cellLimited Gauss linear 1;
divergence: Gauss linearUpwind cellLimited Gauss linear 1;
use linearUpwindV for div(phi,U) and other vector fields, with cellMDLimited.
Limit lapacians and surface normal gradients.

k-epsilon standard: zerogradient on inlet outlet, pressure zero.

fvSchemes requiring fixing:---------------------------

ddtSchemes{default steadyState;}

gradSchemes{default cellLimited Gauss linear 1;
grad(p) cellLimited Gauss linear 1; grad(U) cellLimited Gauss linear 1;}

divSchemes{default none;
div(phi,U) Gauss linearUpwindV cellMDLimited Gauss linear 1;
div(phi,k) Gauss linearUpwind cellLimited Gauss linear 1;
div(phi,epsilon) Gauss linearUpwind cellLimited Gauss linear 1;
div((nuEff*dev(grad(U).T()))) Gauss linearUpwind cellLimited Gauss linear 1;//Gauss linear;}

laplacianSchemes{default none; laplacian(nuEff,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;}

interpolationSchemes{default linear;interpolate(U) linear;}

snGradSchemes{default corrected;}

fluxRequired{default no;p ;}

Friday 3 September 2010

static ip

/etc/network/interfaces

change

auto eth0
iface eth0 inet dhcp

or  auto lo
iface lo inet loopback



to

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Restart the neworking service:

sudo /etc/init.d/networking restart

Wednesday 1 September 2010

mounting windows shares, file permissions.

sudo apt-get install smbfs

edit /etc/fstab and add,

//192.168.x.x/data /mnt/data smbfs credentials=/etc/cifspw 0 0


edit /etc/cifspw as root and add,

username = username
password = password

Change permissions so people (o)ther than those as root and in group root cannot (-) (r)ead,

sudo chmod o-r /etc/cifspw

Try to read it...... permission denied.

Mount:

sudo mount -a

There may be a desire to mount with ownership as non-root. Check the mounting usb drive post elsewhere for instructions.

It reads,

sudo mount -o uid=username /dev/sdb /media/tmp

so specify -o uid=username during mount.

mounting windows shares, file permissions.

Wednesday 11 August 2010

gmshToFoam

http://www.cfd-online.com/Forums/openfoam-meshing-gmsh/78076-gmshtofoam-problem-not-same-mesh-gmsh-vs-paraview.html

Friday 6 August 2010

passwordless ssh

On the local machine, generate a key-pair. Then append the public key to the remote list of authorised hosts. DSA is old, RSA is new. Ho hum. rsa from now on.

The pairs are stored in

~/.ssh/id_rsa (id key)

OR

~/.ssh/id_rsa.pub (public key)

So: generate with

$ ssh-keygen -t rsa

Append the public key to the remote host with the command:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub username@remoteaddress

That should append to ~/.ssh/authorized_keys


Check the remote machine /etc/ssh/sshd_config has,

RSAAuthentication yes
PubkeyAuthentication yes

Restart the server if needed:

/etc/init.d ssh restart


This may be needed in .bash-profile: http://mah.everybody.org/docs/ssh

SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi


Now configure ssh-agent to provide the passphrase.

$ ssh-add ~/.ssh/id_rsa

passwordless ss

FTP, linux

sudo apt-get install vsftp

Edit /etc/vsftp.conf

Change

# chroot_local_user=YES

to

chroot_local_user=YES


to prevent navigating up the tree.

Tuesday 3 August 2010

eve configuration

Download the entire client, a few gig.
Install with wine or playonlinux.

If music fails:
winetricks wmp9

cd
cd .wine/drive_c/windows/system32/
ln -sf l3codeca.acm winemp3.acm

or, link l3codeca.acm to whichever wineprefix/drive_c/windows/system32 is appropriate.

Thursday 22 July 2010

accessing local web without router with local loopback.

For example, connecting to company webmail from inside the lan.

edit /etc/hosts

add:

192.168.1.1 www.webmail.com


where 192.168.1.1 is the internal ip address of the server; and www.webmail.com is the address normally accessed from the outside.

Friday 16 July 2010

Error 18: Selected cylinder exceeds maximum supported by BIOS

I think this is misleading.

From http://www.linuxforums.org/forum/redhat-fedora-linux-help/118994-error-18-selected-cylinder-exceeds-maximum-supported-bios.html

`Your BIOS does not see the whole drive. If you create a small
partition, mounted at /boot, then the BIOS will be able
to find the stage 2 of the bootloader. It depends on the size
of the Windows partition, whether there is enough space
to do this. Boot from a live cd and, in a terminal, issue
the command fdisk -l

This will tell you if the Windows partition extends beyond
the limit, probably the old 1024 cyl limit. If you create a partition
wholly under this limit for /boot, you will be OK'

This makes it sound like the fresh drive should have three
partitions: One for /boot', one for swap (at the end of the
drive), and one for everything else. /boot should be small.

This was not the case on this drive: I had put all the
installation files into a single, large partition (sdc2) and wondered
why, during installation, Ubuntu had insisted on
creating three partitions; the first of which was tiny.

Elsewhere, a recommendation to run fsck was found:

$ sudo fsck /dev/sdc

fsck 1.40.8 (13-Mar-2008)
e2fsck 1.40.8 (13-Mar-2008)
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
Doing this with sdc1 gave the same error, but sdc2 was ok. sdc1, I think,
should contain the boot stuff. Maybe I should reformat it as ext3
and copy /boot over to it.



From http://wiki.linuxquestions.org/wiki/GRUB#Error_18

`This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB on others.). In more practical terms this means the BIOS is unable to start executing the kernel because the kernel is not located within the block it can access at boot up time.

This can be circumvented by creating a boot partition at the beginning of the disk that is completely within the first 1023 cylinders of the harddrive. This partition will contain the kernel.

The kernel itself does not suffer from the same limitations as the BIOS so after the BIOS has loaded the kernel the kernel will have no problem accessing the whole harddrive. Newer BIOSes will automatically translate the harddrives size in a way that it can be completely contained within the first 1023 cylinders and hence modern computers do not suffer from this problem.
The same error can happen when the BIOS detects a disk in a different way as Linux does. This can happen when changing motherboards or when moving a GRUB-bootable disk from one computer to another. If this happens, just boot with a GRUB floppy, read the C/H/S numbers from the existing partition table and manually edit the BIOS numbers to match. If using a SUSE linux and installing on VM Ware this problem is solved by creating a small partition at the very beginning of the harddisc, and mounting it as /boot

Read more: http://wiki.linuxquestions.org/wiki/GRUB#Error_18#ixzz0tpqX29V7
'

So, it looks like the partition containing the kernel image
and initrd must be smaller than 8Gb for the BIOS to understand
it. That would explain the small first partition.

Another note at

http://www.supergrubdisk.org/forum/index.php?topic=150.0

suggests the grub lines should refer to sdc, not sdc1 as:

device (hd3) /dev/sdc1
root (hd3,0)

So, to summarise:

I need three partitions.
A small, primary, initial one to contain /boot
A large secondary one to contain everything else.
A third, medium swap one.

So, reformatting:

$ sudo parted /dev/sdc

No. parted does not support ext3. What format should
the first partition be? Does this imply it's usually
ext2? Odd. So, parted won't work (ext2 only), and
fdisk won't work (sdc has a GPT (GUID Partition Table)):
I'm getting annoyed.

The Parted user manual says that to manage ext3, use resize2fs or mke2fs.

Great.
----------------------------------------------------------------
OK. Reformat sdc completely. I think there may be a hangover
from the first attempt to install Lynx.

I reinstalled Lynx in an ext3 partition. Move these files, first.
Partition, format, copy back as appropriate. Can't! Permissions etc will get
ruined, I think. So, create a new partition table, format, install.


Set the partition table:

1) Make a small primary
partition to contain linux images (they're about 2 Meg) and
initrd.image files (they're about 8 meg each). Make the
partition, say 4 gig. It will, I think, be either ext2 or ext3.

sudo fdisk sdc
p

Disk /dev/sdc: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

OK. It's blank, but I still get the GPT warning, oddly.

Space is 255 heads * 63 sectors * 243201 cylinders * 512 bytes = 2000396321280 bytes = 1.8193498556502163 Terabytes. Yes, the units are bullshit.

Reserve 50 Gig = 50 Gig * 1024 Meg/Gig * 1024 k/Meg * 1024 bytes/k = 53687091200 bytes
for swap, at the end of the drive. We are left with 2000396321280 bytes - 53687091200 bytes = 1946709230080 bytes.

Use a primary partition for swap. I therefore have three primaries left.
Use a (small) primary for /boot, and a large primary for everything else.

So, use 4 Gig for \boot = 4 * 1024 Meg / Gig * 1024 k/Meg * 1024 bytes / k = 4294967296 bytes.

That leaves the main primary space as, 2000396321280 - 4294967296 - 53687091200 = 1942414262784 bytes.

BOLLOCKS. fdisk is not behaving properly. p1 of 4 gig is ok. Then, setting p2 with 1.8T - 4gig

WHY IS THIS SO DAMN COMPLICATED?!

For fucks sake. I want:

p1: boot. 4gig = 4294967296 bytes.
p2: data. 1.8T - 4g - 50g = 1.8 * 1024**4 - 4 * 1024**3 - 50 * 1024 ** 3 = 1921138871500 bytes
p3: swap. 50 g = 50 * 1024 ** 3 = 53687091200 bytes

fdisk, new, primary, 1, default cylinder (1), + 4294967296 is ok
then, new, primary, 2, default cylinder (2), + 1921138871500 is NOT OK.

Use 1000 instead of 1024?
p1: boot. 4gig = 4 * 1000**3 = bytes.
p2: data. 1.8T - 4g - 50g = 1.8 * 1024**4 - 4 * 1024**3 - 50 * 1024 ** 3 = 1921138871500 bytes
p3: swap. 50 g = 50 * 1024 ** 3 = 53687091200 bytes

No! Use cylinders instead?

>>> total = 1.8*1024**4
>>> boot = 4*1024**3
>>> swap = 50*1024**3
>>> data = total - boot-swap
>>> cylinders = 243201
>>> boot / total * cylinders
527.77994791666674
>>> data / total * cylinders
236075.970703125
>>> swap / total * cylinders
6597.2493489583339

OK! Lets do this. In fdisk:
new, primary, 1. Start: 1. Last: 6597
new, primary, 2. Start: 6598. Last: (6598 + 236075 = ) 242673
new, primary, 3. NO FREE SECTORS AVAILABLE.


WHAT THE FUCK?!

More reading. http://www.ibm.com/developerworks/linux/library/l-gpt/index.html

says that GPT is the new system, used with HDD > 2Tb. The problem is
also with filesystems. EXT2 and 3 have a filesize limit of 2Tb.
A GPT disk does not have a Master boot record, as the MBR is
limited in the size it can address: to 2Tb.

LILO and fdisk cannot cope with GPT. parted (gnu parted) can.
Looks like a change to parted is due.

So, the boot disk has a (limited) MBR, describing where
part two of the MBR is (for code) and describing the
partitioning. Gavin may have been correct in his suggestion
of removing the other disks and installing to the new one:
this would result in a GPT disk that could be chained to (I think)
from the original MBR or, maybe even boot to the GPT
disk with the chaining to the old, MBR disk.

Step one. AVOID fdisk! USE parted.

Tuesday 13 July 2010

http://irrepressible.info/?fragment=8

Monday 12 July 2010

vegetarianism and slavery

http://www.bbc.co.uk/ethics/slavery/ethics/justifications.shtml

Substitute `slavery' with `eating meat'.

Interesting points:

It's natural that some people are slaves.

tbc

Wednesday 7 July 2010

fixing broken streams avi

mencoder -idx s02e17.avi -ovc copy -oac copy -o s02e17b.avi

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. :)

Saturday 22 May 2010

persistent ssh with screen

Log into the remote machine with ssh

type, `screen'

work as normal.

Kill the connection or Detatch (CTRL-A d) the session.

Reconnect. Type, screen -ls

The screen session should be listed. (r)econnect to it by typing,

screen -r

Where is the information listed from screen -ls

--Naming----------------
screen -S test : create a new screen with the name, `test'

Or, within session: CTRL-A : sessionname test

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

Friday 21 May 2010

[12:35:57] Dr. F: I don't know who pgp is, but he doesn't know that Linux sucks the sweat off a dead man's testicles...
[12:48:32] Dr. S: pgp, Dr. F, is `pretty good privacy', and linux rocks.
[12:49:41] … An example: `D' plays World of Warcraft under its intended operating system, Windows. Dr. S plays an identical copy of the game (literally, copied) under linux using WINE. D's is unstable. Dr. S's is rock solid.
[12:52:46] … Another example: Dr. S clicks on a file in windows. It contains a virus. The virus installs, grabs credit card details, transmits them elsewhere, intercepts attempts to use a browser, re-writes the master boot record and blue screens. The disk needs to be low level formatted and the operating system (such that it is) reinstalled. In another world, Dr. S. double clicks an infested file under linux. It tries to access system files to install, and Dr. S is asked for his super user password (required for all installations). Dr. S smells a fish and politely declines. No damage.

Wednesday 19 May 2010

Car notes

Last oil change was long life, at 77k miles. Minimum service date, May '10.
Required oil: VW506 00 only. 4.3 Litres. 34L fuel tank.

Monday 17 May 2010

Lexmark 6200 with linux.

Purchased a couple of years ago or so, for about £200. Colour ink-jet printer, scanner. It may even print photos, I forget.

Anyway, Suse10: The printer shows up, but a test page doesn't work.

Hunting through Lexmark's site: no support for linux. No support for linux?
You fucking assholes, I may as well have donated the money to you. You cannot spare the salary of a single engineer to provide linux compatability? Well, fuck you. I will NEVER buy Lexmark again. With any luck, that's probably ten printers gone, over my life time. From a single person. Move with the times, Lexmark. Even when you do start to support Linux, I'll never buy from you again.

On a plus note, Brother printers seem to work well (so I'm told), and I know I got a Dell duplex laser printer to work well under linux. Pity Lexmark are so fucking pathetic as to not keep up. Well, a pity I didn't realise how shit they were before parting with my cash. It won't happen again.

Friday 14 May 2010

Latex memory

The animation package has tips in Section 8. They were,

Find texmf.cnf:

$ kpsewhich texmf.cnf

As root, edit it. Change the main_memory entry to

main_memory=10000000

Actually, mine was already 1.5x greater than that.

Rebuild the formats (?) as,

$ sudo fmtutil-sys --byfmt latex
$ sudo fmtutil-sys --byfmt pdflatex
$ sudo fmtutil-sys --byfmt xelatex

Saturday 8 May 2010

burning bluray / cd

growisofs -Z /dev/dvdrw -R -J -allow-limited-size /home/ms/forBluRay

worked!

I had installed dvd+rw-tools previously. This burned at 4x, estimated time approx 1.5 hours to burn a disk.

Another page recommended,

growisofs -v -Z /dev/dvdrw -r -J -allow-limited-size -speed=1 -dry-run /home/ms/forBluRay/2/*

Lower case `r' is recommended for Linux. `v' is verbose. -dry-run marks a test.

CD:

To burn an iso:

wodim --devices

wodim dev=/dev/cdrw -v -data cd_image.iso

To create an AUDIO cd from a bunch of wavs (cool!):

wodim dev=/dev/cdrw -v -audio [wav files...]

where `v' is verbose.

Friday 7 May 2010

Matplotlib bar charts.

from pylab import *
import numpy.numarray as na

labels = ['Other', 'Lib Dem', 'Warmongers', 'Posh twats']
data = [12, 23, 29, 36] # % data from the independent.
xlocations = na.array(range(len(data)))+0.5

width = 0.5
bar(xlocations, data, width=width)
ylim(0, 100) # a meaningful scale.
title("Voting proportions on a meaningful (%) scale")
gca().get_xaxis().tick_bottom()
gca().get_yaxis().tick_left()
xticks(xlocations+ width/2, labels)

Political memories, paper rubbish

Labour:

Illegal war under Tony Blair: huge protests not only in the UK but throughout Europe.

ACMD resignations over political pressure: 1, 2, 3, 4, 5, 6, 7, 8 members of the scientific community gradually withdraw from the board in protest. Public focus on the resignations makes no difference to the behaviour demonstrated by Labour.

http://ericcarlin.wordpress.com/2010/04/02/my-acmd-resignation-letter-to-the-home-secretary/



Tory:
Propose tax breaks for married couples. The break amounts to next to nothing financially, but the question remains: where would the money come from? Ultimately, from those who didn't get the break. The single person. It's ok though, as they'll raise the limit for inheritance tax up towards one million pounds, from the 250k or so it currently stands at. Bear in mind, the inheritance tax point has been changing with inflation (unlike some other tax break points), so this proposal is designed specifically, to benefit the rich.

Out of interest, how much do you need to earn to get a one million pound mortgage? At 3.5 times earning, approximately £300k. Not many degrees will get you there. That sort of money has to be inherited.


Lib dem:

Nothing bad to report, yet.


Independent reports on founding of `The big chill'. Source: wikipedia
http://www.theregister.co.uk/2010/08/10/balls_festival/


Daily Mail report iphone 4 recall: source twitter
http://www.theregister.co.uk/2010/06/28/daily_mail_fake_tweet/

Thursday 6 May 2010

Words and phrases of the day.

7/5/10: Abomination. (re: political outcomes)
6/5/10: Puerile.
7/5/10: Banal.
19/5/10: Irascible.

Monday 3 May 2010

flv youtube downloads

sudo apt-get install youtube-dl

voila.

There is more. Applications, software: install the restricted extras. Whatever: in firefox, about:plugins showed shockwave flash was installed and ok, when it was working. I had also installed smplayer and vlc a few minutes before.

I think it was probably the restricted extras that did it.

Thursday 22 April 2010

wget to pull sites.

wget -r -l10 www.sitename.com

recursive, 10 levels deep.

Friday 16 April 2010

mount remote windows directories

sudo apt-get install smbfs
sudo mkdir /mnt/tmp
sudo mount -t smbfs //192.168.1.xx/World\ of\ Warcraft /mnt/tmp -o username=dr,password=whatever

Thursday 15 April 2010

Non sudo shutdown

Create a group of users called, `shutdown' who are able to do this:

$ groupadd shutdown

Add users to this new group, by editing /etc/group
Add the following:

shutdown:x:407:user1,user2,...

Specify the commands these users / this group can access without sudo:

$ visudo

and add the following lines.

%shutdown ALL=(root) NOPASSWD: /sbin/reboot
%shutdown ALL=(root) NOPASSWD: /sbin/halt
%shutdown ALL=(root) NOPASSWD: /sbin/shutdown

and now,

$ sudo shutdown -h now

should not require a password, if the correct user attempts it.

----------------------
Post modified from http://ubuntuforums.org/showthread.php?t=134968

Attrocities

http://www.lovemoney.com/blog/thebigpicture/tories-make-some-good-moves-3120.aspx?source=1000457

2009/2010: Inheritance tax starts at 325k

Tories propose to increase this to 1000k : more money for the rich, no affect on those receiving inheritance sums upto 325k. Compare to house prices this year.


http://www.theregister.co.uk/2010/05/19/clegg_speech/

`no ID cards, no ContactPoint database, consent required to fingerprint children, stricter CCTV regulations, and tighter restrictions on whose DNA profiles can be retained by police.

On the Interception Modernisation Programme, which would demand ISPs retain details of the customers' communications in case intelligence or law enforcement agencies want to access them, he left more room for manoeuvre, saying: "We won't hold your internet and email records when there is just no reason to do so."'

IMP: Look that up...



Private conversations getting people nicked for `indecency':
http://www.theregister.co.uk/2010/05/18/text_law_extension/

Thursday 8 April 2010

ls examples

sort in size order, largest last:

(all (inc hidden), coloured, columns, directory names (not contents), l (verbose details), h(uman readable), r(everse order), S(ort by size)

ls -ChlarS

Wednesday 7 April 2010

flv file download

Watch the file

Navigate to, about:cache

Find the relevant entry. Right click, open in new tab

In the new tab, right click the link: save as.

Rename as required.

Also possible: inpect the cache as above, to get the disk address. Navigate here, find the largest, newest file, and copy it: rename as appropriate. The cache must be turned on for this to work.

Wednesday 10 March 2010

alsa mplayer

ALSA stuff.

Avoid OSS, as it seems the hardware gets locked during use.

aplay -l

to list the playback devices connected. There will be card numbers,
devices and subdevices.

mplayer addresses them as,

mplayer *.mp3 -ao alsa:device=hw=0.1

where this addresses card zero, device 1. At least, I think so.



alsamixer -c 2

will allow device 2 to be adjusted

==============================

At work:

mplayer -ao alsa:device=plughw=1.0 *.mp3

works, playing back from the usb DAC. :)

================================

Now, configure the mixer (mplayer level control) to effect the second device rather than internal.


.mplayer/config

#ao=alsa:device=hw=1
#mixer=/dev/mixer1

Wednesday 24 February 2010

libsndfile: audio with scipy -> Python audio tools.

Download the source

./configure
make
sudo make install

Then attempt to install `audiolab'. Spend some time, dicking about, trying
to understand how a version system, `trac' could be so prolific, when instructions
for using it to bloody well download the files it tracks, cannot be found.

Give up, and download each bloody file, one by one, manually creating
directories.

Get annoyed and find a different package: python audio tools

Sunday 21 February 2010

untar groups of files with xargs

ls *.rar | xargs -i unrar x {}

Saturday 13 February 2010

WoW and Guildwars on wine

This worked!

http://www.fsckin.com/2007/12/20/how-to-run-world-of-warcraft-wow-in-linux-using-wine/comment-page-3/

More detail:

glxinfo | grep rendering

should show direct rendering as yes.

Install wine, then some fonts:

sudo apt-get install wine msttcorefonts ttf-xfree86-nonfree

winecfg

Audio tab: try ALSA Driver

Copy the game over.

Update WTF/Config.wtf to the example below.

Run regedit. Add the key,

My computer/HKEY_CURRENT_USER/Software/Wine/OpenGL

and add the key: value

DisabledExtensions = GL_ARB_vertex_buffer_object

That should do it. Old data follows

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



Now, however, the sound is choppy. I changed to hardware sound; this helped the choppy video.
Today, the sound is off (after running gw and wow and pan on separate desktops).

So, according to http://ubuntuforums.org/showthread.php?t=964580 changing the buffer helps.
vi ~/.wine/drive_c/Program\ Files/World\ of\ Warcraft/WTF/Config.wtf

SoundBufferSize was "150"

Set to 50: No good. Restore to 150

Try using OSS audio instead of ALSA:

padsp winecfg and change from OSS to ALSA under the audio tab,

Run wow via:
padsp wine Wow.exe

I ran without the padsp command: Changing to ALSA fixed the audio. :)

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

A month later and WoW won't update. It claims there's a patch that needs downloading, but it can't do it. Piece of shit! Notes all over the web with moaning kids proposing silly fixes involving timed right clicks and permissions.

Anyway, long story short. Copy a working version over, from a different machine. It worked.

The WTF/Config.wtf file read as follows:

SET readTOS "1"
SET readEULA "1"
SET readTerminationWithoutNotice "1"
SET readScanning "-1"
SET readContest "-1"
SET locale "enGB"
SET expansionMovie "0"
SET movie "0"
SET showToolsUI "1"
SET portal "eu"
SET realmList "eu.logon.worldofwarcraft.com"
SET coresDetected "2"
SET timingTestError "0"
SET hwDetect "0"
SET gxRefresh "56"
SET gxMultisampleQuality "0.000000"
SET videoOptionsVersion "3"
SET Sound_OutputDriverName "System Default"
SET farclip "1277"
SET specular "1"
SET groundEffectDensity "64"
SET installType "Retail"
SET patchlist "eu.version.worldofwarcraft.com"
SET mouseSpeed "1"
SET Gamma "1.000000"
SET accounttype "CL"
SET Sound_MusicVolume "0.60000002384186"
SET Sound_AmbienceVolume "0.40000000596046"
SET projectedTextures "1"
SET realmName "Trollbane"
SET gameTip "87"
SET gxResolution "1440x900"
SET VoiceActivationSensitivity "0.39999997615814"
SET ChatMusicVolume "0.29999998211861"
SET ChatSoundVolume "0.39999997615814"
SET ChatAmbienceVolume "0.29999998211861"
SET textureFilteringMode "5"
SET componentTextureLevel "9"
SET shadowLevel "0"
SET groundEffectDist "140"
SET environmentDetail "1.5"
SET weatherDensity "3"
SET gxApi "opengl"
SET ffxGlow "0"
SET SoundOutputSystem "1"
SET SoundBufferSize "150"
SET Sound_EnableHardware "1"
SET Sound_SFXVolume "0.30000001192093"
SET gxVSync "0"
SET Sound_OutputQuality "0"
SET Sound_MasterVolume "0.60000002384186"
SET gxWindow "1"
SET Sound_NumChannels "64"
SET Sound_ZoneMusicNoDelay "1"
SET Sound_EnableSoundWhenGameIsInBG "1"
SET accountName "yeahright@etc.com"

Thursday 11 February 2010

The end of xp? mplayer audio track selection.

This evening, I double clicked an audio file in explorer, to play it. It's long filename resulted in the file extension running off the screen edge: I scanned the filename and icon and concluded it was a .mp3.

It wasn't. It was a compressed executable which promptly ran and infested my machine, turning off the firewall; slowing the machine to a halt; triggering multiple warnings (credit to Microsoft for one of their patches managing that, at least) and eventually (10 seconds or so) blue screening.

On reset, wallpaper change and lots of warnings.

Fuck it. Back to linux. Grab all the data off the drive and reinstall.

No. This was XP on sda5 or so. Do I trust the windows installer not to interfere with the other (perfectly operational) linux partitions? In short, no.

So, good bye XP. You had your chance, but if double clicking a single file is enough to hose my system, I'd be acting irresponsibly if I were to use it. It was only for games anyway.

So, now, World of Warcraft on Linux. First, mplayer audio track selection.

mplayer -vo null -ao null -frames 0 -v filename | grep audio

shows the audio tracks available. To run `2' (if it's there):

mplayer -aid 2 filename

For example:

mplayer -vo null -ao null -frames 0 -v VTS_02_1.VOB | grep audio

shows

==> Found audio stream: 128
==> Found audio stream: 129
==> Found audio stream: 130
==> Found audio stream: 131
==> Found audio stream: 132

So, try

mplayer -aid 129 VTS_02_1.VOB

or even add some lf cut EQ:

mplayer -aid 129 -af equalizer=-12:-6:0:0:0:0:0:0:0 VTS_02_1.VOB

http://www.linuxjournal.com/article/9787

is interesting.

Dont forget full screen!

mplayer -aid 129 -af equalizer=-12:-6:0:0:0:0:0:0:0 -fs VTS_02_1.VOB

and finally, deinterlace:

mplayer -aid 129 -af equalizer=-12:-6:0:0:0:0:0:0:0 -fs -vf lavcdeint VTS_02_1.VOB

The obvious thing to do is to substitute a command, say `play',
to execute all that spuff, followed by the filename.

Set up the mplayer defaults!

http://liquidweather.net/howto/index.php?id=98

shows ~/.mplayer/config

if created, contains the defaults. Great! Send all mplayer screen output to
the file ~/.mplayer/output and refer to it from conky!

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

ALSA stuff.

Avoid OSS, as it seems the hardware gets locked during use.

aplay -l

to list the playback devices connected. There will be card numbers,
devices and subdevices.

mplayer addresses them as,

mplayer *.mp3 -ao alsa:device=hw=0.1

where this addresses card zero, device 1. At least, I think so.

Tuesday 9 February 2010

Python list comprehension with logic

test= [i if i in [1,2] else 0 for i in xrange(5)]

test= [i if i in [1,2] else 2*i if i in [3,4] else 0 for i in xrange(5)]

ie, the trailing `else' is essential.

Monday 8 February 2010

Xlib: extension "Generic Event Extension" missing on display "localhost:10.0"

This occurred with a fresh installation of ubuntu 9.10 (karmic). The machine had an ATI graphics card. The error listed below occurred with

ssh -x ipaddress

and then running gmsh on the remote machine. Firefox worked ok, forwarding graphics as hoped.

The fix was to install the restricted drivers for the card, an operation achieved from gnome on prompting that there were restricted drivers available.

Error follows:


Xlib: extension "Generic Event Extension" missing on display "localhost:10.0".
Insufficient GL support
[englinux02:12698] *** Process received signal ***
[englinux02:12698] Signal: Segmentation fault (11)
[englinux02:12698] Signal code: Address not mapped (1)
[englinux02:12698] Failing at address: 0x18
[englinux02:12698] [ 0] /lib/libc.so.6 [0x7fec9f45a530]
[englinux02:12698] [ 1] /usr/lib/libfltk_gl.so.1.1(_ZN12Fl_Gl_Window12make_currentEv+0x59) [0x7feca7e35cc9]
[englinux02:12698] [ 2] gmsh [0x480ba1]
[englinux02:12698] [ 3] gmsh [0x41b497]
[englinux02:12698] [ 4] /lib/libc.so.6(__libc_start_main+0xfd) [0x7fec9f445abd]
[englinux02:12698] [ 5] gmsh [0x41afe9]
[englinux02:12698] *** End of error message ***
Segmentation fault

Sunday 7 February 2010

vlad

v g o n t c h a r o v @ru wave .c o w.you kay

Thursday 4 February 2010

binaural frog recording!

http://www.virtualbarber.org/page.php?21

Latex for each loops.

Credit to Gavin for this one.

To create a for loop, iterating over a list:

\def\freqlist{17000,17100,17200,17300}

\foreach \freq in \freqlist
{
%\input{chapters/\TeXName}
\freq
}

This was used to select filenames for multiple image imports; the images
were generated externally and were named according to the frequency.

Monday 1 February 2010

In-line text replacement / ascii filter

The file conky is displaying from mplayer, contains non-ascii characters.

Filter its display.

http://www.devdaily.com/unix/edu/un010011/

shows the `tr' command helps:

tr -cd '\11\12\40-\176' < $INPUT_FILE > $OUTPUT_FILE

Those are octal numbers?! Unusual.

Friday 29 January 2010

listing files (for mplayer playlist)

Navigate to the root of the music directory

find > /home/me/music/ | sort > playlist_complete

The full path spec. is required to get it into the playlist.
Sort is required to sort the output; otherwise, a different list order occurs.

Thursday 28 January 2010

heads and tails to extract lines

This can be used with mplayer and conky, to display the current track.

Start mplayer with:

mplayer -playlist playlist > tempmplayerfile

to dump mplayer output to the file, tempmplayerfile

Then, extract a few lines near the end of that file for the current playing information.
The last line will be gibberish.

tail -n 5 tempmplayerfile | head -n 3

will display the first three lines, of the last 5 lines of the file.

I found the following worked well:

tail -n 17 tempmplayerlist | head -n 15

mplayer

mplayer -playlist playlistfile

< and > to skip tracks

Turn off compression. On by default.
mplayer -a52drc 0


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

from http://linux.dsplabs.com.au/mplayer-multiple-sound-cards-select-audio-device-p77/

to select an audio device:

Default:
mplayer -ao oss:/dev/dsp *.mp3
mplayer -ao alsa:device=hw=0.0 *.mp3


Non default:
mplayer -ao oss:/dev/dsp1 *.mp3
mplayer -ao alsa:device=hw=1.0 *.mp3



mplayer -ao oss:/dev/audio2 *.mp3

worked after Skype reached in and changed my default sound device,
without asking.

----------------------------  mplayer subs

mplayer -sub *.srt *.avi

:)

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

mplayer

Monday 25 January 2010

Those who can, do; those who can't, write (become journalists).

building gmsh

wget http://www.geuz.org/gmsh/src/gmsh-nightly-source.tgz
tar xvzf gmsh-nightly-source.tgz
cd gmsh- (whatever)

cmake CMakeLists.txt
make
sudo make install

Thursday 21 January 2010

firefox

Fire up with profile selection:

firefox -P -no-remote

Saturday 16 January 2010

A note on upates

On running gnome, synaptic was shown via `ps -A', when I was alerted of many updates.

It may be wise to run synaptic on occasion, from fluxbox.

Ubuntu Jaunty no sound fluxbox, possible utube fix too.

No sound available in my fluxbox, nomatter which sound card I select (and i plugged new usb ones in, and selected them in audacity, to no avail). Then I found

http://www.ubuntugeek.com/simple-guide-to-sound-solutions-for-hardyintrepid-and-jaunty-jackalope-users.html

providing help for those using Gnome. I following the instructions:

sudo apt-get install asoundconf-gtk gnome-alsamixer alsa-oss libasound2 libasound2-plugins padevchooser gstreamer0.10-pulseaudio ubuntu-restricted-extras

The ubuntu-restricted-extras package, it is claimed, can help with websites streaming content.

The help page had plenty of pointers, all using gnome. On exciting fluxbox, running gnome, I
could do:

System / preference / sound

which, according to `ps -A', ran

gnome-volume-control

Executing this from a terminal showed that in spite of alsa-mixer showing no mute, gnome-volume-control was set to mute. How, who knows?

Anyway, unsetting mute, fixed the audio. Now, can I have those three hours of frustration refunded, please?

Sunday 10 January 2010

\left( \right) incompatible with something

\begin{align}
\sum_{a=1}^{n_{GL}} \sum_{i=1}^{n_{H}} \sum_{j=1}^{n_{H}}
G_{w1} G_{w2} G_{w3} |J_{a}|
( &
\frac{\partial H_{ai}}{\partial x}
\frac{\partial H_{aj}}{\partial x}
+ \frac{\partial H_{ai}}{\partial y}
\frac{\partial H_{aj}}{\partial y}
+ \frac{\partial H_{ai}}{\partial z}
\frac{\partial H_{aj}}{\partial z}
- k^{2} H_{ai} H_{aj} \\ % ie k^2 * w * p
& + 2i
(
M_{x} k H_{ai} \frac{\partial H_{aj}}{\partial x}
+ M_{y} k H_{ai} \frac{\partial H_{aj}}{\partial y}
+ M_{z} k H_{ai} \frac{\partial H_{ak}}{\partial z}
)
)
\end{align}

works. Changing the parentheses to \left( and \right) fails, reason unknown.

It's not all bad news, though. This form works:

\begin{equation}
\begin{split}
x & = y \\
& = \left( z \right)
\end{split}
\end{equation}

Watch the direction of the new line delimiters.

More fiddling showed a line break could not occur between the \left( and \right). ?!

http://www.latex-community.org/forum/viewtopic.php?f=46&t=4823

showed that terminating a line before the break with, \right.
and starting the next line with \left.

fixes these problems.

Monday 4 January 2010

Sunday 3 January 2010

mtab fstab mounting problems

I couldn't mount my win directory at startup, but could with default options in a terminal, later.

Inspection of /etc/mtab showed the working command. I copied it to fstab. It worked. :)

Latex setup

sudo apt-get install texlive

or, for the full installation:

sudo apt-get install texlive-full

mpi, pypar, koala

sudo apt-get install openmpi-bin

sudo apt-get install libopenmpi-dev

sudo apt-get install subversion

mkdir -p ~/Downloads/pypar
cd ~/Downloads/pypar
svn checkout http://pypar.googlecode.com/svn pypar-read-only

cd pypar-read-only/source
sudo python setup.py install

Worked on koala, as long as numpy was installed beforehand.

Saturday 2 January 2010

rsync

Jump to end, for fix:


Attempting to connect to work, rsync appears to hang. Is the deamon running?

According to the rsync man page, the rsync daemon should get started up
by specifying it in

/etc/services

Checking this file shows around 600 entries. Add,

rsync 873/tcp

where, i presume, 873 is the contact port. My port number was incorrect.

Checking /etc/inetd.conf showed it was empty. I added,

rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

as per the man page. I then reset the machine, as I couldn't figure out how to send HUP to inetd, given it wasn't listed via ps -A

------------ fix -------------

Don't try to run the rsync daemon in a different way on the host.
At the client, specify the port: eg

rsync -avzrP --rsh='ssh -p123' login@192.168.1.1:/home/me/whatever ./

works.