Skip to content

Instantly share code, notes, and snippets.

View djinn's full-sized avatar

Supreet Sethi djinn

View GitHub Profile
@djinn
djinn / backlink.py
Created January 2, 2014 19:24
This gist is created in response to a request for debugging backlink on a mailing list
@djinn
djinn / syllable.go
Created May 29, 2014 10:00
Syllable calculation done in golang
package main
import (
"log"
"strings"
)
func isVowel(chr_ rune) bool {
chr := string(chr_)
if (strings.EqualFold(chr, "a") || strings.EqualFold(chr, "e") ||
@djinn
djinn / abstract_parse.go
Created June 2, 2014 12:56
XML parsing in golang
package main
import (
"os"
"encoding/xml"
"strings"
"log"
"runtime/debug"
)
@djinn
djinn / reward.py
Created August 27, 2014 05:56
Sample code of reward process written in Python
rom collections import namedtuple
product = namedtuple("Product", [
'catalog_id',
'price',
'basic_discount',
'user_specific_discount',
'category'])
@djinn
djinn / Shopify.Oauth.ex
Last active January 21, 2017 21:00
Shopify Oauth strategy for Elixir
defmodule Shopify.Oauth do
@moduledoc """
An OAuth2 strategy for Shopify.
Based on the OAuth2 strategy for GitHub by Sonny Scroggin
in https://github.com/scrogson/oauth2_example
"""
use OAuth2.Strategy
alias OAuth2.Strategy.AuthCode
alias OAuth2.Request
@djinn
djinn / ifsc.py
Created July 15, 2016 07:12
Download entire Indian Banks IFSC code database as xls files
#!/usr/bin/env python
#pip install requests
#pip install bs4
#Author: Supreet Sethi <supreet.sethi@gmail.com>
#Date: Fri Jul 15 14:11:38 WIB 2016
#License: MIT
from requests import get
import cookielib
from bs4 import BeautifulSoup
@djinn
djinn / flatten.py
Created July 25, 2016 17:01
Flatten list without using stdlib function
import unittest
def flatten(l):
collect = []
# make user l is iterable of some sort and not a dictionary
if hasattr(l, '__iter__') and not isinstance(l, dict):
for e in l:
print e
print flatten(e)
collect += flatten(e)
@djinn
djinn / smartkarma_rss_feed.txt
Created February 9, 2019 17:51
List of RSS feeds from Smartkarma
https://www.smartkarma.com/segment/feeds/issfocus.rss
https://www.smartkarma.com/segment/feeds/reports.rss
https://www.smartkarma.com/segment/feeds/cons.rss
https://www.smartkarma.com/segment/feeds/growth.rss
https://www.smartkarma.com/segment/feeds/multi_strategy.rss
https://www.smartkarma.com/segment/feeds/035720@ks.rss
https://www.smartkarma.com/segment/feeds/china.rss
https://www.smartkarma.com/segment/feeds/equity_bottom_up.rss
https://www.smartkarma.com/segment/feeds/thematic_&_strategy.rss
https://www.smartkarma.com/segment/feeds/tmt.rss
@djinn
djinn / anagram_prime.py
Created May 2, 2019 04:06
Fast algorithm to find anagram of a word using preindex of words
#!/usr/bin/env python3
# Author: Supreet Sethi <supreet.sethi@gmail.com>
# License: Creative Commons BY-SA 2.0
from string import ascii_lowercase
WORDSFILE = '/usr/share/dict/words' # this is specific to mac os
def alphabet_prime_data():
@djinn
djinn / django_deploy.md
Last active May 2, 2019 13:39 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.