Skip to content

Instantly share code, notes, and snippets.

View BenRussert's full-sized avatar

Ben Russert BenRussert

View GitHub Profile
// src/useWasm.js
export const useWasm = (fileName, imports) => {
  const [state, setState] = useState({
    loaded: false,
    instance: null,
    error: null,
  });
  useEffect(() => {
+   const abortController = new AbortController();
const express = require('express');
const request = require('request');
const app = express();
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
next();
});
@rgbkrk
rgbkrk / Cleaning Up Empty Notebooks.ipynb
Created November 16, 2017 18:08
Cleaning Up Empty Notebooks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BenRussert
BenRussert / mlb-on-air-schedule.sh
Created April 22, 2017 15:45
Download an mlb schedule standardized calendar csv file filtered to include only channels you are interested in
#!/usr/bin/env bash
# this will download a csv format calendar file with TV info and
# filter only channels I want. The output can be imported into google calendar etc
# this url is for the cubs, but you could modify url parameters if you want
csvurl="http://mlb.mlb.com/ticketing-client/csv/EventTicketPromotionPrice.tiksrv?team_id=112&display_in=singlegame&ticket_category=Tickets&site_section=Default&sub_category=Default&leave_empty_games=true&event_type=T"
tmpfullfile="tmpfullfile.csv"
outputfile="cubs-onair-schedule.csv"
@dellis23
dellis23 / markov.py
Created August 7, 2013 15:09
A more flexible version of a markov chain implementation found at http://agiliq.com/blog/2009/06/generating-pseudo-random-text-with-markov-chains-u/
import random
class Markov(object):
def __init__(self, open_file, chain_size=3):
self.chain_size = chain_size
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)