Skip to content

Instantly share code, notes, and snippets.

View 0xhaven's full-sized avatar
💃

Olive Haven 0xhaven

💃
View GitHub Profile
@0xhaven
0xhaven / tldHomographs.json
Created September 25, 2019 22:32
Homographs of: 'com', 'org', 'io', 'xn--c1avg', 'xn--j1aef'
This file has been truncated, but you can view the full file.
{
"com": [
{
"homograph": "cంrn",
"punycode": "xn--rn-shh5020w"
},
{
"homograph": "cంrn",
"punycode": "xn--rn-shh5020w"
},
@0xhaven
0xhaven / country_paths.py
Created April 3, 2019 22:13
Searching the graph of country land borders.
from collections import defaultdict
#
# What are the minimum number of land border crossing between any two countries?
# Based on this reddit question: https://redd.it/b8vjzp
#
# From https://www.cia.gov/library/publications/resources/the-world-factbook/fields/281.html
countries = {
"Afghanistan": {"China", "Iran", "Pakistan", "Tajikistan", "Turkmenistan", "Uzbekistan"},
@0xhaven
0xhaven / set.c
Created January 27, 2018 15:08
Simple set implementation in C
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <stdio.h>
struct list {
int elem;
struct list *next;
};

An Introduction to Concurrency Using Go

Very frequently it's beneficial to have multiple code paths executing simultaneously or interleaved. This can provide performance improvements, it can allow you to write clearer code, and it can be fun!

Goroutines

The chief way to allow concurrent execution in go is the go keyword. Its use looks like a regular function invocation:

go fmt.Println("Hello World!")

This will asynchronously print "Hello World!" at some point in the future, independent

@0xhaven
0xhaven / client.go
Last active August 8, 2016 21:25
Bleichenbacher '06
package main
import (
"crypto/sha1"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
"log"
"math/big"
@0xhaven
0xhaven / GoSublime.sublime-settings
Created June 20, 2016 21:26
GoSublime User Settings
{
"fmt_cmd": ["goimports"],
"comp_lint_enabled": true,
"on_save": [{
"cmd": "gs9o_open", "args": {
"run": ["sh",
"go build . errors && go test -i && go test && go vet && golint ."],
"focus_view": false
}}],
"autocomplete_closures": true,
@0xhaven
0xhaven / playground.go
Created March 28, 2016 20:29
Go Playground run script
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
@0xhaven
0xhaven / keybase.md
Created February 10, 2016 21:34
Keybase proof

Keybase proof

I hereby claim:

  • I am jacobhaven on github.
  • I am jacob_haven (https://keybase.io/jacob_haven) on keybase.
  • I have a public key whose fingerprint is EE14 F126 17B1 A8DB 6900 40FC 65DC 372E 63C0 7F33

To claim this, I am signing this object:

@0xhaven
0xhaven / test_simplehttp.go
Created March 10, 2015 00:58
Simple HTTP Test
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
)
@0xhaven
0xhaven / 1024bit_roots.go
Created March 4, 2015 18:14
Root CAs with Weak Public Keys
package main
import (
"crypto/rsa"
"crypto/x509"
"encoding/asn1"
"fmt"
"io/ioutil"
"log"
"net/http"