Skip to content

Instantly share code, notes, and snippets.

View benatkin's full-sized avatar

Benjamin Atkin benatkin

View GitHub Profile
{
"extends": "program",
"counter": {
"extends": "loop",
"range": [1, 100],
"run": "logger"
},
"logger": function() {
console.log(this.counter);
},
@benatkin
benatkin / main.go
Created January 5, 2014 06:50
go type practice
package main
import (
"fmt"
"reflect"
"github.com/BurntSushi/ty"
)
func Map(f, xs interface{}) interface{} {
// Given the parametric type and the arguments, Check will
@benatkin
benatkin / wow.py
Last active January 2, 2016 04:49
import random
def wow(words):
words = words[:]
additions = []
random.shuffle(words)
for word in words:
if not len(additions):
additions = ['so', 'many', 'such', 'very', 'much', 'wow'][:]
random.shuffle(additions)
@benatkin
benatkin / gist:8177225
Created December 30, 2013 02:47
bash snippet: iso date/time with underscores for symbols (easier for filenames)
db-$(date +%Y_%m_%dT%H_%M_%SZ).sql
@benatkin
benatkin / fabfile.py
Last active March 16, 2017 18:01
mining dogecoin in the cloud
from fabric.api import env, task, run, sudo, cd, local
from fabric.decorators import with_settings
from fabric.operations import put
env.user = 'ec2-user'
env.hosts = [
'ec2-your-address-1.us-west-2.compute.amazonaws.com',
'ec2-your-address-2.us-west-2.compute.amazonaws.com',
'ec2-your-address-3.us-west-2.compute.amazonaws.com',
'ec2-your-address-4.us-west-2.compute.amazonaws.com',

Extra tips for the pragmatic programmer. Imagine that like Cards of Humanity has extra cards, The Pragmatic Programmer had extra pages. Actually wouldn't it be cool if The Pragmatic Programmer was a stack of cards?

Orginal 70 here

  • Reflect on @doge_js's tweets - if you're stuck there's nothing quite like piecing together scattered thoughts to get inspiration (idea from here)
quiet
dogebuzz
install dogescript with: npm install -g dogescript
then run: dogescript dogebuzz.djs | node
loud
very number is 1
many number lesser 101
rly number % 3 is 0 and number % 5 is 0
plz console.loge with 'dogebuzz'
module.exports = {
"tasks": {
"custom": function(done) {
setTimeout(function() {
done();
}, 100);
}
},
"run": [
{"extends": "apt", "install": ["build-essential"]},
in its original form, this is a micropost on my computer. you are most likely reading a copy of it.
@benatkin
benatkin / mortality_spec.rb
Last active December 19, 2015 23:18
everyone dies
describe 'mortality' do
it 'should not live too long' do
BiosphereSim
.make(:humans, 10**9)
.time_travel(115.years)
.select {|h| h.alive?}
.should have_at_most(100).items
end
end