Skip to content

Instantly share code, notes, and snippets.

View ravikiranj's full-sized avatar

Ravikiran Janardhana ravikiranj

View GitHub Profile
@ravikiranj
ravikiranj / amazon-search.js
Last active September 28, 2019 22:52
amazon-search.js
// ==UserScript==
// @name Amazon Search
// @namespace https://www.amazon.com/
// @version 1.3
// @description Provides Amazon Search UI on product pages
// @author Ravikiran Janardhana
// @match https://www.amazon.com/*/dp/*
// @updateURL https://gist.github.com/ravikiranj/2d9cc6cf3d4052ae4043fa2c1eb06a62/raw/amazon-search.js
// @downloadURL https://gist.github.com/ravikiranj/2d9cc6cf3d4052ae4043fa2c1eb06a62/raw/amazon-search.js
// @grant none
@ravikiranj
ravikiranj / flask-uwsgi-nginx-primer.md
Created May 18, 2017 18:19 — forked from mplewis/flask-uwsgi-nginx-primer.md
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@ravikiranj
ravikiranj / postman-hmac-sha512-preq-request.js
Created April 27, 2017 18:05
HMAC SHA512 Authentication Pre-request script for Postman
/* Pre-requisite
==================
1) Create an Environment (if you don't already have on) and enable it for your request
2) Add a new Header with key as "Authorization" and value as "{{hmacAuthHeader}}"
3) Add the following Pre-request Script that computes the hmacAuthHeader variable and adds it to the environment
4) Fill your CLIENT_KEY and SECRET_KEY with valid values
*/
function getPath(url) {
var pathRegex = /.+?\:\/\/.+?(\/.+?)(?:#|\?|$)/;
@ravikiranj
ravikiranj / mercurial_prompt.sh
Last active December 6, 2016 22:36
mercurial bash prompt
# Mercurial
__hg_ps1 () {
local HG_PROMPT=$(hg prompt "{branch}:{status}:{update}:{count}:{node|short}" 2>/dev/null)
local HG_ARRAY=()
local PRINTF_FORMAT="$1"
if [ ! -z "$HG_PROMPT" ]; then
IFS=':' read -ra HG_OPTIONS <<< "$HG_PROMPT"
for HG_OPTION in "${HG_OPTIONS[@]}"; do
if [[ "$HG_OPTION" != "" ]]; then
@ravikiranj
ravikiranj / checkout_github_repos.py
Created December 11, 2015 01:04
Checkout all github repositories of a user
#!/usr/bin/env python
"""
Usage: ./checkout_github_repos.py -u <github_user> -o <output_dir>
Example: ./checkout_github_repos.py -u ravikiranj -o .
"""
import argparse
import os
import sys
import traceback
@ravikiranj
ravikiranj / permalinks.diff
Created September 21, 2015 16:43
RAML with Permalinks
@ravikiranj
ravikiranj / affirmation
Created September 17, 2015 16:25
MuleSoft Contributor Agreement Acceptance by Ravikiran Janardhana
I, Ravikiran Janardhana, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Thu Sep 17 2015 09:25:46 GMT-0700 (PDT)
@ravikiranj
ravikiranj / morgan_hill_elevation.py
Created July 12, 2015 02:39
Morgan Hill Elevation Calculator
#!/usr/bin/env python
import simplejson
import logging
import math
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(name=__name__)
fname = "runkeeper.com-1436665918102.json"
@ravikiranj
ravikiranj / morgan_hill_elevation.json
Created July 12, 2015 02:38
Morgan Hill Marathon Data
{
"data": [
[
0,
321.5223102
],
[
0.0005886649578697319,
321.5223102
],
@ravikiranj
ravikiranj / drawLines.py
Last active August 29, 2015 14:09
Draw Lines on top of an image
#!/usr/bin/env python
# sudo apt-get install python-pygame
import pygame
from os.path import basename
def drawCoordinates(filepath, coordinates):
# Load image
surface = pygame.image.load(filepath)
# Convert and preserve alpha values so that colors make sense