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
#!/usr/bin/env ruby | |
# quick and dirty. | |
# using http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/ to cluster data points | |
# (prevents slow page loads and timeouts from google) | |
# i could do this file opens nicer. later. | |
File.open('/tmp/maps.json','w') {|f| f.write("var data = {maps:[") } | |
# this too | |
dataset=`mysql -umyuser mydatabase -e 'SELECT CONCAT(CONCAT("{\'id\':",id,","),CONCAT("\'latitude\':",lat,","),CONCAT("\'longitude\':",\`long\`,"}")) FROM mytable where lat is not NULL' |grep -v CONCAT` |
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
$ while read firstcolumn secondcolumn thirdcolumn; do | |
> echo -e "First column is $firstcolumn | |
> Third is $thirdcolumn \n" | |
> done << EOF | |
> i like cats | |
> and pie too | |
> baby baby yeah | |
> EOF | |
First column is i | |
Third is cats |
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
box:~# date | |
Mon May 16 19:14:47 UTC 2011 | |
box:~# cat /proc/sys/xen/independent_wallclock | |
0 | |
box:~# echo 1 > !$ | |
echo 1 > /proc/sys/xen/independent_wallclock | |
box:~# ntpdate -s pool.ntp.org | |
box:~# date | |
Mon May 16 19:19:21 UTC 2011 |
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 is a test gist for gabe |
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
#!/usr/bin/env bash | |
# | |
# because sometimes a server sporadically acts funny and we're all like wtf. | |
# date and -+ separated list of general os, system, and network stuff. | |
echo -e "#!/usr/bin/env bash\n(date; top -n1; ps axfu; iostat; vmstat; df -h; lsof -n -i; netstat -ano; w; echo -e '\n-----------------\n\n') >> /var/log/wtf.log" > /root/wtf.sh | |
chmod +x /root/wtf.sh | |
# put it in the crontab. | |
echo '* * * * * /root/wtf.sh' >> /var/spool/cron/crontabs/root |
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
[root@downoi pacman.d]# pacman -S ruby rubygems | |
warning: provider package was selected (ruby provides rubygems) | |
warning: skipping target: rubygems | |
resolving dependencies... | |
looking for inter-conflicts... | |
Targets (2): libffi-3.0.9-1 ruby-1.9.2_p0-4 | |
Total Download Size: 2.82 MB | |
Total Installed Size: 18.43 MB |
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
backend app1 { | |
.host = "127.0.0.1"; | |
.port = "8000"; | |
} | |
acl purge { | |
"127.0.0.1"; | |
"::1"; | |
} |
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
#!/usr/bin/perl -w | |
use strict; | |
#die "usage: $0 <mysql_server_hostname>" unless (@ARGV > 0); | |
#my $server=@ARGV; | |
#chomp $server; | |
#my @users=`ssh $server "echo \"select user,host from mysql.user;\" | /usr/bin/mysql"`; | |
my @users=`echo "select user,host from mysql.user" | /usr/bin/mysql`; |
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
#!/usr/bin/perl -w | |
######################################### | |
# walks all replicated tables on MySQL | |
# master and slave. Run with no args | |
# to see options. | |
######################################## | |
use strict; |
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
SERVICE=`basename $0` | |
COMMAND=$1 | |
if [ -z "$SERVICE"] || [ -z "$COMMAND"]; then | |
echo "usage: `basename $0` <restart|stop|start|status>" | |
fi | |
echo "/var/lib/gems/1.8/bin/god $COMMAND $SERVICE" |