Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sriprasanna on github.
  • I am batman (https://keybase.io/batman) on keybase.
  • I have a public key whose fingerprint is CB89 1086 D0BD D5B8 0D19 551F DF4D 28C8 3CFD 49C8

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Trello Test</title>
<style>
li.pass{
color:green;
}
li.fail{
@sriprasanna
sriprasanna / Res.sh
Last active August 29, 2015 14:17 — forked from Garland-g/Res.sh
#!/bin/bash
#Author: Travis Gibson
#This script requires an argument for the resolution width
#Thanks go out to eCharles for a patch in the comments of this link here: http://blog.echarles.net/2013/10/01/Ubuntu-13.04-On-MacbookPro-Retina
if [ -z "$1" ]; then
echo "Usage: Res.sh <resolution_width>";
exit 1;
fi
erg=$( echo "$1")
check=$(xrandr -q | grep DP-2 | cut -d " " -f 4 | cut -d "x" -f 1)
# If the service doesn't run
sudo service docker restart
sudo service rapidftr restart
sudo docker logs -f rapidftr
# More debug steps will go below
@sriprasanna
sriprasanna / rapidftr in rhel
Last active August 29, 2015 14:20
Install RapidFTR in RHEL
Para instalar docker in RHEL7
https://docs.docker.com/installation/rhel/
--------------------------------------------------
sudo su -
service docker start
mkdir -p /data/production
docker pull rapidftr/rapidftr
chcon -Rt svirt_sandbox_file_t /data/production
docker run -d -P -p 80:80 -p 443:443 -p 6984:6984 -p 5984:5984 -v /data/production:/data --name rapidftr rapidftr/rapidftr:release-2.0.0_latest
@sriprasanna
sriprasanna / install_sshuttle_mac
Last active August 29, 2015 14:21
Install sshuttle on mac
#/bin/bash
echo "Installing PyXAPI"
cd /tmp
curl -O http://www.pps.univ-paris-diderot.fr/~ylg/PyXAPI/PyXAPI-0.1.tar.gz
tar -xzvf PyXAPI-0.1.tar.gz
cd PyXAPI-0.1
./configure
make
sudo make install
cd ..
# Reincarnation for classes
class Class
def reincarnate
buried = Object.__send__(:remove_const, self.name)
Object.const_set(self.name, Class.new(buried))
end
end
class Abc
@sriprasanna
sriprasanna / How smart am I?
Created September 15, 2010 15:56
Typewriting Test
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How smart am I?</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Sri Prasanna">
<!-- Date: 2010-02-17 -->
// Simple example to show the power of closure when exploited w.r.t scope
function power_of (power) {
return function (number) {
return Math.pow(number, power);
};
}
var power_of_3 = power_of(3),
power_of_4 = power_of(4);
@sriprasanna
sriprasanna / gist:749181
Created December 20, 2010 23:03
The Race - 232 Euler Project
@game = {}
@p1_success_probability = 1.to_f / 2
@p1_failure_probability = 1 - @p1_success_probability
def game(p1_points_to_win,p2_points_to_win)
return @game[[p1_points_to_win,p2_points_to_win]] if @game[[p1_points_to_win,p2_points_to_win]]
return 1 if p2_points_to_win <= 0
return 0 if p2_points_to_win > 0 and p1_points_to_win <= 0
strategies = [2]
while strategies.last < 2*p2_points_to_win