Skip to content

Instantly share code, notes, and snippets.

View msjaiswal's full-sized avatar

Mayank Jaiswal msjaiswal

View GitHub Profile
""" Here is a simple context manager for managing your locks using Redlock library."""
import datetime
import random
import sys
import time
from contextlib import contextmanager
from redlock import RedLock
import argparse
parser = argparse.ArgumentParser(description='')
parser.add_argument('--start', '-s', help="")
argv = vars(parser.parse_args())
# Some Examples
parser.add_argument('--kill', '-k', action='store_true', help="Kill running page downloaders")
parser.add_argument('--store', default='all')
parser.add_argument("--store", required=True)
parser.add_argument('--count', '-c', type=int )
@msjaiswal
msjaiswal / Solr init.d script
Last active January 14, 2016 13:55
init.d script for solr. Tested on Centos 6. It wraps the solr's CLI to manage solr processes.
#!/bin/bash
# description: Starts and stops Solr production
PIDFILE=/var/run/solr.pid
SOLR_HOME=/usr/share/solr
START_COMMAND="$SOLR_HOME/bin/solr start -p 8984 -noprompt -m 1g"
NAME="Solr"
# Do not list .pyc files
alias ls='ls --color=auto --hide=*.pyc'
# Because vim is colorful
alias vi='vim'
# Command Prompt
PS1='[\[\e]0;\w\a\]\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]]$ '
# All the user executables can be symlinked to this directory
@msjaiswal
msjaiswal / .vimrc
Last active March 30, 2016 08:22
A .vimrc file to get you going
syntax on
set clipboard=unnamed
set autoindent
set ft=crontab
filetype on
set ruler
set hlsearch
@msjaiswal
msjaiswal / my_first_gist.py
Last active December 14, 2015 15:09
Got the gist of it ?
print("Hello to the world of Gists!")
print("This line is added from terminal after cloning the gist.")