Skip to content

Instantly share code, notes, and snippets.

View sandys's full-sized avatar

Sandeep Srinivasa sandys

View GitHub Profile
@sandys
sandys / gist:5890725
Created June 29, 2013 10:53
Solving double icons problem in Gnome Shell (especially on Ubuntu 12.04)
sudo update-menus --remove
sudo apt-get purge menu menu-xdg
remember to do the first line before the second line. Else you will have to reinstall both the packages again and repeat.
@sandys
sandys / 1.pig
Created June 17, 2013 10:08
PIG script with a jruby udf to read apache log data and load it into HBase.
register ./contrib/piggybank/java/piggybank.jar;
register /home/user/Code/hadoop/hbase-0.94.4/lib/zookeeper-3.4.5.jar
register /home/user/Code/hadoop/hbase-0.94.4/hbase-0.94.4.jar
register /home/user/Code/hadoop/hbase-0.94.4/lib/guava-11.0.2.jar
register /home/user/Code/hadoop/hbase-0.94.4/lib/protobuf-java-2.4.0a.jar
register ./udf.rb using jruby as uuid_udf;
/*
DEFINE A `access_log_link` CACHE('hdfs://localhost:54310/user/user/access_log#access_log_link');
@sandys
sandys / email_attachments_ses_simple.php
Created January 23, 2013 10:33
Script to send email using Amazon SES with attachments in PHP
<?php
require("./amazon-sdk/sdk.class.php");
// on ubuntu - this script can be run using php5-cli and php5-curl
//Provide the Key and Secret keys from amazon here.
$AWS_KEY = "kkk";
$AWS_SECRET_KEY = "kkkk+xKcdkB";
//certificate_authority true means will read CA of amazon sdk and false means will read CA of OS
$CA = true;
@sandys
sandys / disable_alt_tab_grouping_ubuntu.sh
Last active November 2, 2017 18:49
Disable grouping of alt-tab behavior in Ubuntu 12.04 through the commandline. No need for installing and clicking through any tools. This can also be automated for mass deployment
gconftool-2 --set --type list --list-type=string /apps/compiz-1/general/screen0/options/active_plugins '[core,composite,opengl,decor,resize,imgpng,unitymtgrabhandles,snap,compiztoolbox,vpswitch,mousepoll,gnomecompat,place,regex,animation,move,staticswitcher,session,unityshell,workarounds]'
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/prev_all_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/next_all_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/prev_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/next_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_prev --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_forward --type string "Disabled"
@sandys
sandys / amazon_iam_policies_guide.md
Created January 10, 2013 06:43
Amazon IAM policies

create user for a specific S3 bucket

{ "Statement": [ { "Effect": "Allow", "Action": "s3:ListAllMyBuckets", "Resource": "arn:aws:s3:::*" }, {

@sandys
sandys / ses_pure_http_post.rb
Created December 18, 2012 12:55
Sending an email through Amazon SES using pure HTTP POST requests. You could potentially replicate this on curl.
require 'net/http'
require 'uri'
require 'cgi'
require 'time'
require 'base64'
@accesskey = "adfdlkf"
@secretaccesskey = "dfkjldf"
opts = {"Action" => "SendEmail",
@sandys
sandys / debian_6_ramnode.md
Created December 13, 2012 08:22
ruby installation on debian 6 vm

aptitude install autoconf automake bison build-essential curl git-core libapr1 libaprutil1 libc6-dev libltdl-dev libreadline6 libreadline6-dev libsqlite3-0 libsqlite3-dev libssl-dev libtool libxml2-dev libxslt-dev libxslt1-dev libyaml-dev ncurses-dev openssl sqlite3 zlib1g zlib1g-dev

git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv

in .zshenv

export PATH="/usr/local/rbenv/bin:$PATH" eval "$(rbenv init -)"

on cmdline

@sandys
sandys / ssh_agent_ubuntu.md
Created October 30, 2012 11:49
Use ssh-agent and ssh-add on Ubuntu without annoying gnome-keyring

sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-keyring/daemon-components/secrets FALSE
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-keyring/daemon-components/pkcs11 FALSE
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-keyring/daemon-components/ssh FALSE

eval `ssh-agent`

echo $SSH_AUTH_SOCK #copy the path that is displayed as a result

#whenever you want a new shell: SSH_AUTH_SOCK= ssh [email protected]

@sandys
sandys / gist:3974478
Created October 29, 2012 16:07
Debian 6 fresh setup
* aptitude install sudo
* add the following to /etc/apt/sources.list
<pre>
deb http://ftp.br.debian.org/debian squeeze main
deb-src http://ftp.br.debian.org/debian squeeze main
deb http://ftp.br.debian.org/debian squeeze-updates main
deb-src http://ftp.br.debian.org/debian squeeze-updates main
deb http://security.debian.org/ squeeze/updates main
@sandys
sandys / clean_csv.rb
Created October 18, 2012 10:06
Clean a dirty CSV file using ruby
require 'fastercsv'
require 'csv'
require 'net/http'
require 'sanitize'
#CSV_FILE_PATH = File.join(File.dirname(__FILE__), 'c2i.csv')
CSV_FILE_PATH = File.join('/tmp', 'Computers_Accessories_Master.csv')
=begin