This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH models AS ( | |
WITH data AS ( | |
SELECT | |
replace(initcap(table_name::text), '_', '') table_name, | |
replace(initcap(column_name::text), '_', '') column_name, | |
CASE data_type | |
WHEN 'timestamp without time zone' THEN 'time.Time' | |
WHEN 'timestamp with time zone' THEN 'time.Time' | |
WHEN 'boolean' THEN 'bool' | |
WHEN 'uuid' THEN 'uuid.UUID' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stdLongMonth // "January" | |
stdMonth // "Jan" | |
stdNumMonth // "1" | |
stdZeroMonth // "01" | |
stdLongWeekDay // "Monday" | |
stdWeekDay // "Mon" | |
stdDay // "2" | |
stdUnderDay // "_2" | |
stdZeroDay // "02" | |
stdHour // "15" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
"much.more unusual"@example.com | |
"[email protected]"@example.com | |
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com | |
[email protected] | |
admin@mailserver1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"errors" | |
"fmt" | |
"strconv" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"sort" | |
"github.com/EricLagergren/go-gnulib/utmp" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |