Sunday, October 06, 2013
Saturday, August 24, 2013
Friday, August 23, 2013
Find duplicates in bash
find_dupes.sh
#! /bin/bash
OUTF=rem-duplicates.sh;
echo "#! /bin/sh" > $OUTF;
echo "" >> $OUTF;
find "$@" -type f -print0 | xargs -0 -n1 md5sum | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate | sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF;
chmod a+x $OUTF
Run the script:
./find_dupes.sh /path/to/check .\
Which will output a file called rem-duplicates.sh which can then be edited as you wish.
I stole this from here. Credit to Marco Fioretti, who in turn used code from J. Elonen
Friday, August 16, 2013
Getting started with Linux in VFX
Useful entry level reading for someone that's never used linux before....
http://www.creativecrash.com/tutorials/the-unix-shell-for-vfx-artists#tabs
Thursday, August 15, 2013
VFX pipeline diagram - real world example
Wednesday, August 14, 2013
How to setup a reverse ssh tunnel
- All you need to do is create a reverse tunnel from your Work Desktop/Server to your home server.
- ssh -nNT -R 5000:local_server:22 username@remote_server
- Now from the remote_server run this
ssh -p5000 localhost.... now we are in our work desktop/server.
- Lets brake this down a bit..
- The -n option Redirects stdin from /dev/null. This must be used when ssh is run in the background.
- The -N option does not execute a remote command. This is useful for just forwarding ports.
- The -T option disables pseudo-tty allocation.
- The -R option does tha job of setting up the reverse tunnel.
- Port 5000 is the port that will be listening on the remote_server (this can be any random port over 1024, if you want to run this as a non-root user).
- local_server is the desktop/server that you are creating the connection from.
- Port 22 is the port that you are making the ssh connection to.
- user_name@remote_server is where you are making the ssh connection to for the reverse tunnel.
- In /etc/ssh/sshd_config we need to make sure this is set TCPKeepAlive yes.\
- We need to make sure we keep this connection open.
Running a script as root
The problem:
Solutions:
binary wrapper
#include#include #include #include using namespace std; int main(int argc, char* argv[]) { setuid( 0 ); string cmd = "/opt/local/cmd.sh"; for (int i = 1; i < argc; i++) { string arg (argv[i]); cmd += " "; cmd += arg; } int exitcode; exitcode = system(cmd.c_str()); return WEXITSTATUS(exitcode); }
gcc runscript.c -o runscript sudo chown root:root runscript sudo chmod 4750 runscript
sudo wrapper
group ALL = NOPASSWD: /path/to/script
sudo /path/to/script
A couple of things to note:
- it's not enough to do 'chmod 4***' on the binary, you also have to use 'setuid' inside the code.
- an additional problem on Mac OS X is, that by default the 'setuid' bit is disabled on NFS mounts.
x forward session with xdmcp
[xdmcp] Enable=true [security] DisallowTCP=false AllowRemoteRoot=true
gdmsetup
Forward user x sessions
ssh root@somehost xauth list
somehost.somedomain/unix:10 MIT-MAGIC-COOKIE-1 d9fc3512df83a70ea8054dff21f58e28
su - someuser xauth add somehost.somedomain/unix:10 MIT-MAGIC-COOKIE-1 d9fc3512df83a70ea8054dff21f58e28
Friday, July 26, 2013
20MB Boot Floppy Image
Most of the boot floppies you can download are 1.4MB which makes upgrading some firmware modules difficult when PXE booting as the images wont fit.
I was able to build a 20MB image using these commands.
wget http://itblog.su/downloads/W98SE_R.img
rpm -ivh ms-sys-2.2.0-1.el5.rf.i386.rpm
dd if=/dev/zero of=floppy.img bs=1024 count=20000
mkdosfs floppy.img
ms-sys -1 -f floppy.img
mount -o loop floppy.img /mnt/floppy
mount /W98SE_R.img /mnt/dos
cp /mnt/dos/* /mnt/floppy/
umount /mnt/dos/
IPMI Upgrade through PXE
Out of the box the machines came with a version of IPMI that didn't work for us so we had to update the IMPI firmware using the yafukcs utility.
The standard approach is to perform this via USB key but due to the number of nodes this is not practical. Therefore I created a freedos image containing the required firmware and configuration files that can be PXE booted to the nodes in one go.
This process saves around 4 days of manual labour. We still have to manually gather the MAC addresses of the new IPMI interfaces and add them to DHCP, but there are ways we can speed this process up using FDB in the switches.
Once we have our bootable image we add the required firmware update files
autoexec.bat
@echo off set PATH=.;\;\LOCALE
echo Using US-English keyboard with US-English codepage [437]
ipmicfg.exe -m
1.bat
2.bat
fdapm coldboot
1.bat
yafukcs.exe -full X8DTT_~1.IMA
Although it was quicker to update only the required modules using the -auto option we had better success with re-updating all the modules using the -full option.
2.bat
ipmicfg.exe -m
ipmicfg.exe -dhcp on
ipmicfg.exe -dhcp
ipmicfg.exe -r
Once we run the update we configure IPMI with ipmicfg.exe to DHCP and very importantly perform a BMC cold reset. Then we add the image to the PXE config on our boot server (puppet in this case)
The relevant lines in the /var/lib/tftpboot/pxelinux.cfg/
LABEL Supermicro IPMI Firmware Update
KERNEL /sysresccd/isolinux/memdisk
APPEND initrd=/sysresccd/isolinux/floppy.img
And copy the image (floppy.img) to /var/lib/tftpboot/sysresccd/isolinux/
We can now boot into the new image to ensure it works by selecting the new menu option from the PXE boot menu.
Saturday, February 09, 2013
Sunday, January 23, 2011
CCOMTB - 2011 - Round 1
Grade: B
What a race, and what a turn out! It looked like there were about 15 people in A grade alone. Great Nobmob turn out too, hopefully those that haven't been before can see what a great race it is and will attend some more. Well done to Ray for what looked like 5th place in A grade - what a demon. Logan, hope your cuts heal OK, they looked pretty nasty but nothing a pommy victory at the cricket wouldn't solve eh?
I started at the back of the pack in B grade, and had great fun once I decided to back the first lap pace off a bit. No idea what place I came, Gazza said I came in after him but I can't see how, I felt like I was pretty coozie on the last 2 laps. I was expecting to blow up hard given that I've been zero training since the new little man was born (who has great quad development at 7 weeks old incidentally) but I felt in pretty good shape. I had a chance to ride behind a 29er for some of it, those bikes certainly seem to make sense at a track like Ourimbah, he was certainly rolling over the rough stuff and making it look easy.
No events really.. big traffic jam at the top of the drop on the first lap, looks like someone didn't ride the lap before hand , I lost the rear end on Small meadows, I couldn't get rid of the smile in the grave yard, oh and I loved the end of the the roller coaster now that it misses magic carpet. It sounds like magic carpet is about to get some pretty choice upgrades - can't wait for round 2.
Thursday, December 23, 2010
CCOMTB - 2010 final results
For my record keeping, the final results have been posted up:
Final results : http://www.ccomtb.com.au/results/Final%20XC%20Rankings%202010.pdf
What a great year, never thought I could get first place in B grade, but I guess showing up to as many races as possible really pays off. I'm really going to try and do some next year as well.
Edit: Managed to get to the first round of CCOMTB XC 2011, and picked up my trophy
Monday, November 01, 2010
CCOMTB - Club Race - 2010 Round 10 - 6 hour Final
Hard. Phew, what a race.
This was my last for a while with a baby on the way my races are taking a back seat. This was also the last race of the CCOMTB season and I managed to do all but one so wanted to go well. I started too hard after telling eveyone I was going to go easy and realised I was in for a hard race by the end of lap two. I just couldn't drink enough water and by lap 5 was showing the signs of dehydration. I pretty much had a rest after every lap from then on. Timing was good though, managed to time the cut off just after passing through the gate so squeezed another (very slow) lap in. On that lap I ran over a snake and narrowly avoided a rider coming the wrong way at the bottom of browns! The scare almost made me forget the cramps.
How some people do solo 8 hours around here I don't know.
The CCOMTB season has been great, recommended to everyone for good hard racing, friendly people and of course some of the best trails around.
Monday, September 13, 2010
CCOMTB - Club Race - 2010 Round 9 REVERSE LOOP
Great but hard race. Like a different track in reverse, but really good fun, and some big hucks. Still waiting for the result but I'm told I was 3rd or 4th.
http://connect.garmin.com/activity/48763936
Monday, August 30, 2010
Wednesday, August 25, 2010
CCOMTB - Club Race - 2010 Round 8
Great race this weekend. Come on Gazza, the championship's yours to loose now.


