Skip to content

Instantly share code, notes, and snippets.

@wcharczuk
wcharczuk / estimate_pi.go
Created October 18, 2017 18:02
A golang implementation of the napa-js estimate pi example
package main
import (
"fmt"
"math"
"math/rand"
"os"
"sync"
"time"
)
package main
import (
"fmt"
"os"
"runtime/pprof"
"time"
)
func main() {
@wcharczuk
wcharczuk / main_benchmark.go
Last active July 5, 2017 06:55
Benchmarks for common golang language features / stdlib items.
package main
import (
"sync"
"testing"
"time"
)
func WithDefer(cleanup func()) {
defer cleanup()
@wcharczuk
wcharczuk / update_blend_godeps.bash
Last active December 19, 2016 20:13
Updates all the blend godeps at once
#! /bin/bash
echo "updating core dependencies"
pushd $GOPATH/src/github.com/blendlabs/go-assert && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-exception && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-name-parser && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-util && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-workqueue && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-logger && git pull && popd
pushd $GOPATH/src/github.com/blendlabs/go-chronometer && git pull && popd

Keybase proof

I hereby claim:

  • I am wcharczuk on github.
  • I am wcharczuk (https://keybase.io/wcharczuk) on keybase.
  • I have a public key whose fingerprint is E66F 3D22 608F 35BE 1988 834F 93CE ABDD 2A27 94D6

To claim this, I am signing this object:

@wcharczuk
wcharczuk / pointers.go
Created April 12, 2016 22:02
Pointers vs. Structs
package main
import (
"fmt"
"time"
)
const (
GraphSize = 8
RecursionDepth = 5
@wcharczuk
wcharczuk / server.go
Last active February 19, 2016 02:38
Simplified TechEmpower json http responder
package main
import (
"encoding/json"
"net/http"
"os"
)
const (
HEADER_CONTENT_LENGTH = "Content-Length"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BalancedParens
{
class Program
{
@wcharczuk
wcharczuk / sudoku-solved.txt
Created August 31, 2015 18:02
Solved sudoku board
7 4 3 9 5 1 6 8 2
1 6 2 4 8 7 3 9 5
9 5 8 6 3 2 7 1 4
2 1 9 8 7 3 5 4 6
3 7 4 5 6 9 1 2 8
5 8 6 1 2 4 9 7 3
4 9 5 2 1 6 8 3 7
8 2 7 3 9 5 4 6 1
6 3 1 7 4 8 2 5 9
@wcharczuk
wcharczuk / sudoku-hard.txt
Created August 31, 2015 18:01
Hard sudoku board
5 3 _ _ 8 _ _ _ 2
7 _ _ 6 _ _ 3 _ _
_ _ 2 3 _ _ 1 _ _
_ _ _ _ _ _ _ _ 3
_ 7 _ 2 _ 5 _ 6 _
1 _ _ _ _ _ _ _ _
_ _ 5 _ _ 7 2 _ _
_ _ 9 _ _ 6 _ _ 7
6 _ _ _ 3 _ _ 9 5