Skip to content

Instantly share code, notes, and snippets.

View luisuribe's full-sized avatar

Luis Uribe luisuribe

View GitHub Profile
@luisuribe
luisuribe / gist:1424888
Created December 2, 2011 21:22
poor man's backup
petunia:~/scripts# cat psql.sh
#!/bin/bash
# Location of the backup logfile.
timeslot=`date +%d-%m-%Y`
# Location to backups.
backup_dir="/backups/"
mkdir -p $backup_dir/$timeslot/psql
backup_dst=$backup_dir/$timeslot/psql
logfile="$backup_dst/logfile.log"
md5file="$backup_dst/md5sum.txt"
@luisuribe
luisuribe / xdebug.ini
Created October 27, 2011 15:24
xdebug.ini
root@volatile:~# cat /etc/php5/conf.d/xdebug.ini
xdebug.var_display_max_data = 10240
xdebug.var_display_max_depth = 4
xdebug.max_nesting_level = 100
xdebug.var_display_max_children = 128
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
-- Remove '-', ':' and the space from a string
preg_replace( '[-|:|\ ]' , '', $header['date'] );
@luisuribe
luisuribe / wiithon + debian lenny
Created April 9, 2011 16:37
Install wiithon in Debian Lenny
# apt-get install bzr intltool imagemagick rar menu python-sexy python-sqlalchemy python-gtk2 python-glade2 gnome-icon-theme
# apt-get -t lenny-backports install libgtk2.0-0
# bzr branch http://bazaar.launchpad.net/~wii.sceners.linux/wiithon/1.0 wiithon
Modificar en el archivo gui.py - linea 80
self.uimgr.insert_action_group(actiongroup)
por
self.uimgr.insert_action_group(actiongroup, -1)
# make install_auto_and_fix
@luisuribe
luisuribe / facebook hacks
Created March 22, 2011 03:36
Facebook hacks
http://www.letsgeek.com/code/find-facebook-profile-from-photo/
Put this into the address bar: javascript:(function(){var sp = location.href.split('/'); var f = sp[sp.length-1].split('_'); window.open("http://www.facebook.com/profile.php?id="+f[2],Math.random()); })();
@luisuribe
luisuribe / gist:834000
Created February 18, 2011 17:05
Encrypt home partition
apt-get install cryptsetup
cryptsetup luksFormat /dev/sda5
cryptsetup luksOpen /dev/sda5 home
mkfs.ext3 /dev/mapper/home
echo "home /dev/sda5 none luks" >> /etc/crypttab
echo "/dev/mapper/home /home ext3 defaults 0 2" >> /etc/fstab
update-initramfs -u -k all
reboot
@luisuribe
luisuribe / gist:826504
Created February 14, 2011 20:41
git gist
// Clone just one branch
mkdir $BRANCH
cd $BRANCH
git init
git remote add -t $BRANCH -f origin $REMOTE_REPO
git checkout $BRANCH
// Aliases and stuff
git config --global user.name "Luis Uribe"
@luisuribe
luisuribe / grab webcam
Created January 10, 2011 00:23
How to record from webcam using command line
$ gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=osug-1.og
Thanks to http://noraisin.net/~jan/diary/?p=40
@luisuribe
luisuribe / delete_spaces.sh
Created September 20, 2010 17:07
replace spaces, lower chars and remove special chars from file name
#!/bin/sh
find . -name '*' | sort | while read i
do
NEWFILE=`echo $i | tr '[A-Z]' '[a-z]' | tr ' ' '_' | tr '(' '[' | tr ')' ']' | tr '&' 'N'` ;
if [ "${i}" != "${NEWFILE}" ]; then
mv "${i}" "${NEWFILE}"
fi
done
@luisuribe
luisuribe / mp3 tagger
Created June 28, 2010 13:55
Change id3v2 tags
#!/bin/dash
#
# TODO
# - Fix code
# - Port to phyton
# Usage: ./script.sh -n
# Variables
####################################################################
encoder=/usr/bin/id3v2