Skip to content

Instantly share code, notes, and snippets.

View Anubhav722's full-sized avatar

Anubhav Singh Anubhav722

  • Twilio
  • Bangalore, India
View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@Anubhav722
Anubhav722 / fncache.py
Created June 28, 2019 14:58 — forked from kwarrick/fncache.py
Redis-backed LRU cache decorator in Python.
#!/usr/bin/env python
__author__ = 'Kevin Warrick'
__email__ = '[email protected]'
import cPickle
from functools import wraps
def redis_lru(capacity=5000, slice=slice(None)):
"""
Simple Redis-based LRU cache decorator *.
import time
import Queue
import random
import logging
from threading import Thread, Event
import sys
logging.basicConfig(
level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
@Anubhav722
Anubhav722 / binarySearchTree.py
Created March 7, 2019 19:42 — forked from jakemmarsh/binarySearchTree.py
a simple implementation of a Binary Search Tree in Python
class Node:
def __init__(self, val):
self.val = val
self.leftChild = None
self.rightChild = None
def get(self):
return self.val
def set(self, val):
@Anubhav722
Anubhav722 / gist:5ca91b46dd5baaff0caa66772f1df0b0
Created June 15, 2018 18:05 — forked from mrtns/gist:78d15e3263b2f6a231fe
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@Anubhav722
Anubhav722 / pandas.postgres.py
Created November 7, 2017 08:18 — forked from 00krishna/pandas.postgres.py
Connect from python pandas to a postgresql database and pull data.
import psycopg2 as pg
import pandas.io.sql as psql
# get connected to the database
connection = pg.connect("dbname=mydatabase user=postgres")
dataframe = psql.frame_query("SELECT * FROM <tablename>", connection)
@Anubhav722
Anubhav722 / datasets.md
Created October 27, 2017 06:51 — forked from priyanshujain/datasets.md
open and public datasets

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: