Skip to content

Instantly share code, notes, and snippets.

View skihero's full-sized avatar

Kish skihero

  • Amazon Mechanical Turk
  • Ooty
View GitHub Profile
@skihero
skihero / mv_with_filename
Created July 2, 2012 19:14
son of a gun
OIFS="$IFS"
IFS=$'\n'
export i=1
for fil in `ls -tr *.flv` ; do mv "${fil}" $i.flv; i=$(($i + 1 )); done
@skihero
skihero / puppet_ruby_client_start.sh
Created June 25, 2012 09:25
Start the puppet and ruby bundle, setting the right paths
#!/bin/bash
PUPPET_RUBY_DIR="/usr/local/puppetandruby"
PUPPET_MSTR_SERVER=" rov-master. .com"
# Let the path find puppet's ruby first
export PATH=${PUPPET_RUBY_DIR}/bin/:$PATH
@skihero
skihero / nginx_stub
Created June 19, 2012 12:13
nginx_status
Nginx must also be configured. Firstly the stub-status module must be
compiled, and secondly it must be configured like this:
server {
listen 127.0.0.1;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
@skihero
skihero / db infos for R input
Created March 22, 2012 11:26
db infos for R input
mysql> SELECT TABLE_SCHEMA,SUM(DATA_LENGTH) SCHEMA_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA!='information_schema' GROUP BY TABLE_SCHEMA ;
+--------------+---------------+
| TABLE_SCHEMA | SCHEMA_LENGTH |
+--------------+---------------+
| mysql | 481714 |
| puppet | 229376 |
+--------------+---------------+
2 rows in set (0.03 sec)
mysql> SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_ROWS,DATA_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA!='information_schema'
@skihero
skihero / svn_sync.sh
Created March 12, 2012 13:43
Keep the local dir in sync with the remote svn source
#!/bin/bash
# This file is managed by puppet
#
# Changes here will be overwritten
# Cron to keep in sync with the svn codebase
#
# Fetches the SVN location specified
# Update the local copy if the dest dir already present
#
# Logs error only
<html>
<head>
<script type="application/javascript">
function draw() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 55, 50);
@skihero
skihero / swap caps lock
Created November 13, 2011 14:02
Swap caps lock
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
@skihero
skihero / mysqldump_sans data
Created November 2, 2011 11:33
dump the schema without the data
mysqldump --no-data --all-databases --verbose > all_schema.sql
sudo tcpdump -ieth0 -lnx -s 1024 dst port 80 -v -X -w /tmp/cap.pcap
@skihero
skihero / gen_thumb.sh
Created September 12, 2011 11:29
generate thumbnails on all files in the directory
for fil in `ls *.jpg` ;
do name=${fil%.*};
convert -thumbnail 200 $fil ${name}_thumb.jpg;
done