Skip to content

Instantly share code, notes, and snippets.

View sbward's full-sized avatar
🌱
plant-powered programming

Sam Ward sbward

🌱
plant-powered programming
  • Wellington, New Zealand
  • 04:19 (UTC +12:00)
View GitHub Profile
{
"MRData": {
"xmlns": "http:\/\/ergast.com\/mrd\/1.4",
"series": "f1",
"url": "http://ergast.com/api/f1/2018/circuits.json",
"limit": "30",
"offset": "0",
"total": "21",
"CircuitTable": {
"season": "2018",

Keybase proof

I hereby claim:

  • I am sbward on github.
  • I am sam_ward (https://keybase.io/sam_ward) on keybase.
  • I have a public key ASB-OlbFyM2OzfF_GuSe1Jcj5ONzdRPwYaOc8eJHDaLWJQo

To claim this, I am signing this object:

Comparing Google Speech to Pocketsphinx

Summary

Rough estimate:

POCKETSPHINX:  33%
GOOGLE SPEECH: 66%

speechtest:
@sbward
sbward / go_macro.rs
Created December 9, 2014 07:23
Goroutines macro (joke)
macro_rules! go(
($inp:expr $sp:path) => (
unsafe{ spawn( $inp ) }
);
)
  1. install rsync on boot2docker VM
  2. install rsync locally
  3. install fswatch locally
  4. configure docker image to use a data volume, "/mnt/node_src" or whatever. this is a directory inside the VM. do not make this into a shared folder
  5. configure rsync to send your local node source directory to the VM into the "/mnt/node_src" directory (it does this via the network, not vbox shared folders)
  6. configure fswatch locally to trigger rsync when your source code changes
  7. configure forever to watch "/mnt/node_src" for changes in the VM
  8. ?????
  9. profit!
#!/bin/bash
touch kill.me
for i in {0..10000}
do
container_name=$RANDOM-$i
echo $container_name
if [ ! -f kill.me ]; then
echo "Exiting..."
exit 0
fi
[39355.705832] Memory cgroup out of memory: Kill process 8378 (php) score 999 or sacrifice child
[39355.712940] Killed process 8378 (php) total-vm:657284kB, anon-rss:408400kB, file-rss:0kB
[65425.582891] Memory cgroup out of memory: Kill process 8616 (ruby) score 809 or sacrifice child
[65425.589482] Killed process 8612 (wkhtmltoimage) total-vm:346084kB, anon-rss:56492kB, file-rss:0kB
[65427.755910] Memory cgroup out of memory: Kill process 8712 (ruby) score 810 or sacrifice child
[65427.760548] Killed process 8708 (wkhtmltoimage) total-vm:346212kB, anon-rss:56584kB, file-rss:0kB
[65431.124425] Memory cgroup out of memory: Kill process 8764 (ruby) score 810 or sacrifice child
[65431.129199] Killed process 8759 (wkhtmltoimage) total-vm:345964kB, anon-rss:56564kB, file-rss:0kB
[65435.164030] Memory cgroup out of memory: Kill process 8780 (ruby) score 810 or sacrifice child
[65435.168430] Killed process 8776 (wkhtmltoimage) total-vm:345944kB, anon-rss:56428kB, file-rss:0kB
@sbward
sbward / docker.log
Created August 14, 2014 19:48
strace output
execve("/usr/bin/docker", ["docker", "-d", "-D"], [/* 14 vars */]) = 0
uname({sys="Linux", node="ip-10-5-152-136", ...}) = 0
brk(0) = 0x229d000
brk(0x229e1c0) = 0x229e1c0
arch_prctl(ARCH_SET_FS, 0x229d880) = 0
set_tid_address(0x229db50) = 7479
set_robust_list(0x229db60, 24) = 0
futex(0x7fff70c269c0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 229d880) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x7da500, [], SA_RESTORER|SA_SIGINFO, 0x7dabc0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7da590, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7dabc0}, NULL, 8) = 0
@sbward
sbward / andrew.go
Created July 31, 2014 06:13
Code sample from your house
package main
import (
"flag"
"fmt"
"math/rand"
"strconv"
"sync"
)
@sbward
sbward / mixpanel_people.php
Created July 22, 2014 19:39
Get mixpanel people without emails
<?php
include "mixpanel_data.php"
$mp = new Mixpanel($api_key, $api_secret);
$data = $mp->request(array('engage'), array(
'where' => 'properties["email"] == ""',
'page' => $page
));