Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
2B || !2B

Amitkumar Karnik karnikamit

:shipit:
2B || !2B
View GitHub Profile
@karnikamit
karnikamit / quickpick
Created Jul 15, 2018 — forked from Dyrcona/quickpick
A bash script to batch git cherry-pick of many commits from a single source branch. It can become a new git command if you save it in your path with a name like git-quickpick. Then, you can run it like so `git quickpick foo/bar'. Very handy, that.
View quickpick
#!/bin/bash
# Author: Thomas Berezansky <tsbere@mvlc.org>
# Author: Jason Stephenson <jason@sigio.com>
#
# Feel free to use and to share this script in anyway you like.
# This script is intended as a shortcut for the git cherry-pick
# command when you have several commits that you want to cherry-pick
# into your local branch from another branch. It often results in a
@karnikamit
karnikamit / cdp.py
Created Mar 28, 2018 — forked from trhura/cdp.py
A small python script for cdp device discovery
View cdp.py
#! /usr/bin/env python
# A small script for cdp devices discovery
import sys
import pcapy
import socket
from dpkt import ethernet
from dpkt import cdp
from docopt import docopt
@karnikamit
karnikamit / git-cheat-sheet.md
Last active Sep 18, 2017 — forked from iansheridan/git-cheat-sheet.md
A cheat sheet for GIT
View git-cheat-sheet.md

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

View get_attributes.py
"""
Get both a and b attributes, here 0 is a valid value.
Don't use comparison==0
What if c = '', its invalid!
"""
class A(object):
a = 1
View client.py
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text