import subprocesshttps://www.cyberciti.biz/faq/python-execute-unix-linux-command-examples/
subprocess.call("command1")
subprocess.call(["command1", "arg1", "arg2"])
Saturday, 18 November 2017
Calling shell commands using subprocess in Python
Tuesday, 11 April 2017
cups over parallel ssh
sshpass -f pwfile parallel-ssh -h labhosts "-o StrictHostKeyChecking=no" -i -A -I -l computer "sudo -S lpadmin -d Gym_copier" < pwfileadd printer
sshpass -f pwfile parallel-ssh -h labhosts "-o StrictHostKeyChecking=no" -i -A -I -l computer "sudo -S lpadmin -p Epson-IT -E -v lpd://10.0.0.31/lp -P /usr/share/cups/model/EPSON-IT.ppd" < pwfile
sshpass -f pwfile parallel-ssh -h labhosts "-o StrictHostKeyChecking=no" -i -A -I -l computer "sudo -S lpadmin -p Gym_copier -E -v lpd://10.0.0.30/lp -P /usr/share/cups/model/Sharp-MX-M565FN.ppd" < pwfile
Thursday, 2 March 2017
parallel-ssh
new upgrade to the lab computers broke parallel-ssh
https://getreu.net/public/downloads/doc/Secure_Computer_Cluster_Administration_with_SSH/
Wednesday, 31 August 2016
Join pdf files
Saturday, 11 June 2016
24h acid hydrolysis
Needing to hydrolyse some protein foods down to amino acids by boiling for 24h in 6M HCl, I came up with a new "invention".
Place four 100ml conical flasks full of water into a 2l Japanese water boiler, about half-full, so as not to cause the flasks to float. Having four of them means they can't tip over anyway.
Then place your hydrolysis solution in a boiling tube into one of the flasks (or do up to four at once). I stoppered it with a one-hole stopper, to prevent too much water dripping into the tube and diluting the HCl or causing it to overflow.
I set the boiler to 90oC, not 98, to reduce the amount of bumping.
It works really well, and is so much safer than using a normal water bath.



Tuesday, 29 March 2016
Thiosulphate - Acid in a reasonable time
0.1M sodium thiosulphate + 1.0M hydrochloric acid + water in equal volumes gives about 6 minutes to obscure a cross at 20oC, or about 2 minutes to max out a turbidity sensor at the same temp.
Monday, 23 November 2015
Joining fields and removing delimiter
- Copy the names and surnames from the spreadsheet and paste into a text editor. Save as for example names.
- Convert to lowercase. Names will be in two columns: firstname and surname:
dd if=names of=lowercase conv=lcase
- Create a file for each column, then get just the surname initial (I don't care about the inefficiency of creating all these files instead of cooking up a fancy one-liner)
cut -f1 lowercase > first
cut -f2 lowercase > last
cut -c1 last > lastinitial - Join it back up and remove the delimiter:
paste -d : first lastinitial > fplus1
cat fplus1 | tr -d : > usernames