Skip to content

Instantly share code, notes, and snippets.

View akashgangil's full-sized avatar

Akash Gangil akashgangil

View GitHub Profile
@akashgangil
akashgangil / bootstrap dev
Created July 25, 2017 21:00
installs bazel and go
#!/bin/bash
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install bazel
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
sudo tar -xvf go1.8.3.linux-amd64.tar.gz
sudo mv go /usr/local
echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> ~/.bashrc
@akashgangil
akashgangil / priority.diff
Last active March 12, 2017 04:14
hello world kube scheduler priority function
diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh
index b3c0c57..9ca5d7c 100755
--- a/hack/local-up-cluster.sh
+++ b/hack/local-up-cluster.sh
@@ -183,7 +183,7 @@ KUBELET_HOST=${KUBELET_HOST:-"127.0.0.1"}
# By default only allow CORS for requests on localhost
API_CORS_ALLOWED_ORIGINS=${API_CORS_ALLOWED_ORIGINS:-/127.0.0.1(:[0-9]+)?$,/localhost(:[0-9]+)?$}
KUBELET_PORT=${KUBELET_PORT:-10250}
-LOG_LEVEL=${LOG_LEVEL:-3}
+LOG_LEVEL=${LOG_LEVEL:-10}
#!/bin/bash
$USER=$1
$MASTER=$2
$MINION1=$3
$MINION2=$4
alias sshmaster="sshpass -p nicira ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $USER@$MASTER"
alias sshmin1="sshpass -p nicira ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $USER@$MINION1"
alias sshmin2="sshpass -p nicira ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $USER@$MINION2"
#!/bin/bash
SESSION=$USER_$RANDOM
NODES="alias_nsxv.sh"
MASTER=$1
MINION1=$2
MINION2=$3
USER=$4
@akashgangil
akashgangil / install.sh
Created December 17, 2015 23:10
kube node prep
# Clone k8s
git clone https://github.com/kubernetes/kubernetes
# Setup etcd
curl -L https://github.com/coreos/etcd/releases/download/v2.2.2/etcd-v2.2.2-linux-amd64.tar.gz -o etcd-v2.2.2-linux-amd64.tar.gz
tar xzvf etcd-v2.2.2-linux-amd64.tar.gz
curl -sSL https://get.docker.com | sh
# Install go
sudo rm -rf /usr/local/go
@akashgangil
akashgangil / tree.py
Last active August 29, 2015 14:09
Decision Tree
# CSE6242/CX4242 Homework 4 Decision Tree
import csv
import math
from collections import defaultdict
import numpy as np
from collections import Counter
import time
# Global Variables
@akashgangil
akashgangil / unixTimeToDate
Created November 10, 2014 06:19
Unix Time to Date
// create a new javascript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds
var date = new Date(unix_timestamp*1000);
// hours part from the timestamp
var hours = date.getHours();
// minutes part from the timestamp
var minutes = "0" + date.getMinutes();
// seconds part from the timestamp
var seconds = "0" + date.getSeconds();
--Playign with the API in Chrome. Save the script in your home folder
Go to file:// in your browser
s = document.createElement('script');
s.src = 'file:///home/gangil/firebase.js';
document.body.appendChild(s)
--Function to get all details about a post with the given id
function show(snap){ console.log(snap.val());}
function getPost(id){new Firebase("https://hacker-news.firebaseio.com/v0/item/" + id).on('value', show);}
#include<vector>
#define V vector;
typedef V<int> vi;
int main(){
int a[] = {1, 2, 3, 4};
vi b(a, a+4);
for(vi::iterator it = b.begin(); it != b.end(); ++it){
cout << *it;
@akashgangil
akashgangil / itoa.c
Created October 27, 2013 17:34
itoa for any base
char* itoa(int val, int base){
static char buf[32] = {0};
int i = 31;
for(; val && i ; --i, val /= base)
buf[i] = "0123456789abcdef"[val % base];
return &buf[i+1];
}