Skip to content

Instantly share code, notes, and snippets.

@shyuan
shyuan / dig amazon.com
Created March 11, 2015 10:42
Amazon 沒有用 Route53
% dig +short ns amazon.com
ns3.p31.dynect.net.
ns2.p31.dynect.net.
ns4.p31.dynect.net.
pdns1.ultradns.net.
ns1.p31.dynect.net.
pdns6.ultradns.co.uk.
@shyuan
shyuan / dig NS netflix.com netflixc.com itp.netflix.com
Created March 12, 2015 08:57
Netflix.com uses DynECT, AWS Route53, UltraDNS at the same time
; <<>> DiG 9.8.3-P1 <<>> NS netflix.com netflixc.com itp.netflix.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8149
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;netflix.com. IN NS
;; ANSWER SECTION:
@shyuan
shyuan / mtr 168.95.98.254
Created March 17, 2015 17:30
家裡的網路有問題
HOST: ChrisYuanMBA.local Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.16.254 0.0% 100 2.3 2.6 1.0 45.8 5.0
2.|-- 192.168.88.1 0.0% 100 1.7 2.6 1.3 11.9 1.8
3.|-- 168.95.98.254 17.0% 100 17.0 18.1 16.7 35.0 2.7
@shyuan
shyuan / dig-images.vsco.co
Created April 2, 2015 10:26
dig images.vsco.co
$ dig +short images.vsco.co
db025892b02ff796a9a7-b7dc8a3d964e322bd6fff62a0c71c781.r93.cf1.rackcdn.com.
a93.rackcdn.com.
a93.rackcdn.com.mdc.edgesuite.net.
a95.dscg10.akamai.net.
173.205.6.177
173.205.6.171
@shyuan
shyuan / random-path-url.lua
Created November 22, 2016 04:51
Random path benchmark Lua script for wrk
-- https://github.com/wg/wrk
-- wrk -c 1000 -d 10s -s random-path-url.lua http://localhost:8080
local paths = {
"/path1.txt",
"/path2.txt",
"/path3.txt",
"/path4.txt",
"/path5.txt",
"/path6.txt"
@shyuan
shyuan / taiwan-timezone-history.sh
Last active October 26, 2017 08:21
Taiwan Timezone Change History
date --date='@-2335248361'
date --date='@-2335248360'
date --date='@-1017820801'
date --date='@-1017820800'
date --date='@-766224001'
date --date='@-766224000'
date --date='@-745833601'
date --date='@-745833600'
date --date='@-733827601'
date --date='@-733827600'
@shyuan
shyuan / group-by-date-from-timestamp-column.sql
Created October 26, 2017 08:15
Counting group by date with a UNIX timestamp column
SELECT FROM_UNIXTIME(`created_at`, '%Y.%m.%d') AS ndate, COUNT(1) AS xx_table_count FROM xx_table GROUP BY ndate;
@shyuan
shyuan / curl-format.txt
Last active October 31, 2017 08:47
cURL time format
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
@shyuan
shyuan / segfault.c
Created November 10, 2017 06:16
A C snippet would cause segmentation fault
#include <stdio.h>
int main()
{
int *ptr = NULL;
printf("%d", *ptr);
return 0;
}
@shyuan
shyuan / group-by-null.sql
Created December 14, 2017 02:38
計算某欄位是否為 NULL 的資料筆數
SELECT IF( ISNULL(deleted_at), 'NO', 'YES') AS is_deleted, COUNT(1) FROM xx_table GROUP BY is_deleted;