Skip to content

Instantly share code, notes, and snippets.

View wwoods's full-sized avatar

Walt Woods wwoods

  • LameGame Productions
View GitHub Profile
FROM ubuntu:18.04
RUN \
apt-get update \
&& apt-get install -y mongodb
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
# Setup service files to automatically run mongodb in the background
from job_stream import inline
r"""The following parallelizes:
for i in range(10):
result = 0
while result < 50:
result += i * 2
print(result)
"""
"""A figure generator for slicing and displaying data. Example usage:
import pandas
data = pandas.DataFrame()
data["a"] = None
data["b"] = None
data.loc[0] = [ 1, 1 ]
data.loc[1] = [ 2, 2 ]
data.loc[2] = [ 3, 2 ]
maker = FigureMaker(data, "images/", imageExtension = "png")
maker.setLabel("a", "First column")
//NOTE - _splice(a, b) just produces "a_b" as a string
if (compensate) {
//Compensation column
if (!this->useVirtualGround) {
net << "Rcomp OutComp 0 " << rTerm << "\n";
measures.emplace_back(SpiceNetwork::METHOD_AVG,
SpiceNetwork::TYPE_VOLTAGE, "OutComp");
}
else {
//OutComp2 is virtual ground output for Xcomp.
boost::mpi::environment env(argc, argv);
boost::mpi::communicator world;
if (world.rank() == 0) {
std::ofstream ofile;
ofile.open("overtraining_20k.txt");
int workers = world.size() - 1;
int pending = 0;
for(int sets = 10000; sets <= 20000; sets+=10)
@wwoods
wwoods / gist:8201567
Last active January 1, 2016 21:09
Commit repo / series to run through code review tools

Goals

  • At least some changes should be of sufficient size to portray actual commits
  • Cover all common operations / change request types

Base Repo

main.py

from file1 import method1
from file3 import method3

if name == 'main':

@wwoods
wwoods / .bashrc
Last active May 30, 2016 22:04
My bash prompt settings
####
# Bash prompt w/ runtime of last series of commands (e.g. sleep 1 && sleep 1 correctly represented as 2s)
####
smiley () {
printf :\\"$(($??50:51))";
}
print_elapsed () {
NOW=`date +%s%N`
DIFF=$(expr $NOW - $PT_LAST_TIME)
DIV=1
@wwoods
wwoods / linuxDiskTests
Last active December 28, 2015 01:29
Script to run harddrive tests.
bonnie++ -b > bonnie.out
tail -n 1 bonnie.out | bon_csv2txt > bonnie.txt
tail -n 1 bonnie.out | bon_csv2html > bonnie.html
echo "{ nThreads: 128, w: true, mmf: false, fileSizeMB: 1024 }" | mongoperf > mongoperfWrite.out &
PID=$!
sleep 120
kill -SIGINT $PID
echo "{ nThreads: 128, r: true, mmf: false, fileSizeMb: 1024 }" | mongoperf > mongoperfRead.out &
PID=$!
from __future__ import print_function
import copy
import hyperclient
import pymongo
import time
import rethinkdb as r
class DbTest(object):
def setup(self):