Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Merberg amerberg

  • helm.ai
  • Massachusetts, USA
View GitHub Profile
View weibull-sum.R
library(matrixStats)
library(ggplot2)
library(animation)
#set seed for replicability
set.seed(1)
#generate 10^3 deviations, 10^6 replicates
w = replicate(10^6, rweibull(10^3, 0.9, 1))
#recall Weibull is subexponential when shape parameter is < 1.
@amerberg
amerberg / bookmarklets.js
Last active Jul 25, 2016
Quora bookmarklets
View bookmarklets.js
/* These are bookmarks for making various tasks on Quora easier.
* Since GitHub Markdown doesn't allow JavaScript links, you'll have to install the complicated way.
* Each of the lines beginning with `javascript:` below is a bookmarklet.
* To install, create a new bookmark in your browser and paste that line as the URL.
* Leave feedback in Gist comments or contact https://www.quora.com/Adam-Merberg
*/
//Get the rank of the answer belonging to the logged-in user (in a JS alert box).
//You will have to scroll down far enough that your answer has loaded before you use it.
//Perhaps a future version will do that automatically.
@amerberg
amerberg / monitor.js
Last active Aug 29, 2015
Monitor Quora questions
View monitor.js
(function(){
//Initialize counts of how many are already monitored,
//how many we're newly monitoring, how many we failed to monitor
var already = 0;
var succeeded = 0;
var failed = 0;
var interrupt = false;
$(document).keyup(function(e){if(e.keyCode==27){interrupt = true;}});
@amerberg
amerberg / strip_comments.py
Last active Jun 6, 2021
A script to remove comments from LaTeX source
View strip_comments.py
import ply.lex, argparse, io
#Usage
# python stripcomments.py input.tex > output.tex
# python stripcomments.py input.tex -e encoding > output.tex
#This utility is released under the WTFPL license: http://www.wtfpl.net/about/
def strip_comments(source):
tokens = (