Skip to content

Instantly share code, notes, and snippets.


GP paambaati

View GitHub Profile
paambaati / myproject.conf
Created Feb 20, 2015
Sample nginx config with redirection issue
View myproject.conf
upstream myproject_upstream {
server {
listen 80;
root /Users/myusername/Projects/myproject/static;
paambaati / tasker_airtel.xml
Created Jun 15, 2015
Tasker task to get a notification of your Airtel broadband usage
View tasker_airtel.xml
<TaskerData sr="" dvi="1" tv="4.7u1m">
<Task sr="task5">
<nme>Check Airtel Broadband Usage</nme>
<Action sr="act0" ve="7">
<Str sr="arg0" ve="3"></Str>
paambaati / getNearest.js
Created Oct 22, 2015
Applying a filter on .getNearest() using RethinkDB and Thinky
View getNearest.js
const userId = '2ff8902e-97f0-431a-a51c-900a57532967';
const location = r.point(-20, 39);
const queryOptions = {index: 'location'};
// Getting nearest list of users, while also excluding `userId`.
UserModel.getNearest(location, queryOptions)
paambaati / mongo_add_admin.js
Created May 17, 2014
Add an administrator account to MongoDB instance
View mongo_add_admin.js
user: "admin_username",
pwd: "admin_password",
role: "userAdminAnyDatabase",
db: "admin"
paambaati / PDFtoHTML.scala
Created Dec 19, 2018
Extracting HTML from PDFs
View PDFtoHTML.scala
package me
import{File, FileInputStream}
import org.apache.pdfbox.pdmodel.PDDocument
object PDFtoHTML {
def main(args: Array[String]): Unit = {
val stream = new FileInputStream(new File("/Users/me/Downloads/example.pdf"))
paambaati / got.js
Last active Dec 24, 2018
Got with HTTP2 support (ALPN negotiation) + Connect settings overrides
View got.js
const {extend: gotExtend} = require('got');
const http2 = require('http2-wrapper');
const resolveALPN = require('resolve-alpn');
// Taken from
// throws
// tls.connect({host: '', port: 443});
// doesn't throw
paambaati / index.d.ts
Created Jan 7, 2019
Type definitions for chrome-remote-interface
View index.d.ts
// Type definitions for chrome-remote-interface 0.26.1
// Project:
// Definitions by: GP <>
// Definitions:
export = CDP;
declare function CDP(options?: CDP.ChromeRemoteInterfaceOptions): CDP.CDP;
declare namespace CDP {
paambaati / map2json.js
Last active Jan 16, 2019
JSON stringifier that handles ES6 Maps
View map2json.js
// Optional: If any dependency is overriding Map's toJSON function,
// you might want to reset it.
// Why? See
delete Map.prototype.toJSON;
function customStringifier(key, value) {
if (value instanceof Map) {
// Convert Maps to JSON objects.
let obj = Object.create(null);
for (let [k, v] of value) {
paambaati /
Last active Feb 20, 2019
Handy script to help migrate all Mesos Marathon apps from 1 cluster to another. Can use either a Marathon URI or a local file location for both source & destination sinks. Works on both Python2 & Python3.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from os import environ
from json import load, loads, dumps
from urlparse import urlparse
from urllib.request import urlopen, Request
from urllib.error import HTTPError
View usa.geo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.