This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This prevents capistrano from hanging when executing long tasks | |
# /etc/ssh/sshd_config | |
TCPKeepAlive yes | |
ClientAliveInterval 15 | |
ClientAliveCountMax 5 | |
# Restart sshd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users | |
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'Game of life w/o primitives and one dot per line' do | |
let(:live_cell) { LiveCell.new } | |
let(:dead_cell) { DeadCell.new } | |
context 'live cell' do | |
it 'dies with less than 2 neighbours' do | |
alive_cells = Neighbours.new(LiveCell.new) | |
expect(live_cell.next(alive_cells)).to be_a_kind_of DeadCell | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Replace "url('../images/*.*)" by "url(<%= asset_path '*.* %>)" | |
" | |
" Useful when you need to change a css file to be converted in a css.erb file | |
" | |
%s/url(\(\.\.\/images\/\)\(.\+\))/url\(<%= asset_path '\2' %>\)/gc | |
%s/url('\(\.\.\/images\/\)\(.\+\)')/url\(<%= asset_path '\2' %>\)/gc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From http://johannes.jarolim.com/blog/2011/11/21/extreme-slow-imagemagick-on-vps-with-ubuntu/ | |
# | |
# Execute as root | |
apt-get update | |
apt-get install build-essential | |
apt-get build-dep imagemagick | |
cd /usr/local/src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm using --create-options to get all the info about table creation (i.e. engine=InnoDB) | |
$ mysqldump -u foobar -p --single-transaction --create-options <database> > file.sql | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Copied from: http://technotes.twosmallcoins.com/?p=356 | |
# Get table listing and generate ALTER sql file | |
$ mysql -u foobar -p -e "show tables in <database> ;" | tail --lines=+2 | xargs -i echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql | |
# Execute ALTER sql queries generated to convert from MyISAM to InnoDB: | |
$ mysql -u foobar -p <database> < alter_table.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# COPIED FROM http://www.1stbyte.com/2011/06/28/unixodbc-example-setup-on-ubuntu-lucid-with-mysql-and-postgresql/ | |
# | |
# Do the obvious, install mysql an postgresql first. :) | |
# install unixodbc | |
apt-get install unixodbc unixodbc-dev libmyodbc odbc-postgresql | |
cd to /etc/ODBCDataSources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
## Calomel.org calomel_interface_stats.sh | |
# | |
IF=eth0 | |
SECS=`uptime | awk '{ if ($3 ~ /:/) { split($3,a,":"); print (a[1]*60+a[2])*60} else { split($3,b,":"); split($5,a,":"); print b[1]*86400+(a[1]*60+a[2])*60} }'` | |
EXT_IN=`netstat -n -i $IF | grep $IF | tail -1 | awk '{print $4}'` | |
EXT_OUT=`netstat -n -i $IF | grep $IF | tail -1 | awk '{print $8}'` | |
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate timelapse video from jpg images | |
mencoder -ovc copy -mf w=320:h=240:fps=6:type=jpg 'mf://*.jpg' -o time_lapse-test.avi |