Skip to content

Instantly share code, notes, and snippets.

View igauravsehrawat's full-sized avatar
🎯
Focusing

Gaurav igauravsehrawat

🎯
Focusing
View GitHub Profile
@kssreeram
kssreeram / parse.py
Created July 8, 2015 14:08
Writing Parsers
import sys
#
# ParserInput
#
# This class represents the input data and the current
# position in the data.
#
# Brief note about 'max_position':
@ghiden
ghiden / bluebird-csv.js
Created June 15, 2015 09:07
To promisify csv-parse using Bluebird
"use strict";
var fs= require('fs');
var Promise = require('bluebird');
var parse= Promise.promisify(require('csv-parse'));
var file = fs.readFileSync('test.csv', 'utf8');
var headerKeys;
var options ={
trim: true,
# Rename mp3 files to naming convention of no number and no special character and hence making your music library cool again to read
# run this file in using terminal in music directory by command ./Mp3FileNameBeautify.sh
# and you are welcome to contribute, customize or whatever.
# suggestions are welcomed
# by - HARSH BHATIA
for i in *.mp3;
do
src=$i
# remove mp3 from name
tgt=$(echo $i | sed -E 's/(.mp3)//g')
@ericelliott
ericelliott / essential-javascript-links.md
Last active June 14, 2025 18:43
Essential JavaScript Links
@learncodeacademy
learncodeacademy / flightplan-html.md
Last active September 14, 2025 13:45
Deploy HTML site with Flightplan

###Prerequesites

Install flightplan globally

npm install -g flightplan

Install flightplan in your project folder

@philfreo
philfreo / localstorage_safari_private_shim.js
Last active November 20, 2019 22:49
Don't let localStorage/sessionStorage setItem throw errors in Safari Private Browsing Mode
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};
@porterjamesj
porterjamesj / hello_mesos.py
Last active March 6, 2018 20:43
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)
@dpryden
dpryden / ClassLoaderLeakExample.java
Created October 20, 2014 00:01
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@Hanmac
Hanmac / gemtree.rb
Last active August 29, 2015 14:04
GemTree
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'optparse'
require 'ostruct'
# using list from graph gem
COLOR_SCHEME_MAX = {
accent: 8, blues: 9, brbg: 11, bugn: 9,
dark2: 8, gnbu: 9, greens: 9, greys: 9,
@learncodeacademy
learncodeacademy / gist:ebba574fc3f438c851ae
Created July 24, 2014 14:47
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {