Skip to content

Instantly share code, notes, and snippets.

View sandys's full-sized avatar

Sandeep Srinivasa sandys

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / damn-fast-ruby-setup.sh
Last active August 15, 2018 12:39
Set up a development environment for ruby in 30 minutes on ubuntu. This will use rbenv to take care of paths and will mimic how you would set up your production environment. A very clean separated setup conducive to integration with Puppet/chef (for installation of ruby versions) and Capistrano (for contained deployment). Allows for per-user own…
#pre-requisites
sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev git libpq-dev libmysqlclient-dev libpq-dev nodejs libcurl4-openssl-dev libffi-dev imagemagick libjpeg-progs pngcrush
############optional
sudo apt-get install sudo vim zsh
######### optional for jruby
sudo apt-get install openjdk-7-jdk
@sandys
sandys / T430S configuration
Last active December 21, 2017 00:25
super lean and fast Ubuntu 12.04 install. It doesnt hang and with firefox open, it consumes 500 mb of RAM ! - Now works with Ubuntu 14.04/Trusty Tahr!
# http://nodebox.metaforix.net/articles/debian-on-lenovo-thinkpad-t420
#create new file /usr/share/X11/xorg.conf.d/99-my.conf
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
@sandys
sandys / threads.scala
Created August 19, 2013 07:10
using Threads and runnables in Scala
package multi
import java.util.concurrent.Callable
object Threads {
def main(args: Array[String]) : Unit = {
implicit def funcToCallable[A](func : () => A): Callable[A] = new Callable[A] { println("creating callable");def call() :A = func() }
implicit def funcToRunnable( func : () => Unit ) = new Runnable(){ println("creating runnable");def run() = func()}
//bad. cannot be tested properly. plus completely screws up the idea of runnable (viz to have the choice of not using threads with minimum code changes)
@sandys
sandys / AziLink.ovpn
Created September 23, 2013 04:42
Azilink with openvpn on ubuntu