Tuesday, 11 April 2017

cups over parallel ssh

set default printer
sshpass -f pwfile parallel-ssh -h labhosts "-o StrictHostKeyChecking=no" -i -A -I -l computer "sudo -S lpadmin -d Gym_copier" < pwfile
add 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

Wednesday, 31 August 2016

Join pdf files

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf (or *.pdf)

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

Struggling to get a simple thiosulphate - hydrochloric rate of reaction practical to work in a handful of minutes, trial and error brings me to this conculsion

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

This is how to create usernames from the attendance list. It is highly unlikely to be the most efficient way, but its quick and I understand it.

  1. Copy the names and surnames from the spreadsheet and paste into a text editor. Save as for example names.
  2. Convert to lowercase. Names will be in two columns: firstname and surname:
    dd if=names of=lowercase conv=lcase
  3. 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
  4. Join it back up and remove the delimiter:
    paste -d : first lastinitial > fplus1
    cat fplus1 | tr -d : > usernames
Now you have a file of usernames of first names + 1 initial, in lower case. Fix by hand for unusual names with brackets or spaces.