Skip to content

Instantly share code, notes, and snippets.

View vireshas's full-sized avatar
:octocat:

Viresh Sanagoudar vireshas

:octocat:
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCf+eR/l9PM67BG/7Ak7HZThO09cGDuBPP/9CSdjmn2HHg5OCTVJ56rWo83Fojy3v/HvksdPzdBJ1hhE0b42FazE4dbN4UoFc3UhcqzvJ/l8IuaQRsexN4ZqNcaUf4p1CNGWMXQfbqHsJkVhnmdW0KMusbV8yfzZSWuJrk4SKGZlxeMGhZBhb4ROV4ZKS/NTmKchrvVdonmb7TrPF8imP9yn3SSPi58ZRsam4icP8BUAFuD5q4DwTVmfs0P2n2Caza6ODb+XSVITzEah8KRlNWW7m9Ni5qG+n00oJqolbtmXX9a9FKu4x9VJ7JgozaYiD4xX4n4nJcKN0IAsPPd94bt asviresh@gmail.com
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
@vireshas
vireshas / expand_urls
Last active December 16, 2015 09:29
expand short urls #Ruby
require "curb"
class ExpandUrl
def self.expand short_url
c = Curl::Easy.new(short_url) {|req| req.follow_location = true}
c.perform
puts c.last_effective_url
end
end
#!/bin/sh
if [ `which perl` = "/usr/bin/perl" ]; then
echo -n -e "\e[1;31mUSING SYSTEM PERL OK? [y/n]\e[m: "
read ANSWER
if [ "$ANSWER" != "y" ]; then
exit 255
fi
PERL_CPANM_OPT="$PERL_CPANM_OPT --sudo"
fi
#!/bin/bash
# Authorize TCP, SSH & ICMP for default Security Group
#ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0
#ec2-authorize default -P tcp -p 22 -s 0.0.0.0/0
# The Static IP Address for this instance:
IP_ADDRESS=$(cat ~/.ec2/ip_address)
# Create new t1.micro instance using ami-cef405a7 (64 bit Ubuntu Server 10.10 Maverick Meerkat)
@vireshas
vireshas / lrange (lua + ruby)
Created July 26, 2013 06:03
lrange using a lua script from a ruby client
lrange = <<lua
local videos_to_fetch = 0
if tonumber(ARGV[1]) > 0 then
videos_to_fetch = ARGV[1] - 1
end
local videos_in_channel = redis.call("lrange", KEYS[1], 0, videos_to_fetch)
return videos_in_channel
lua
# assuming redis-server runs at localhost:6379
@vireshas
vireshas / gist:6411777
Created September 2, 2013 11:14
My public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDab5G+R0kZchKB14H1ZYWWd6cteyA7M28f2RRdXRvoB7cRtiQVJG+fvBULE74f2SIYcjzSYLZD2jy9DCWBQbyPPIn6ZyA+DDaZKxpoKefRYFr6xTXcqwwTi8w8O3o5aGLKNGnowOo2TxUlkqcChTkNDiAVLQBXS8g12KjOeXcBMzZGvMwYDriqPJFCSz2BVZbgo5aouKc6xFBwv5pexsadlw9AaJYlGM7yQ6fwUIIBYSx7Dsxx44zAzUobVsgBpyVYHBySZ2aWIscR8nzDVikM4xA+n6tvJXlpv9bd6MNOQq6VwOxNBmBtdptTtQ6yTYnOoEnucct/qQBoJRROqQ5B asviresh@gmail.com
@vireshas
vireshas / replier.rb
Last active October 27, 2023 15:59
Facebook birthday replier
#!/usr/bin/env ruby
# Usage:
# replier.rb <pass access token here>
# access_token="your access token goes here" replier.rb
#
# If your access_token is expired, you can get a 400 bad request exception. Go get a fresh access_token in that case.
require 'rest-client'
require 'json'
require 'time'
@vireshas
vireshas / redi2casa usage
Last active July 4, 2016 06:09
Using redi2casa gem.
#hincrby & hget
r.hincrby "c", "e", 10
r.hincrby "c", "e", -10
r.hget "c", "e"
r.hget "c", "e", "counters" #counters is the default type
#hset & hget
r.hset "a", "b", "hello_world"
@vireshas
vireshas / Install and configure cassandra 2.0.X
Last active December 28, 2015 07:09
Installing cassandra 2.0.X on Ubuntu12.03 and configuring it for redi2casa
#add these lines to the end of this file: /etc/apt/sources.list
deb http://www.apache.org/dist/cassandra/debian 20x main
deb-src http://www.apache.org/dist/cassandra/debian 20x main
#and then update apt-get and install cassandra
sudo apt-get update
sudo apt-get install cassandra
#start cassandra
sudo cassandra