Skip to content

Instantly share code, notes, and snippets.

View rahulrajaram's full-sized avatar

rahulrajaram rahulrajaram

View GitHub Profile
@rahulrajaram
rahulrajaram / .py
Last active October 24, 2017 22:10
Python print colored STDOUT
COLOR_MAP = {
'black': '30',
'red': '31',
'green': '32',
'yellow': '33',
'blue': '34',
'magenta': '35',
'cyan': '36',
'white': '37',
}
@rahulrajaram
rahulrajaram / .md
Last active October 23, 2017 02:30
Password generator using Python
import random
import string

# The pool of characters to pick the characters for your password from
password_char_set = string.ascii_letters + string.digits + string.punctuation

def random_character():
    return password_char_set[random.randint(0, len(password_char_set))]
@rahulrajaram
rahulrajaram / .cpp
Last active August 13, 2017 05:53
Tail recursive function to find arithmetic sum in C++/C
/*
TL;DR: Compile the program as follows:
------
g++ add.cpp -O2 && ./a.out
RIGOROUS DISCUSSION:
--------------------
Suppose you want to compute the sum of the series: