Skip to content

Instantly share code, notes, and snippets.

View varunpant's full-sized avatar

Varun varunpant

View GitHub Profile
@varunpant
varunpant / lines.py
Created February 25, 2024 17:24 — forked from tekknolagi/lines.py
#!/usr/bin/env python
import multiprocessing
import random
import string
import time
def fill_output():
to_fill = num_lines - len(last_output_per_process)
@varunpant
varunpant / API.md
Created July 5, 2018 09:39 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@varunpant
varunpant / Makefile
Last active May 6, 2018 13:58
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
get:
@varunpant
varunpant / Dockerfile-Java9-with-maven3
Last active March 13, 2018 11:14
Docker Image for Oracle Java with maven 3
FROM oraclelinux:7-slim
# Download tar from http://www.oracle.com/technetwork/java/javase/downloads/server-jre9-downloads-3848530.html
#d29b6b3008c814abd8ab5e4bde9278d6ee7699898333992ee8d080612b5197ca serverjre-9.0.4_linux-x64_bin.tar.gz
MAINTAINER Varun Pant <varun@varunpant.com>
ENV JAVA_PKG=serverjre-9*_linux-x64_bin.tar.gz \
JAVA_HOME=/usr/java/default
ADD $JAVA_PKG /usr/java/
@varunpant
varunpant / main.go
Created January 7, 2018 18:58 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@varunpant
varunpant / autocomplete-redis-python.py
Created May 6, 2012 21:30
Redis autocomplete example in python (Port of Antirez)
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
# Create the completion sorted set
if r.exists('compl') == False:
print "Loading entries in the Redis DB\n"
f = open('female-names.txt',"r")
for line in f:
n = line.strip()
@varunpant
varunpant / meta-tags.md
Created March 5, 2016 09:13 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@varunpant
varunpant / handlers.py
Created October 25, 2015 20:10 — forked from jgeewax/handlers.py
webapp2_extras auth example (copy/paste)
# -*- coding: utf-8 -*-
"""
A real simple app for using webapp2 with auth and session.
It just covers the basics. Creating a user, login, logout and a decorator for protecting certain handlers.
PRE-REQUIREMENTS:
Set at secret_key in webapp2 config:
@varunpant
varunpant / GoogleMapsCustomRasterOverlay
Created September 21, 2015 12:46
Google Maps ,custom raster overlay example with Tilestache
<!DOCTYPE html>
<html>
<head>
<title>Overlay map types</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
@varunpant
varunpant / gist:383beca43c63ef0bf4cb
Created November 5, 2014 23:03
Geocode using google in Google spread sheet
// Global variables
var ss = SpreadsheetApp.getActiveSpreadsheet(),
sheet = ss.getActiveSheet(),
activeRange = ss.getActiveRange(),
settings = {};
var geocoders = {
google: {
query: function(query, key) {
return 'https://maps.googleapis.com/maps/api/geocode/json?address=' + query;//+'&key=' + key