Skip to content

Instantly share code, notes, and snippets.

View jl2's full-sized avatar

Jeremiah LaRocco jl2

View GitHub Profile
@jl2
jl2 / dts.go
Created September 21, 2012 23:08
Print the number of days till ABasin opens, this time using Go.
package main
import (
"time"
"fmt"
)
func main() {
this_date := time.Now()
opening_day := time.Date(this_date.Year(), time.October, 25, 9, 0, 0, 0, this_date.Location())
@jl2
jl2 / chromeup.go
Created September 21, 2012 23:41
Update to latest developer build of Chromium using Go
package main
import "net/http"
import "fmt"
import "os"
import "os/exec"
import "log"
import "io/ioutil"
@jl2
jl2 / gpxparse.go
Created September 24, 2012 06:45
Parse a GPX file using Go.
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"log"
"os"
"time"
)
@jl2
jl2 / confused.cpp
Created September 28, 2012 23:33
what is line 13 doing?
#include <iostream>
#include <string>
class omg {
public:
operator wchar_t* () const {
return L"wtf";
}
};
@jl2
jl2 / voidcast.cpp
Created October 1, 2012 22:46
Play with "operator void ()"
#include <iostream>
class VoidTest {
public:
VoidTest(int val) : _val(val) {}
operator void () {
_val *= 2;
}
int _val;
};
@jl2
jl2 / randgraph.go
Created October 4, 2012 23:50
Use Go and GraphViz's dot command to create random digraph SVGs.
package main
import (
"net/http"
"fmt"
"log"
"os/exec"
"io/ioutil"
"math/rand"
"strings"
@jl2
jl2 / wordgraph.go
Created October 5, 2012 07:59
Use Go and Dot to create a directed graph from a text file. Don't know what this could be used for, but it looks neat.
package main
// Create a directed graph based on the words in a text file.
// For example the sentences "This is some text. What is this good for?" would produce the following digraph:
// digraph graph {
// This -> is
// is -> some
// some -> text
// What -> is
@jl2
jl2 / googlecomma.cpp
Created December 20, 2012 00:10
For no good reason, a class that overloads the comma operator to download google.com
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstring>
#include <curl/curl.h>
struct download {
size_t size;
@jl2
jl2 / cupdate.py
Created December 22, 2012 00:01
Update to a new version of Chromium on Windows
#!/usr/bin/env python3
import os
import subprocess
import httplib2
# Install the latest Chromium snapshot build on Windows
def main():
h = httplib2.Http(".cache")
@jl2
jl2 / Makefile
Created December 22, 2012 00:12
Template for rendering with 3Delight.
DELIGHT=c:\Program Files\3Delight
render.exe: render.c Makefile
gcc -O3 -I"$(DELIGHT)/include" -o render render.c -L"$(DELIGHT)/lib" -l3delight