Skip to content

Instantly share code, notes, and snippets.

View EvanTheB's full-sized avatar

Evan Benn EvanTheB

  • Sydney, Australia
View GitHub Profile
package main
import (
"github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/sdl_image"
"fmt"
"os"
//"math/rand"
)
evanb@evanpc:~/Documents/code/go/src/github.com/EvanTheB/SDLGame$ go run game.go
1.5e+11
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x7f7b707d11c9]
runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7f7b707d11c9
runtime.throw(0x7df345)
/usr/lib/go/src/pkg/runtime/panic.c:520 +0x69
runtime: unexpected return pc for runtime.sigpanic called from 0x7f7b707d11c9
import random
import string
# refs:
# http://eflorenzano.com/blog/2008/11/17/writing-markov-chain-irc-bot-twisted-and-python/
# http://www.ccel.org/ccel/bible/kjv.txt
END = "END"
# https://github.com/akkana/scripts/blob/master/countsyl
import re
with open("raw.log") as f:
log = f.read()
fil = re.compile(":(.*)!.*:(.*)")
lines = []
for l in log.split("\n"):
if "PRIVMSG #" not in l:
@EvanTheB
EvanTheB / c timeit
Created January 29, 2018 01:47
helper macro for timing a function in c - beware of optimisation
#define TIMEIT(F, N, REPS) \
{\
clock_t start = clock();\
for (int i = 0; i < N; ++i)\
{\
}\
clock_t diff_loop = clock() - start;\
double results[REPS];\
for (int i = 0; i < REPS; ++i)\
{\
task bwa_mem_tool {
Int threads
Int min_seed_length
Int min_std_max_min
command {
echo ${threads} ${min_seed_length} ${sep=',' min_std_max_min+} > output.sam
}
output {
File sam = "output.sam"
#!/bin/bash
set -xeuo pipefail
IFS=$'\n\t'
# git clone https://github.com/cloudflare/zlib &
[ -d "zlib-1.2.8" ] || curl -L https://github.com/cloudflare/zlib/archive/v1.2.8.tar.gz | tar zx &
# git clone https://github.com/ebiggers/libdeflate.git &
[ -d "libdeflate-1.0" ] || curl -L https://github.com/ebiggers/libdeflate/archive/v1.0.tar.gz | tar zx &
# git clone https://github.com/samtools/htslib.git &
[ -d "htslib-1.8" ] || curl -L https://github.com/samtools/htslib/releases/download/1.8/htslib-1.8.tar.bz2 | tar jx &
import random
import collections
def num_cards():
cures = [0] * 48 + [1] * 4
random.shuffle(cures)
def split(x, n):
return [x[i:len(x):n] for i in range(n)]
cures = [c + [2] for c in split(cures, 5)]
[random.shuffle(c) for c in cures]
#!/usr/bin/env bash
set -euo pipefail
CACHE_FILE="$HOME"/.cache/qstat.map
# a 1 minute timed cache
# does not actually handle failures properly. todo
if ! test -e $CACHE_FILE || (( $(find "$CACHE_FILE" -mmin +1 | wc -l) > 0)); then
CACHE_FILE_TMP="$CACHE_FILE.$$.$RANDOM"
trap 'rm '"$CACHE_FILE_TMP" EXIT
function autolike () {
[].forEach.call(
document.getElementById("likes-and-labels-container")
.getElementsByClassName("like-button-text"),
function (e) {
console.error(e);
if (e.innerText === "Like") {
e.parentNode.click();
// [].forEach.call(
// document.getElementsByClassName("like-button"),