Skip to content

Instantly share code, notes, and snippets.

View devraj's full-sized avatar
🚀
Building

Dev Mukherjee devraj

🚀
Building
View GitHub Profile
@devraj
devraj / graph_configuration_v3.swift
Created July 11, 2017 04:44
Swift configuration for Purple Graph using ScrollableGraphView v3
private func paintGraphView() {
let graphView = ScrollableGraphView(frame: CGRect(x: 0, y: 0, width: 375, height: 350))
let purpleColor = UIColor.colorFromHex("#8D2595")
barPlot.set(data: data, withLabels: labels)
barPlot.topMargin = 80
@devraj
devraj / create_stripe_managed_account.py
Last active May 22, 2017 23:58
Create Stripe managed account with a bank account and verification document
#!/usr/bin/python
#: Stripe on OSX might need
#: pip install pyOpenSSL backports.ssl requests
#: Your Stripe secret key
STRIPE_API_KEY = "STRIPE_KEY"
#: JPEG that has evidence for the entity
EVIDENCE_JPEG_PATH = "abn.jpg"
@devraj
devraj / Makefile
Created April 17, 2017 03:57
Running a command on set of file patterns in Makefiles using Array like structures
# Must be defined out side a target
CONTAINER_DIR=src
CLEAN_PATTERNS=*.pyo *.egg *.eggs *.egg-info *~ __pycache__
.PHONY: prep-devel-env
prep-devel-env:
$(foreach package, $(PACKAGES),(cd $(CONTAINER_DIR)/$(package); $(PIP) install -e .) &&):
.PHONY: clean
clean:
@devraj
devraj / decorator_experiments.py
Last active March 11, 2017 06:37
Decorator experiments to see what order they get executed in and how we can pass parameters
#!/usr/bin/python
"""
The object here is to demonstrate the following about Python decorators:
- All decorators that execute logic prior to calling the decorated function
executed before the decorators that execute logic after the decorated
function executes
- Order or application of the decorators does not break the point above
@devraj
devraj / mysql_aws_backup.sh
Last active November 1, 2017 03:19
MySQL data dump script for a Python application running on AWS, appends Python app version number and date stamp to filename
#!/bin/bash
# MySQL configuration
# For the script to run headless without entering a password create ~/.my.cnf and
# [mysqldump]
# user=username
# password=password
#
# This makes mysqldump refer to the configuration for the password
#
USERNAME="username"
@devraj
devraj / gist:8234a77469934638dc90
Created July 26, 2015 07:00
Python update all packages
# modified from http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip
sudo pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip install -U
@devraj
devraj / gist:ca0048d136a61bc0de95
Last active August 31, 2018 15:28
Google Maps v3 Custom retina marker from a sprite sheet with 2x and 3x support
var hqLocation = new google.maps.LatLng(-35.107231, 147.369983);
var mapOptions = {
zoom: 17,
minZoom: 17,
maxZoom: 17,
center: hqLocation,
scrollwheel: false,
disableDefaultUI: true,
keyboardShortcuts: false,
@devraj
devraj / Stripe.js
Last active January 6, 2017 01:36
Stripe.js v2 externals file for Google Closure Compiler
/*
* Copyright 2014 Anomaly Software Pty Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software