Thursday, June 5, 2014

Resize many gif images using imagemagick

for i in *.gif; do convert $\$$i -resize 400x400 $\$$(basename $\$$i .gif).gif; done

wget files of a certain type in all subdirectories

wget -r -A .gif <website>

Show status of dd command

Run dd with something like

sudo dd if=/dev/zero of=/dev/sdx

Now in another terminal, do ps ax| grep dd

Look at the process id (first column) of the dd command

Use that process id as input for

sudo kill -SIGUSR1 <pid>

This will force dd to print a status update

http://serverfault.com/questions/4906/using-dd-for-disk-cloning

PXE boot args for disabling nouveau

Doing lsmod | grep nouveau showed nouveau drivers being loaded, even though I had the following PXE boot args

append initrd=myrd.gz root=/dev/ram0 rdblacklist=nouveau nouveau.modeset=0 init=/bin/init ramdisk_size=800000 ramdisk_blocksize=1024 rw
Noveau was still loading, but adding nouveau.blacklist=1 solved it, like so:

append initrd=myrd.gz root=/dev/ram0 nouveau.blacklist=1 rdblacklist=nouveau nouveau.modeset=0 init=/bin/init ramdisk_size=800000 ramdisk_blocksize=1024 rw

There is also a nouveau.disable=1 option, which I did not try
http://fedora.12.x6.nabble.com/Problems-removing-nouveau-in-fed-18-td4993336.html

Make a bootable USB

Copy the .iso file to /dev/sdx (NOT /dev/sdx1)

dd bs=4M if=/path/to/iso of=/dev/sdx

When finished, make sure to zero out the boot record and non-standard partition table:

dd count=1 bs=512 if=/dev/zero of=/dev/sdx

https://wiki.archlinux.org/index.php/USB_Installation_Media

Making a pdf from an IPython notebook

With the latest ipython one can run ipython nbconvert latex mynotebook.ipynb. The latest ipython can currently be installed from https://github.com/ipython/ipython, at the time of this writing this is the 1.0 development stream.


ipython nbconvert latex mynotebook.ipynb will result in a latex file. texi2pdf should then be able to convert this tex file into a viewable pdf - in my case I had to manually copy all the files and images out of the associated mynotebook_files directory to the same directory as the .tex file, both of which were generated by ipython nbconvert. If you encounter latex errors, see http://www.tug.org/texlive/acquire-netinstall.html for installation instructions for the latest latex. The default Ubuntu texlive package (as of 13.04 at least) is not recent enough to perform the conversion!

Copy files over ssh

dd if=input | ssh login@remotehost "dd of=output"