Skip to content

Instantly share code, notes, and snippets.

type mask [ ... ]uint64
const (
word = 64
shift = 6
)
func (m mask) isSet(i int) bool {
return (m[i>>shift]>>(uint64(i)&(word-1)))&1 != 0
}
stdLongMonth // "January"
stdMonth // "Jan"
stdNumMonth // "1"
stdZeroMonth // "01"
stdLongWeekDay // "Monday"
stdWeekDay // "Mon"
stdDay // "2"
stdUnderDay // "_2"
stdZeroDay // "02"
stdHour // "15"
# numbers in parentheses are the DOS line numbers (i.e., CRLF which causes Linux and Macs to report twice as many lines.)
# Some lines also have asterisks in fields that are supposed to be numbers. (e.g., line # 712397)
line 5310 (10620), column 0: wrong number of fields in line
line 481929 (963858), column 0: wrong number of fields in line
line 711047 (1422094), column 129: bare " in non-quoted-field
line 711048 (1422095), column 1: bare " in non-quoted-field
line 711049 (1422096), column 0: wrong number of fields in line
line 924442 (1848882), column 134: bare " in non-quoted-field
line 924443 (1848883), column 0: wrong number of fields in line
prettyandsimple@example.com
very.common@example.com
disposable.style.email.with+symbol@example.com
other.email-with-dash@example.com
x@example.com
"much.more unusual"@example.com
"very.unusual.@.unusual.com"@example.com
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
example-indeed@strange-example.com
admin@mailserver1
@ericlagergren
ericlagergren / stringscontext.go
Created May 2, 2016 05:09 — forked from mholt/stringscontext.go
Functions from the 'strings' package as template actions. Feel free to copy+paste into your project as a starting point.
// Functions from Go's strings package usable as template actions
// with text/template.
//
// This approach assumes you have some context type as a receiver,
// but if you just need the functions check out the FuncMap variant
// below.
//
// Commented functions are not deemed useful in template actions.
// Haven't actually used this, but this is one possible way of doing it.
// Another option is to fill a FuncMap with most of the strings package.
@ericlagergren
ericlagergren / array.go
Last active April 12, 2016 17:42
Parse PostgreSQL arrays
package main
import (
"database/sql"
"errors"
"fmt"
"strconv"
"strings"
)
package main
import (
"fmt"
"log"
"sort"
"github.com/EricLagergren/go-gnulib/utmp"
)
@ericlagergren
ericlagergren / InstallGo
Last active February 24, 2016 01:47 — forked from mohae/InstallGo
Installs the current release of Go
#!/bin/bash
#
# For more info see https://golang.org/doc/install.html, the instructions there are all
# that is needed to install Go.
#
# DO NOT RUN with sudo; Go should be installed under the user not root. Using sudo will
# cause problems.
set -euo pipefail
#!/usr/bin/env python3
import requests
import os
import random
import string
import time
def rand_name():
return "/tmp/" + ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(15)) + ".jpg"
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"unsafe"