- 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 获取某个日期之前的日报
#!/bin/bash | |
############################## | |
# dnspodsh v0.3 | |
# 基于dnspod api构架的bash ddns客户端 | |
# 作者:zrong(zengrong.net) | |
# 详细介绍:http://zengrong.net/post/1524.htm | |
# 创建日期:2012-02-13 | |
# 更新日期:2012-03-11 | |
############################## |
// This hack works with com.android.tools.build:gradle:0.2, won't work in later version without modification | |
apply plugin: 'android' | |
targetCompatibility = 1.6 | |
sourceCompatibility = 1.6 | |
android { | |
target = 'android-14' |
[Unit] | |
Description=Shadowsocks Server | |
After=network.target | |
[Service] | |
Type=forking | |
PIDFile=/run/shadowsocks/server.pid | |
PermissionsStartOnly=true | |
ExecStartPre=/bin/mkdir -p /run/shadowsocks | |
ExecStartPre=/bin/chown nobody:nogroup /run/shadowsocks |
#! /bin/bash | |
function valid_required_envs() { | |
# Configs | |
required_envs=(KUBE_CONTEXT KUBE_SERVER) | |
# Securities | |
required_envs+=(KUBE_CERTIFICATE_AUTHORITY) | |
required_envs+=(KUBE_CLIENT_CERTIFICATE KUBE_CLIENT_KEY) | |
errors=() |
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" | |
) |
//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/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 |