Skip to content

Instantly share code, notes, and snippets.

View ishahid's full-sized avatar

Imran Shahid ishahid

View GitHub Profile
@ishahid
ishahid / viscosity-to-ovpn.py
Last active June 15, 2024 18:45
Convert all of your Viscosity connections into OVPN configuration files for OpenVPN
#!/usr/bin/python
"""Convert all of your Viscosity connections into OVPN configuration files for OpenVPN
https://gist.github.com/ishahid/693c2c97b3236a3c2416fc09ab170244
"""
import re
import glob
from os.path import expanduser, dirname
BEGIN MESSAGE.
YuaAvHnRzG4pMlH dhrWYKoH9t4CaVi rQ2SWhIWfRKTwKU A7R0KU5hQBIv6TE
2CbHw9YaVVzGVVP amXtHJ9uhwTTCKq 6Xr2MZHgg72yGkH euFyt4tXabbaAzG
LgE6AwGi2PikFh1 w8haQA8HRxOHPmU S6oqiYfYTaBFTjb vDyySRuCQgFXgO1
hwMMkVtJVrK0CCM 3JNWMFo8ryoEghZ dILic2IP.
END MESSAGE.
@ishahid
ishahid / date_diff.php
Created January 15, 2014 02:16
Find difference between two dates in days. PHP 5.2.x.
<?php
/**
* Find difference between two dates in days. PHP 5.2.x.
*/
$d1 = date('Y-m-d', strtotime('2013-06-13 12:27:43'));
$d2 = date("Y-m-d");
echo diff($d1, $d2);
function diff($date1, $date2) {
@ishahid
ishahid / exif.py
Last active October 22, 2017 11:15
Read EXIF data from an image
#!/usr/local/bin/python
"""Read EXIF data from an image
https://gist.github.com/ishahid/137f8724d8cff2304dffd69f3ade26d7
"""
try:
import os, sys
# import json
from PIL import Image
@ishahid
ishahid / .bash_profile
Last active September 20, 2017 23:54
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configuration and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@ishahid
ishahid / reserved_words.py
Last active February 27, 2017 23:47
Reserved words to exclude when creating usernames (or any other resource).
# A list of possible reserved words
reserved_words = [
# Companies
'amazon', 'apple', 'atlassian', 'canonical', 'facebook', 'github',
'google', 'htc', 'huawei', 'ibm', 'microsoft', 'mozilla', 'naughtydog',
'nintendo', 'nokia', 'rim', 'samsung', 'sony', 'toshiba', 'twitter',
'ubisoft', 'wikipedia', 'xref', 'yahoo',
# Operating systems
++++++++++ initialize counter (cell #0) to 10
[ use loop to set the next six cells to 70/80/90/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++ add 8 to cell #2
> +++++ ++++ add 9 to cell #3
> +++++ +++++ add 10 to cell #4
> +++ add 3 to cell #5
> + add 1 to cell #6
<<<<<< - decrement counter (cell #0)
]

Keybase proof

I hereby claim:

  • I am ishahid on github.
  • I am ishahid (https://keybase.io/ishahid) on keybase.
  • I have a public key whose fingerprint is DD3B DD86 B1D3 AD6B 2F49 722E 1451 55DE 0BAD E780

To claim this, I am signing this object:

@ishahid
ishahid / quote.py
Last active February 8, 2016 02:32
Get quote from stock market using Google Finance
#!/usr/bin/python
"""Get quote from stock market using Google Finance
https://gist.github.com/ishahid/9f0823c19b6d387529f4
"""
try:
import os, sys
import json
import googlefinance as google
@ishahid
ishahid / api-key.py
Last active January 6, 2016 12:42
Generates a random API key
#!/usr/bin/python
"""Generate a random API key
https://gist.github.com/ishahid/54f0478e480234fa44ec
"""
import base64
import hashlib
import random