Skip to content

Instantly share code, notes, and snippets.

View Version2beta's full-sized avatar

Rob Martin Version2beta

View GitHub Profile
@Version2beta
Version2beta / exercise-web-crawler.go
Last active August 30, 2021 05:47
A Tour of Go Exercise: Web Crawler
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
const logging = true
@Version2beta
Version2beta / exercise-rot-reader.go
Created August 30, 2021 02:48
A Tour of Go Exercise: rot13Reader
package main
import (
"fmt"
"io"
"os"
"strings"
)
type rot13Reader struct {
@Version2beta
Version2beta / exercise-equivalent-binary-trees.go
Created August 30, 2021 02:46
A Tour of Go Exercise: Equivalent Binary Trees
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
func Walk(t *tree.Tree, ch chan int) {
if t == nil {
return

Keybase proof

I hereby claim:

  • I am version2beta on github.
  • I am version2beta (https://keybase.io/version2beta) on keybase.
  • I have a public key ASBWycr-1gFFwyfPI3S1ZqThdpYCW1tvfVnDZk0UAvp3JAo

To claim this, I am signing this object:

( This is a simplified version of the card game War written in Puppy. )
( Simple version of War: )
( Two values on top of the stack represent dealt cards for the left and the )
( right players. Figure out which is bigger, and send the cards to that )
( player. In case of a tie, play again to determine the winner. )
( Puppy is an unimplemented point-free, concatentative, stack-based language )
( with quotations. )
@Version2beta
Version2beta / gist:49ba5def7f3119aa6394
Created September 5, 2014 16:53
erlang shell options
# Copyright (c) 2014, M Robert Martin <rob@version2beta.com>
# This file is contributed to erlang.mk and subject to the terms of the ISC License.
.PHONY: shell
# Configuration.
SHELL_PATH ?= -pa ../$(PROJECT)/ebin $(DEPS_DIR)/*/ebin
SHELL_OPTS ?=
> -- collected from #lua user q66
> foo = newproxy(true)
> getmetatable(foo).__gc = function() print("o hai!") end
> foo = nil
> collectgarbage()
o hai!
> foo = {}
> foo.__my_gc_thingy = newproxy(true)
> getmetatable(foo.__my_gc_thingy).__gc = function() print("collectin' a table") end
> foo = nil
@Version2beta
Version2beta / gist:6d47df57712ebdb575db
Created May 21, 2014 17:22
lua setmetatable issue
local env = os.getenv('DNMENV') or 'dev'
local configs = {
dev = {
db = {
address = "127.0.0.1",
port = 6379,
db = 0,
testdb = 15,
timeout = 1000,
keepalive = { 2000, 1 }
@Version2beta
Version2beta / gist:9533942
Created March 13, 2014 18:24
Sequel issue
Sequel.migration do
change do
create_table :reports do
primary_key :id
column :name, String, null: false
column :product, String, null: false
column :category, String
column :topics, 'varchar[]'
column :expired_at, Time
-> cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "precise64"
config.vm.network :private_network, ip: "10.42.42.2"
# config.vm.network :public_network