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 / looper.py
Created March 16, 2017 05:12
Python program loop
import sys
while True:
# code here
print('Do you want to start the program again? (Y/N)')
response = input('> ').strip().upper()
if response == 'Y':
pass
else:
122.176.173.14
#!/usr/bin/env python3
import sys
import os
def parse_xdg_desktop(desktop_file_or_string):
'''Parse a .desktop file.
Parse an XDG .desktop file or a string with its contents into an easy-to-use dict, with standard values present even if not defined in file.
#!/bin/sh
# Show list of todos before commit
SOURCE_CODE_GLOB='*.py'
find -name $SOURCE_CODE_GLOB -exec grep TODO {} /dev/null \; | sed -e 's/\t//g;s/.py:/.py: \t/g;s/.py:.*#/\t/g'
def get_time_of_day(level=3):
'''
For detail level 2:
06 to 20: day
20 to 06: night
'''
'''
For detail level 3:
#!/usr/bin/env python
import subprocess
apps_to_save = ['Gedit', 'Writer']
battery_limit = 10 # in percent
def get_battery_percentage():
#!/usr/bin/env python
import os
import sys
import subprocess
import collections
import time
import mmap
try:
Compose + <apostrophe> <apostrophe> : "´" acute # ACUTE ACCENT
Compose + <minus> <asciicircum> : "¯" macron # MACRON
Compose + <asciicircum> <minus> : "¯" macron # MACRON
Compose + <underscore> <underscore> : "¯" macron # MACRON
Compose + <underscore> <asciicircum> : "¯" macron # MACRON
Compose + <space> <parenleft> : "˘" breve # BREVE
Compose + <parenleft> <space> : "˘" breve # BREVE
Compose + <quotedbl> <quotedbl> : "¨" diaeresis # DIAERESIS
Compose + <space> <less> : "ˇ" caron # CARON
Compose + <less> <space> : "ˇ" caron # CARON
#!/usr/bin/env python3
# Script to copy n random folders to a location
# Usage: RandomCopier.py [source folder] [destination folder] [number to copy]
import os
import sys
import shutil
import random
@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.