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:

-> 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
@Version2beta
Version2beta / gist:6001107
Created July 15, 2013 15:58
Vagrant file and configuration cookbook for Vagrant + Chef, generating multiple unhappy errors
-> cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "itvdev"
config.vm.network :private_network, ip: "10.42.42.2"
# config.vm.network :public_network
@Version2beta
Version2beta / gist:5986071
Created July 12, 2013 17:11
Problems with Vagrant 1.2.3 and Chef 11.4.4 on a Precise64-based box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "itvdev"
config.vm.network :private_network, ip: "10.42.42.2"
# config.vm.network :public_network
@Version2beta
Version2beta / gist:5040063
Created February 26, 2013 16:54
Bash script dies about a minute into the second sql file.
# execute 'DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade'
include_recipe "postgresql"
include_recipe "postgresql::server"
include_recipe "postgresql::ruby"
include_recipe "database"
databases_file = "pgdatabases.tar.bz"
cookbook_file "/var/lib/postgresql/#{databases_file}" do
source databases_file
@Version2beta
Version2beta / getIdTest.php
Created December 23, 2012 23:19
Testing an oddity in MODX Revolution's get('id') method.
<?php
// Get the children
error_log(print_r($modx->resource->get('id'), 1)); // prints 1
$children = $modx->resource->getMany('Children'); // returns children of 1
if ($children) {
// Parse children
$retVal = '<ul>';
foreach ($children as $child) {
$retVal .= '<li>Resource ' . $child->get('id') . ', child of resource ' . $child->get('parent') . '</li>';
@Version2beta
Version2beta / gist:3895882
Created October 15, 2012 22:05
A non-functional Tako route.
app.route('/')
.html(function (req, resp) {
db.get('home', function(err, body) {
if (err) return resp.error(err)
console.log(templates.home(body));
})
.pipe(templates.home())
.pipe(resp);
})
.methods('GET')