Skip to content

Instantly share code, notes, and snippets.

View prateek's full-sized avatar

Prateek Rungta prateek

View GitHub Profile
@NoahCardoza
NoahCardoza / getOpenTabs.sh
Last active March 21, 2024 10:16
[OSX] Lists the URLs of all the open tabs in a specified browser.
#!/bin/bash
# args: browser
# example: ./getOpenTabs.sh "Brave Browser"
# credits:
# https://gist.github.com/samyk/65c12468686707b388ec43710430a421
# TODO:
# validate args
# don't open app if not already open
@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active June 21, 2024 21:59
Byte formatting for Google Sheets
@manofearth
manofearth / delete-stale-branches.sh
Last active November 14, 2021 02:34
Delete Stale Branches
#!/usr/bin/env bash
while getopts "d" opt; do
case $opt in
d) dryRunOpt="--dry-run";;
esac
done
# prune local "cache" of remote branches first:
git fetch --prune origin
# delete merged to master branches:
@justinjc
justinjc / monorepo-merge.sh
Last active September 9, 2022 21:27
Merging m3db/* repos into m3db/m3
#!/bin/bash
set -euo pipefail
usage() {
echo "usage: $0 <repo> <name>"
echo
echo "<repo>"
echo " The repo link, e.g. https://github.com/m3db/m3coordinator.git"
echo
@prateek
prateek / golang_import_order_cleaner.py
Last active February 28, 2020 20:16
import ordering cleanup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# golang_import_order_cleaner.py: cleans up import orders in golang files per the m3db convention
#
# Warning: This is very much alpha, take a backup of your files (e.g. commit to git) before running this.
#
# example usage:
# (1) Update all *.go files in the local directory (except vendor/), in-place
# $ golang_import_order_cleaner.py -o inplace
@iamralch
iamralch / ssh_client.go
Last active April 16, 2023 03:09
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
package mapreduce
/**
* This is an attempt to find a minimal set of type classes that describe the map-reduce programming model
* (the underlying model of Google map/reduce, Hadoop, Spark and others)
* The idea is to have:
* 1) lawful types that fully constrain correctness
* 2) a minimal set of laws (i.e. we can't remove any laws,
* 3) able to fully express existing map/reduce in terms of these types
*
@ibuenros
ibuenros / SparkUtils.scala
Created June 29, 2014 17:12
Spark productionizing utilities developed by Ooyala, shown in Spark Summit 2014
//==================================================================
// SPARK INSTRUMENTATION
//==================================================================
import com.codahale.metrics.{MetricRegistry, Meter, Gauge}
import org.apache.spark.{SparkEnv, Accumulator}
import org.apache.spark.metrics.source.Source
import org.joda.time.DateTime
import scala.collection.mutable
@laserson
laserson / README.md
Last active July 25, 2016 01:41
Generate FlameGraph for Python code using plop

Create a FlameGraph to visualize where your code is spending its time.

Requires plop and FlameGraph.

@gwenshap
gwenshap / gist:11390102
Created April 29, 2014 03:34
Generate fake apache access logs
#!/usr/bin/python
import time
import datetime
import random
timestr = time.strftime("%Y%m%d-%H%M%S")
f = open('access_log_'+timestr+'.log','w')
ips=["123.221.14.56","16.180.70.237","10.182.189.79","218.193.16.244","198.122.118.164","114.214.178.92","233.192.62.103","244.157.45.12","81.73.150.239","237.43.24.118"]
referers=["-","http://www.casualcyclist.com","http://bestcyclingreviews.com/top_online_shops","http://bleater.com","http://searchengine.com"]