Skip to content

Instantly share code, notes, and snippets.

View gautamk's full-sized avatar

Gautam gautamk

  • Block | Meta | Appdynamics | Cisco | Amazon | University of Washington
  • PST
View GitHub Profile
@gautamk
gautamk / bgchanger.js
Created February 18, 2012 16:17
Tumblr bgchanger
//(function(){
//Refer http://code.google.com/apis/picasaweb/docs/2.0/reference.html
// Album url can be obtained by getting the rss feed of a Public or Limited album
var album_url = "https://picasaweb.google.com/data/feed/base/user/104873802064687726116/albumid/5710488196657525265?"+ // The base url
//Query Parameters
"alt=json"+ // Options are json and rss ,
"&kind=photo"+
"&authkey=Gv1sRgCIC0zJCjrbqplwE"+//Necessary only because the album's visibility is Limited , link only
@gautamk
gautamk / action_specific_css_js_cake.php
Created February 29, 2012 14:25
Auto include Action Specific Css and Javascript CakePHP
<?php
// Add this to any `view` recommended is View/Layouts/default.ctp
/*
WWW_ROOT generally refers to your webroot directory
DS is usually '/'
$this->params['controller'] returns controller name in lowercase
$this->params['action'] returns action name in lowercase
Refer
* http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html
@gautamk
gautamk / gist:2016111
Created March 11, 2012 11:35
Delete local and remote branches
############ GIT ################
# Delete local branch
git branch -D <branch-name>
# Delete remote branch
git push origin :<branch-name>
@gautamk
gautamk / startVM.sh
Created March 17, 2012 12:15
A shell Script to start VirtualBox VMs in Various Modes , Useful when placed in ~/bin
#!/bin/zsh
#
# A shell Script to start VirtualBox VMs in Various Modes
# Useful when placed in ~/bin
#
type=""
case $2 in
[g|G] )
type="gui"
;;
@gautamk
gautamk / wgetAlert.sh
Created March 17, 2012 12:17
Script to display an alert message once downloads complete
#!/bin/bash
#
# Script to display an alert message once downloads complete
# Takes the same parameters as wget
#
wget $@
wait
zenity --info --text="Download Complete"
@gautamk
gautamk / mongo_array_insert.php
Created March 19, 2012 00:49
Script to insert an array into mongodb and retrieve its id
<?php
/**
* This Script inserts a mongo array in the database and
* retrieves its id and displays it
*/
$form=array(
"model"=>"DynamicFormResponse",
"options"=>array(
"type"=>"post",
@gautamk
gautamk / flipkart_banners.html
Created April 13, 2012 10:30
Flipkart Banner Aside designed for Octopress
<!--
Flipkart Banner Aside designed for Octopress
@file source/_include/custom/asides/flipkart_banners.html
@author Gautam
USAGE Scroll down
-->
<section id="flipkart-banner-container">
<h1>Recommendations</h1>
<p>
<style type="text/css">
@gautamk
gautamk / eclipse
Created April 27, 2012 12:08
Various Command and Scripts to remember
#!/bin/bash
/path/to/eclipse &
P=`which eclipse`
disown `pidof ${P}`
@gautamk
gautamk / play-benchmark1
Created May 10, 2012 04:13
Play Framework Benchmarks
$ ab -n 10000 -c 100 "http://localhost:9002/Socket/select?columnFamily=lost"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@gautamk
gautamk / webrick_start.sh
Created July 27, 2012 03:56
Start webrick server to serve files in the local directory
ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"