- v3
http://news-at.zhihu.com/api/3/stories/latest 获取今日日报
http://news-at.zhihu.com/api/3/news/latest 获取今日日报
http://news-at.zhihu.com/api/3/news/before/20140618 获取某个日期之前的日报
| echo "deb http://httpredir.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list | |
| apt update | |
| apt install shadowsocks-libev curl -y | |
| cat > /etc/shadowsocks-libev/config.json <<EOF | |
| { | |
| "server":"0.0.0.0", | |
| "server_port":443, | |
| "local_port":1080, | |
| "password":"foobar!", |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "strconv" | |
| "github.com/miekg/dns" | |
| ) |
| #!/usr/bin/env bash | |
| # | |
| # Description: Auto test download & I/O speed script | |
| # | |
| # Copyright (C) 2015 - 2016 Teddysun <i@teddysun.com> | |
| # | |
| # Thanks: LookBack <admin@dwhd.org> | |
| # | |
| # URL: https://teddysun.com/444.html | |
| # |
| package main | |
| import ( | |
| "io" | |
| "os" | |
| "fmt" | |
| "sync" | |
| "strconv" | |
| "strings" |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "strings" | |
| "github.com/PuerkitoBio/goquery" | |
| "github.com/parnurzeal/gorequest" |
| //assumes you have the following environment variables setup for AWS session creation | |
| // AWS_SDK_LOAD_CONFIG=1 | |
| // AWS_ACCESS_KEY_ID=XXXXXXXXXX | |
| // AWS_SECRET_ACCESS_KEY=XXXXXXXX | |
| // AWS_DEFAULT_REGION=us-east-1 | |
| package main | |
| import ( | |
| "fmt" |
Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".
Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).
Let's dig in:
| #!/bin/bash | |
| docker run -it --rm --name certbot \ | |
| -v "/etc/letsencrypt:/etc/letsencrypt" \ | |
| -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \ | |
| -v "/data/letsencrypt:/.secrets" \ | |
| -p 80:80 \ | |
| -p 443:443 \ | |
| certbot/dns-cloudflare certonly \ | |
| -d $1 |
| #!/bin/sh | |
| docker rm -f $(docker ps -qa) | |
| docker volume rm $(docker volume ls -q) | |
| cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke" | |
| for dir in $cleanupdirs; do | |
| echo "Removing $dir" | |
| rm -rf $dir | |
| done |