Skip to content

Instantly share code, notes, and snippets.

View alexclifford's full-sized avatar

Alex Clifford alexclifford

  • Melbourne, Australia
View GitHub Profile
@alexclifford
alexclifford / ovftool_restore.sh
Created January 30, 2014 01:23
Restore/Deploy an OVF backup/template
# Restore/Deploy an OVF backup/template
ovftool -ds=datastore -dm=thin -n=new-server /var/backup_files/esxi/ubuntu-template/ubuntu-template.ovf vi://root@esxi01.example.axxin.com
@alexclifford
alexclifford / read_pf_log_file.sh
Created February 5, 2014 00:04
Read a pf log file...
tcpdump -n -e -ttt -r /var/log/pflog
@alexclifford
alexclifford / bashrc_changes
Created March 28, 2014 00:20
Useful ~/.bashrc changes from default Ubuntu install
HISTSIZE=100000
HISTFILESIZE=100000
HISTTIMEFORMAT='%F %T '
@alexclifford
alexclifford / reset_bash_history.sh
Created March 28, 2014 00:24
Completely reset bash history and logout before more is logged
#!/bin/bash
> ~/.bash_history && history -c && exit
@alexclifford
alexclifford / rescan_vm_for_new_hdd.sh
Created March 28, 2014 00:25
Rescan scsi bus on VM to add new HDD without rebooting
#!/bin/bash
echo "- - -" > /sys/class/scsi_host/host#/scan
@alexclifford
alexclifford / remove_landscape_motd.sh
Created March 28, 2014 00:25
Remove Ubuntu landscape information from motd
#!/bin/bash
apt-get --purge remove landscape-common
@alexclifford
alexclifford / clean_old_kernels.sh
Last active August 29, 2015 13:57
Remove old, unused, kernels from Ubuntu
sudo apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
@alexclifford
alexclifford / parse_ftp_files.sh
Created April 15, 2014 23:15
Parse Nowcast FTP data to create a coordinates plotted Google Map
#!/bin/bash
# cat out all the files' contents to a single file
for DIR in `ls /home/nowcast/FTP_root/au/`; do zcat /home/nowcast/FTP_root/au/$DIR/* >> file.txt; done;
# keep only uniq entries
sort file.txt | uniq >> final_file.txt
# print out the lat/long/timestamp in the required javascript syntax for the Google Maps HTML file
# cloud to ground
awk '$3 <= -38 && $3 >= -39 && $4 >= 146.5 && $4 <= 147.5 && $6 == 1 { print "add_markers(1," $3 "," $4 ",\x27" $1 " " $2 " - " $3 " " $4 "\x27,\x27" $1 " " $2 " - " $3 " " $4 "\x27,\x27/lightning-icon-Sparse-1.png\x27)"}' final_file.txt >> markers_cloud_to_ground.txt
@alexclifford
alexclifford / pidgin_show_buddy_list
Last active August 29, 2015 13:59
Fix Pidgin icon not having a right-click option to display the Buddy list
From http://askubuntu.com/questions/67286/pidgin-doesnt-show-buddy-list:
-----
This issue still occurs on 12.04. Sometimes, the only way to get it to work is to killall pidgin and use the launcher from the dash. However, I came up with a solution that works every time.
Use the following command:
gksu gedit /usr/share/applications/pidgin.desktop (or use your favorite editor instead of gedit)
Add this to the bottom of the file and save:
@alexclifford
alexclifford / self-sign-cert.sh
Created June 30, 2014 01:47
Create a self-signed SSL certificate
sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out public.crt -keyout private.key