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
events { | |
} | |
http { | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
set $host_1 "http://127.0.0.1:8881"; | |
set $host_2 "http://127.0.0.1:8882"; |
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
#!/bin/bash | |
function wallpaper() { | |
# set -ex | |
query=$1 | |
if [[ -z $query ]]; then | |
query="wallpaper" | |
fi | |
pic_path="/tmp/wallpaper.jpg" | |
wget "https://source.unsplash.com/random/1920x1080?$query" -O $pic_path | |
feh --no-fehbg --image-bg "#000000" --bg-max $pic_path |
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 ( | |
"encoding/binary" | |
"encoding/json" | |
"errors" | |
"fmt" | |
"strings" | |
"log" |
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
function tsr() { | |
tsc $1.ts && node $1.js | |
} |
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
local function my_ipairs(t) | |
local i = 1 | |
return function() | |
local v = t[i] | |
if v then | |
local ii = i | |
i = i + 1 | |
return ii, v | |
else | |
return nil |
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" | |
func main() { | |
count := 60 | |
diff := float64(1.0) | |
for i := 0; i <= count; i++ { | |
diff *= float64((365 - float64(i)) / 365) // would be all different day. | |
fmt.Printf("times %d, diff [%.2f%%], same [%.2f%%]\n", i, diff*100, (1-diff)*100) |
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
x = { | |
value = 1, | |
text = "test", | |
inest = { | |
aaaa = "1", | |
eee = { | |
abc = 1 | |
}, | |
bl = true, | |
} |
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" | |
"reflect" | |
"unsafe" | |
) | |
type NestType struct { | |
S string |
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
Step 0. Install git | |
yum install git | |
Step 1. Clone repository | |
git clone git://github.com/kr/beanstalkd.git | |
cd beanstalkd | |
make | |
cp beanstalkd /usr/bin/beanstalkd |
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" | |
"os" | |
"runtime" | |
"time" | |
) | |
// Results of this program on my machine: (linux amd64, go 1.4): |