Skip to content

Instantly share code, notes, and snippets.

View richardwu's full-sized avatar

Richard Wu richardwu

View GitHub Profile
#!/usr/bin/bash
set -e
if [[ $# -ne 2 ]] ; then
echo "usage: $0 <GH org url eg https://github.com/tensor-hq> <GH runner token>"
exit 1
fi
ORGURL="$1"
TOKEN="$2"
@richardwu
richardwu / ec2_install_gh_runner.sh
Last active October 7, 2022 16:13
Simple script to install + run an GH org runner on an AWS EC2 instance.
#!/usr/bin/bash
set -e
if [[ $# -ne 2 ]] ; then
echo "usage: $0 <GH org url eg https://github.com/tensor-hq> <GH runner token>"
exit 1
fi
ORGURL="$1"
TOKEN="$2"
@richardwu
richardwu / TestQ17-loop.hs
Last active March 19, 2018 20:51
Testing in Haskell (CS 442)
-- eval loop
module TestQ17 where
import Test.HUnit
import Q17
testFn fn (input, expected) =
TestCase $ (fn input) @?= expected
@richardwu
richardwu / Makefile
Last active March 19, 2018 05:37
Test harness for CS 341 - drag and drop these files into your source folder, then run `make test` (Go required and c++11 required).
EXEC = a4q1
SRC = a4q1.cpp
TEST = a4q1_test.go
${EXEC}: ${SRC}
g++ -std=c++11 ${SRC} -o ${EXEC}
.PHONY: test clean build
build: ${EXEC}
# Install dependencies
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install build-essential ccache cmake autoconf yarn libedit-dev nodejs
echo -ne 'Y\n'
echo 'export PATH="/usr/lib/ccache:$PATH"' >> ~/.profile
# Get Go
@richardwu
richardwu / slice_test.go
Last active October 10, 2017 15:41
Golang dynamically-sized slices micro-benchmark
package main
import (
"math/rand"
"testing"
)
const sz = 100
// Percentage of indexes to append.