Skip to content

Instantly share code, notes, and snippets.

View Sushant's full-sized avatar

Sushant Bhadkamkar Sushant

View GitHub Profile
@Sushant
Sushant / gist:3174585
Last active December 4, 2022 06:18
Git uncommon but useful commands
# Delete Remote branch:
$ git push origin :newfeature
# Show details of a specific commit:
$ git show 44f1f96e23ecb835e4442bf464861231b2d96d7e
# Merge specific files from another branch:
# You are in the branch you want to merge to
$ git checkout <branch_you_want_to_merge_from> <file_paths...>
@Sushant
Sushant / SushantResume.md
Last active October 7, 2015 16:37
Sushant Bhadkamkar Resume

Sushant Bhadkamkar

[email] (mailto:[email protected])

Work Experience

  • Outright, Inc. Software Developer Intern, Summer 2012 Ruby-on-Rails Git
  • Druva, Inc. (Employee #9) Software Engineer, 2009-2011 Python Javascript Objective-C Mac OSX Linux JSON C svn
  • Hover.in (Employee #3) Developer, 2008-2009 Erlang Javascript HTML
# Show only modified/added/removed files:
$ hg st -m
$ hg st -a
$ hg st -r
@Sushant
Sushant / gist:06b3b9a06c9508c15617
Created November 25, 2014 00:00
Remove all dirs except the 10 most recent ones
for i in `ls -t | awk 'NR>10'`; do if [[ -d $i ]]; then rm -rf $i; fi; done
@Sushant
Sushant / gist:89ce5231602a7d5ebd06
Created November 25, 2014 02:41
Memoizing in Python
from functools import wraps
def memo(func):
cache = {}
@wraps(func)
def wrap(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrap
def union(parent,child):
"""Performs a union by attaching the root node of the smaller set to the
root node of the larger set"""
if parent.set_size < child.set_size:
child, parent = parent, child
parent_head = find(parent)
child_head = find(child)
if parent_head == child_head:
@Sushant
Sushant / docker-commands.md
Last active January 18, 2016 20:08
Docker commands/tricks

Remove all stopped containers

docker rm $(docker ps -aq)

docker inspect <image> docker diff <image> docker history <image>

docker exec -it <container_name>

You should attach to the container using the --sig-proxy=false option like this:

containers:
....
volumeMounts:
- mountPath: /etc/foo/template
name: foo-template-volume
readOnly: true
- mountPath: /etc/foo/config
name: foo-config-volume
volumes:
- name: foo-template-volume
apiVersion: v1
kind: Pod
metadata:
name: aws-cli
labels:
name: aws-cli
annotations:
iam.amazonaws.com/role: arn:aws:iam::1234567890:role/test-role-dynamo-ro
spec:
containers:
@Sushant
Sushant / token_kubeconfig
Created December 1, 2017 21:49
Kubeconfig with token
clusters:
- cluster:
insecure-skip-tls-verify: true
server: http://127.0.0.1:8080
name: k8s-sushant
contexts:
- context:
cluster: k8s-sushant
namespace: kube-system
user: admin