Skip to content

Instantly share code, notes, and snippets.

View kirang89's full-sized avatar

Kiran Gangadharan kirang89

View GitHub Profile
@kirang89
kirang89 / local_timezone_getter.py
Last active December 1, 2024 23:21
Converting between UTC and local timezone
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from dateutil import tz
from_zone = tz.tzutc()
to_zone = tz.tzlocal()
#Get a naive datetime
@kirang89
kirang89 / color_combos.md
Created September 24, 2013 19:33
Some color combinations that I need to experiment with.
  • E27340 and FFE7B1
  • E68D68 and FFEAB7
  • D3D1D0, A8371B and 1D191A
  • F3EDDE and 373632
  • 414142 and EEEEEF
  • D5ECF2 and 020202
  • 81A8C5 and 1F3A53
  • 976597 and FBFBFB
  • EBF1E6 and 536473
  • 82D3D0 and FCFCFC

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@kirang89
kirang89 / salting_password.py
Created September 18, 2013 05:15
Simple salting of a password using CSPRNG(Cryptographically Secure Pseudo-Random Number Generator)
import os
import hashlib
def secure_password(password):
#This ensures that no two passwords have the same hash
salt = os.urandom(10)
return hashlib.sha256(salt + password).hexdigest()
@kirang89
kirang89 / findtextindir.sh
Created September 13, 2013 21:40
Find all files in a directory that contain the given text
find /your/directory -type f -exec grep -H 'text-to-find-here' {} \;
@kirang89
kirang89 / aws_refer.sh
Created September 13, 2013 20:07
Referring to the same AWS environment from another computer
cd your/Django/project/directory
~/path/to/AWS-ElasticBeanstalk-CLI-2.5.0/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh
git aws.config
@kirang89
kirang89 / jsminifier.py
Created September 13, 2013 14:41
Simple javascript minifier using closure compiler
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from requests.exceptions import ConnectionError, HTTPError, Timeout
import sys
def minifyjs(content, target):
URL = 'http://closure-compiler.appspot.com/compile'
@kirang89
kirang89 / sqlitedump.sh
Created September 12, 2013 18:08
Getting schema and dump of an sqlite3 database
sqlite3 some.db .sch > schema.sql
sqlite3 some.db .dump > dump.sql
grep -v -f schema dump > data.sql