This file contains 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
func makePipe(path string) (file *os.File, err error) { | |
err = unix.Mkfifo(path, 0777) | |
if err != nil { | |
return nil, err | |
} | |
// mkfifo(3) states: | |
// "It is modified by the process's | |
// umask in the usual way: the permissions of the created file are | |
// (mode & ~umask)." | |
// The pipe must be writeable by other users. |
This file contains 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
loadjs=function(){function h(){}function r(a,c){a=a.push?a:[a];var b=[],d=a.length,e=d,g,f,m;for(g=function(a,d){d.length&&b.push(a);e--;e||c(b)};d--;)f=a[d],(m=n[f])?g(f,m):(f=l[f]=l[f]||[],f.push(g))}function p(a,c){if(a){var b=l[a];n[a]=c;if(b)for(;b.length;)b[0](a,c),b.splice(0,1)}}function t(a,c){var b=document,d=b.createElement("script");d.src=a;d.onload=d.onerror=function(b){c(a,b.type)};b.head.appendChild(d)}function u(a,c){a=a.push?a:[a];var b=a.length,d=b,e=[],g;for(g=function(a,b){"e"== | |
b[0]&&e.push(a);d--;d||c(e)};b--;)t(a[b],g)}function k(a,c,b,d){var e,g,f;c&&!c.call&&(e=c);g=e?b:c;f=e?d:b;if(e){if(e in q)throw Error("LoadJS: Bundle already defined");q[e]=!0}u(a,function(a){a.length?(f||h)(a):(g||h)();p(e,a)})}var q={},n={},l={};k.a=function(a,c,b){r(a,function(a){a.length?(b||h)(a):(c||h)()});return k};k.done=function(a){p(a,[])};return k}(); |
This file contains 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 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 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 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 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
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 |
This file contains 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 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 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" | |
) |