Skip to content

Instantly share code, notes, and snippets.

View bsouthga's full-sized avatar

Ben Southgate bsouthga

View GitHub Profile
@bsouthga
bsouthga / weakmap_redux.md
Last active July 14, 2022 02:54
WeakMap + Redux

Combining Weakmap + Redux for fun and profit.

Scenario

Lets say we have a large Redux State object which looks like this...

interface State {
  stockMarketData: {
 [stockTicker: string]: {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bsouthga
bsouthga / python_setup.md
Last active April 9, 2018 19:17
python project setup for amanda

starting a new python project

Make a new directory

create a folder

md my-new-project
@bsouthga
bsouthga / fix-enron-mysql.sh
Created August 28, 2015 00:50
Shell script to fix enron mysql syntax in enron data dump from http://bailando.sims.berkeley.edu/enron_email.html
#!/usr/bin/env bash
# change encoding for sed
LC_CTYPE=C
LANG=C
# replace mysql syntax for 4 -> 5
cat ./enron.sql \
| sed -e 's/timestamp(14)/timestamp/' \
| sed -e 's/) TYPE=/) ENGINE=/' \
@bsouthga
bsouthga / keybase.md
Created February 11, 2017 23:38
keybase verification

Keybase proof

I hereby claim:

  • I am bsouthga on github.
  • I am bsouthga (https://keybase.io/bsouthga) on keybase.
  • I have a public key whose fingerprint is 258C C10B 116A 32ED 2680 CBA9 1C48 6AEA BF4B 3232

To claim this, I am signing this object:

!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object
@bsouthga
bsouthga / gist:beb6327d3390ac9f1090
Created May 24, 2014 15:57
Example LaTeX Table from Stata
/* Install estimation output package */
ssc install estout
/* Load system data */
sysuse auto, clear
/* Clear any current estimation storage macros */
eststo clear
/* Run regressions and store results */
@bsouthga
bsouthga / statex
Created May 20, 2014 03:30
LaTeX and Stata integration
/* Initialize the TeX master source document */
texdoc init test.tex, replace
/* Begin stream of LaTeX code */
/*tex
\documentclass{article}
\usepackage[top=1in, left=1in]{geometry}
\usepackage{stata, hyperref, fancyhdr}