Skip to content

Instantly share code, notes, and snippets.

View bharadwaj-raju's full-sized avatar

Bharadwaj Raju bharadwaj-raju

  • New Delhi, India
View GitHub Profile
@bharadwaj-raju
bharadwaj-raju / gmailChecker.py
Last active April 10, 2017 01:03
Python script/module to check for unread Gmail messages
import imaplib
import re as regex
def getGmailUnread(username, password):
gmail = imaplib.IMAP4_SSL('imap.gmail.com','993')
gmail.login(username,password)
gmail.select()
unreadCount = regex.search("UNSEEN (\d+)", gmail.status("INBOX", "(UNSEEN)")[1][0]).group(1)
@bharadwaj-raju
bharadwaj-raju / DoubleMouse.sh
Created January 30, 2016 14:23
Multi-mouse config for X11
#!/bin/bash
# DoubleMouse.sh - Multi-mouse config + button swap for X
$mousename = $1
if [[ $1 == '--help' || $1 == '' || $1 == '-h' ]]
then
# Show help
# Program to print string n times
# Usage: printLoop.py [string to print] [number of times to print]
import sys
scriptName, string, count = sys.argv
for i in range(0, count):
print string
@bharadwaj-raju
bharadwaj-raju / blankRevealJS.html
Last active March 12, 2016 15:23
A blank template for reveal.js
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title> <!-- Your presentation's title -->
<meta name="description" content=""> <!-- Describe your presentation -->
<meta name="author" content=""> <!-- Your name -->
alignment top_left
# Set to yes/no to enable/diable background forking of conky process
background yes
# Set xy position
gap_x 0
gap_y 0
# Set size
@bharadwaj-raju
bharadwaj-raju / BashOrgQuoteScraper.py
Last active March 21, 2016 11:24
Get quotes from the bash.org QDB
import urllib2
from bs4 import BeautifulSoup
import re
from random import randint
# Get quotes from bash.org
# Constants
TOP_100_URL = 'http://bash.org/?top'
@bharadwaj-raju
bharadwaj-raju / .conkyrc
Last active April 25, 2016 18:03
Idle time countdown in conky
alignment top_left
background no
gap_x 0
gap_y 0
minimum_size 1024 1000
maximum_width 50000
update_interval 2
total_run_times 0
double_buffer yes
class GravityCalculator():
def __init__(self):
print('Do that yourself.')
GravityCalculator()
@bharadwaj-raju
bharadwaj-raju / zsh.zsh
Last active May 1, 2016 14:29
My ultra-custom zshrc
# Path to your oh-my-zsh installation.
export ZSH=/home/bharadwaj/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="bullet-train"
# Uncomment the following line to use case-sensitive completion.
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ] ; then
NAME=${1%.*}
#mkdir $NAME && cd $NAME
case "$1" in
*.tar.bz2) tar xvjf ./"$1" ;;