Skip to content

Instantly share code, notes, and snippets.

View vijaysharmay's full-sized avatar
💭
I may be slow to respond.

Vijay Yellepeddi vijaysharmay

💭
I may be slow to respond.
View GitHub Profile
@vijaysharmay
vijaysharmay / tmux-cheatsheet.markdown
Created March 30, 2018 10:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vijaysharmay
vijaysharmay / README.md
Created March 20, 2018 08:03 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@vijaysharmay
vijaysharmay / celery.sh
Created February 28, 2018 13:23 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@vijaysharmay
vijaysharmay / alphabeta.py
Created November 30, 2015 07:20
Alpha Beta pruning on a Minimax tree in Python
#!/usr/bin/python3
# This can either be run from a command line with python3 alphabeta.py or imported with
# from alphabeta import alphabeta
# USAGE:
# alphabeta(input, start, lower, upper)
#
# Where:
# input is a list form input tree. See example in this file.
@vijaysharmay
vijaysharmay / Weighted-majority-experiment.readme
Created November 28, 2015 05:01 — forked from xiaohan2012/Weighted-majority-experiment.readme
Weighted Majority algorithm used in online learning
Three files are included:
1. `weighted_majority.py`: the weighted majority algorithm
2. `main.py`: the main program which takes a specific beta value and make a list of plots
3. `experiment.sh`: bash script that experiments on a list of beta values. This is a good entry of this gist.
@vijaysharmay
vijaysharmay / bobp-python.md
Created November 9, 2015 09:17 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@vijaysharmay
vijaysharmay / rateLimitDecorator.py
Created September 25, 2015 07:16 — forked from gregburek/rateLimitDecorator.py
Rate limiting function calls with Python Decorators
import time
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args,**kargs):
elapsed = time.clock() - lastTimeCalled[0]
leftToWait = minInterval - elapsed
if leftToWait>0:
"""Splay tree
Logan Ingalls <log@plutor.org>
Sept 3, 2012
Note that I only implemented insert and find. Delete is trivial,
and isn't the interesting part of splay trees. Some of these
algorithms would be simpler, but I chose to do this without parent
links from the tree nodes.
Example output on my desktop computer:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: