Skip to content

Instantly share code, notes, and snippets.

View shobhit's full-sized avatar

Shobhit shobhit

View GitHub Profile
@shobhit
shobhit / nwxpython.py
Created August 2, 2012 11:21
Put Images as Nodes using Networkx and Python
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img=mpimg.imread('/home/shobhit/Desktop/shobhit.jpg')
# draw graph without images
G =nx.Graph()
G.add_edge(0,1,image=img,size=0.1)
G.add_edge(1,2,image=img,size=0.05)
G.add_edge(2,3,image=img,size=0.02)
G.add_edge(3,4,image=img,size=0.075)
@shobhit
shobhit / send_pdf_with_boto_ses.py
Created August 24, 2012 21:06 — forked from yosemitebandit/send_pdf_with_boto_ses.py
send PDF attachment with boto and SES
''' quick example showing how to attach a pdf to multipart messages
and then send them from SES via boto
'''
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import boto
@shobhit
shobhit / k-means.py
Created October 25, 2012 07:12
Using python and k-means to find the dominant colors in images
from collections import namedtuple
from math import sqrt
import random
try:
import Image
except ImportError:
from PIL import Image
Point = namedtuple('Point', ('coords', 'n', 'ct'))
Cluster = namedtuple('Cluster', ('points', 'center', 'n'))
@shobhit
shobhit / jsonPy
Created December 2, 2012 06:07
Read JSON from HTTP Json URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
@shobhit
shobhit / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shobhit
shobhit / Anim leave right
Last active August 29, 2015 14:22
Android anim leave right
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:duration="350"/>
</set>
@shobhit
shobhit / keybase.md
Last active September 1, 2016 04:26
keybase.md

Keybase proof

I hereby claim:

  • I am shobhit on github.
  • I am shobhit (https://keybase.io/shobhit) on keybase.
  • I have a public key ASCKYhA9dZyuhgAfNe63VAjf3JTiYsJ3CIC69soXskP3Jgo

To claim this, I am signing this object:

@shobhit
shobhit / dijkstra.py
Created February 24, 2017 17:22 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
{
"basics": {
"name": "Shobhit Jain",
"label": "Full Stack Developer",
"email": "shobhitjain26@gmail.com",
"phone": "+91-8880145930",
"summary": "Started career from a small startup called mygola.com which got acquired by makemytrip.com. From chrome-extension to large scale apps i have worked on lots of technologies and interesting projects. I love to get challenged by difficult problems and try to get innovative solutions",
"location": {
"address": "B508, Manar Elegance",
"postalCode": "560102",
@shobhit
shobhit / ChangeMacAddress.sh
Last active February 8, 2021 04:31
Change Mac Address Script
#!/bin/bash
echo "Hi! lets change our mac address."
echo "Step 1: hold down option key, click wifi logo. Note the mac address"
echo "Step 2: click 'disconnect from network' "
echo "Step 3: note which ethernet adapter lines up with the mac address you just saw"
read -p 'Step 4: Which device lined up would you like to change? (hit return for en0) ' ether_adapter
if [ -z $ether_adapter ]
then