Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
.PHONY: clean all test
VERSION ?= $(shell git describe --tags --abbrev=0)
REVISION ?= $(shell git rev-parse HEAD)
BUILDDATE ?= $(shell date)
IMPORTNAME = github.com/saml/yolo
all: bin/yolo bin/yolo-webap
package main
import (
"bytes"
"encoding/json"
"fmt"
"html/template"
)
type WebPage struct {
//http://play.golang.org/p/eM_xC8Tw5r
package main
import (
"fmt"
)
type Resource interface {
ID() string
}
sqlite> create table things(user text, girl text, action text, date datetime);
sqlite> insert into things values ('saml', 'jessica alba', 'married', datetime('now'));
sqlite> insert into things values ('saml', 'jessica alba', 'divorced', datetime('now'));
sqlite> insert into things values ('saml', 'sigourney weaver', 'married', datetime('now'));
sqlite> insert into things values ('saml', 'sigourney weaver', 'divorced', datetime('now'));
sqlite> insert into things values ('saml', 'jessica alba', 'married', datetime('now'));
sqlite> select user,girl,action,max(date) from things where user = 'saml' group by girl;
saml|jessica alba|married|2016-04-06 21:24:09
saml|sigourney weaver|divorced|2016-04-06 21:24:02
#!/bin/bash
version="${VERSION:-$(git describe --tags --abbrev=0)}"
revision="${REVISION:-$(git rev-parse HEAD)}"
builddate="$(date)"
wgo restore &&
wgo test ./ &&
wgo build -ldflags "-X \"main.appVersion=$version\" -X \"main.appRevision=$revision\" -X \"main.appBuildDate=$builddate\""
open("/home/saml/.config/Code/storage.json", O_RDONLY|O_CLOEXEC) = 62
fstat(62, 0x7ffe124d6580) = 0
read(62, "{...content of storage.json...}", 3135) = 3135
close(62) = 0
madvise(0xdd418172000, 36864, MADV_DONTNEED) = 0
madvise(0xdd41860b000, 2297856, MADV_DONTNEED) = 0
madvise(0xdd4182ef000, 69632, MADV_DONTNEED) = 0
madvise(0xdd418172000, 36864, MADV_DONTNEED) = 0
madvise(0xdd418172000, 36864, MADV_DONTNEED) = 0
madvise(0xdd418172000, 36864, MADV_DONTNEED) = 0
class One:
def __next__(self) -> int:
return 1
class OneStr:
def __init__(self) -> None:
self.iterable = One()
def __next__(self) -> str:
return str(next(self.iterable))
# TERM first, then KILL if not dead
kill -TERM $pid >/dev/null 2>&1
usleep 100000
if checkpid $pid && sleep 1 &&
checkpid $pid && sleep $delay &&
checkpid $pid ; then
kill -KILL $pid >/dev/null 2>&1
usleep 100000
fi
E A D A/C# E
Oh baby I'm so lonely. Waking up in the morning alone.
F#m E D A/C# D A/C# Bm
The sun hasn't even come up. Oh I'm getting old, losing morning sleep.
D E A D A/C# E
And I sleep before 10. Oh baby I'm so lonely. Belting out at night alone.
F#m E D A/C# D A/C# Bm
The sun is already down. Oh I'm getting old, losing all my voice
D E G A
on a song less than a minute.
@saml
saml / hello.c
Created February 14, 2016 13:35
#包含 <基本.头文件>
定數 主(空虛) {
出力("你好世上");
返還 空;
}