Skip to content

Instantly share code, notes, and snippets.

View sdwfrost's full-sized avatar

Simon Frost sdwfrost

View GitHub Profile
@sdwfrost
sdwfrost / sir.v
Created November 16, 2019 16:03
Epidemiological simulation in V
// v -cc gcc -cflags "-O3 -ffast-math -flto" sir.v
import math
import time
[inline]
fn clz64(v u64) u32 {
return C.__builtin_clzll(v)
}
[inline]

Compiling the C file:

gcc -o test test.c -I . -I /usr/include -lc

Compiling the Zig file throws an error:

$zig build-exe ztest.zig -I . --library c
@sdwfrost
sdwfrost / counties-centroids.geojson
Created September 23, 2019 18:42
Centroids of US counties in GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sdwfrost
sdwfrost / counties.geojson
Created September 23, 2019 17:54
US Counties data in geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sdwfrost
sdwfrost / iris.ipynb
Last active June 8, 2019 13:01
Jupyter notebook for MLJ using Iris data and DecisionTree
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sdwfrost
sdwfrost / README.md
Created December 3, 2018 15:27
Ag1000g metadata

These are a copy of data on Ag1000g from the WTSI FTP site. Use of these data should follow the Terms of Use that allow these data to be shared pre-publication.

@sdwfrost
sdwfrost / min-char-rnn.py
Created November 5, 2018 17:50 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
# Here's how to back up a named volume
# 1. Using a `ubuntu` image, we mount the named volume (`myproj_dbdata`) to a `/dbdata` folder inside the `ubuntu` container.
# 2. Then, we create a new folder inside the `ubuntu` container named `/backup`.
# 3. We then create an archive containing the contents of the `/dbdata` folder and we store it inside the `/backup` folder (inside the container).
# 4. We also mount the `/backup` folder from the container to the docker host (your local machine) in a folder named `/backups` inside the current directory.
docker run --rm -v myproj_dbdata:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db_data_"$(date '+%y-%m-%d')".tar /dbdata
#! /usr/bin/env python
import pexpect
import pexpect.replwrap
repl = pexpect.replwrap.REPLWrapper("lua", u"> ", None, u"> ")
output = repl.run_command("= 1 + 1", timeout=1).splitlines()[1:]
assert(int(output[0]) == 2)
@sdwfrost
sdwfrost / phylotree.js
Created August 17, 2018 09:40
Build of phylotree.js for use in Observable
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=41)}([function(t,e,n){(function(){var e,r,i,o,s,a,u,c,l,h,f,p,d={}.hasOwnProperty;p=n(1),f=p.isObject,h=p.isFunction,