Skip to content

Instantly share code, notes, and snippets.

View rossgoodwin's full-sized avatar
💭
I may be slow to respond.

Ross Goodwin rossgoodwin

💭
I may be slow to respond.
View GitHub Profile
@rossgoodwin
rossgoodwin / verify.txt
Created July 10, 2022 18:43
Tezos verification
I am attesting that this GitHub handle rossgoodwin is linked to the Tezos account tz2H3d3VxxB24xuHB2GzhDsQNne6yYFidkGS for tzprofiles
sig:spsig1DdNYgbfJBtAAYYjsLBC4Z6sbGy3xJFeQGR9jPVaDCp3xqPUgoR2oBV2UUW38xm6JGmoWGg2KnGUMBJiRFSWuJ6nY7UodX
@rossgoodwin
rossgoodwin / printF.sh
Last active July 2, 2020 23:41
What I believe to be the fastest way to print "F" billions (or trillions, quadrillions, etc) of times using BASH
#!/usr/bin/env bash
# USAGE:
# ./printF.sh <F_count> <outfile>
#
# printF.sh Copyright (C) 2020 Ross Goodwin
# This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
# This is free software, and you are welcome to redistribute it
# under certain conditions; type `show c' for details.
head -c ${1} < /dev/zero | tr '\0' '\106' | dd of=${2}
@rossgoodwin
rossgoodwin / generate.py
Created May 23, 2019 06:36
Based on Kyle McDonald's jupyter notebook code for sampling GPT-2 models
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import json
import os
import numpy as np
import tensorflow as tf
#!/usr/bin/env python3
# Usage:
# PYTHONPATH=src ./train --dataset <file|directory|glob>
import argparse
import json
import os
import numpy as np
import tensorflow as tf
import time
#!/usr/bin/env python3
# Usage:
# PYTHONPATH=src ./train --dataset <file|directory|glob>
import argparse
import json
import os
import numpy as np
import tensorflow as tf
import time
const stopRe = /\band\b|\bor\b|\bbut\b|\bnor\b|\bfor\b|\byet\b|\bso\b|\bin\b|\bon\b|\bto\b|\bof\b|\binto\b|\bwith\b|[\.\!\?\n]+|[,;:]/igm;
export default { }
// function puncStrip(text) {
// return text; // no processing
// // return text.match(puncStripRe)[1]; // kyle's processing
// }
@rossgoodwin
rossgoodwin / poems.js
Last active April 10, 2019 01:53
line trimmer
const stopRe = /\band\b|\bor\b|\bbut\b|\bnor\b|\bfor\b|\byet\b|\bso\b|\bin\b|\bon\b|\bto\b|\bof\b|\binto\b|\bwith\b|[\.\!\?]+|[,;:]/igm;
export default { }
// function puncStrip(text) {
// return text; // no processing
// // return text.match(puncStripRe)[1]; // kyle's processing
// }
from collections import defaultdict, Counter
from random import random
import sys
def train_char_lm(filename, order=4):
with open(filename, 'r') as infile:
raw_text = infile.read()
lm = defaultdict(Counter)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@rossgoodwin
rossgoodwin / thermal_py3.py
Created April 30, 2018 17:46
Thermal Printer Library (Python3)
import serial
import string
import os
import time
ser = serial.Serial('/dev/ttyUSB0')
ser.write(b'{LP}')
def chunks(l, n):