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 / 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 / sources.list
Created June 24, 2014 00:21
Ubuntu sources.list mirrors
# Automagically works out which mirror is the fastest and uses that
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
@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
@alexclifford
alexclifford / simple_dir_backups.sh
Created August 5, 2014 10:32
Quickly backup a bunch of directories on centos server
#!/bin/bash
BACKUP_PATH="/root/backups/"
BACKUP_DIR=$BACKUP_PATH$(date +%F)"/"
TARGETS="/root/.bash_history /root/.bashrc /root/.ssh /root/.subversion /etc/httpd/conf /etc/httpd/conf.d /var/www /etc/ssh/sshd_config"
# Loop through $TARGETS and rsync them all to $BACKUP_DIR but maintaining their directory paths
for DIR in `echo $TARGETS`
do
mkdir -p $BACKUP_DIR$(dirname ${DIR})
rsync -av $DIR $BACKUP_DIR$(dirname ${DIR})
@alexclifford
alexclifford / cloudatcost_network_interfaces
Created August 5, 2014 10:34
Cloudatcost network interfaces example
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 162.248.161.181
gateway 162.248.161.1
netmask 255.255.255.0
sysctl kernel.hostname=c123456-3467.cloudatcost.com
hostname c123456-3467.cloudatcost.com
@alexclifford
alexclifford / get_mysql_db_sizes.sql
Last active August 29, 2015 14:05
MySQL query to get all database sizes in MB
SELECT table_schema "Database Name",
sum( data_length + index_length ) / 1024 / 1024 "Database Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
@alexclifford
alexclifford / postgres_debug.sh
Created August 26, 2014 03:43
Start postgresql on Ubuntu 12.04 with debugging enabled
sudo -u postgres -H /usr/lib/postgresql/9.1/bin/postgres -d 3 -D /var/lib/postgresql/9.1/main/ -c config_file=/etc/postgresql/9.1/main/postgresql.conf
@alexclifford
alexclifford / change_default_editor.sh
Last active August 29, 2015 14:05
Change default editor to vim in Ubuntu
sudo update-alternatives --set editor /usr/bin/vim.basic
@alexclifford
alexclifford / sendmail_test.sh
Created September 2, 2014 04:05
sendmail test
sendmail -v [email protected] < test.txt
@alexclifford
alexclifford / most_used_commands.sh
Created September 24, 2014 22:38
Read history and count most used commands
history | awk '{CMD[$4]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10