screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -AmdS docker ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker
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
#!/usr/bin/env bash | |
# 配置参考: | |
# https://github.com/shadowsocks/shadowsocks-libev/blob/master/docker/alpine/README.md | |
# 密码 | |
PASSWORD="your_password" | |
# 绑定到主机的端口号 | |
SERVER_PORT=8388 | |
# 加密方式 |
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 | |
# install tools | |
# sudo apt-get install debmirror | |
LOG_DIR="/disk_3T/debian_mirrors/log" | |
LOG="$LOG_DIR/$(date '+%F.%T').txt" | |
test -d $LOG_DIR || mkdir -p $LOG_DIR | |
# save mirror 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
#!/bin/bash | |
#============================================================================ | |
# Run below command for the first time | |
#============================================================================ | |
cat<< EOF | |
# install tools | |
sudo apt-get install debmirror | |
# Set up keyring to correctly verify Release signatures |
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 -oe | |
# FIXME: | |
#================================================== | |
# NOTE: | |
# 运行脚本之前,先给当前用户不要输入密码的权限 | |
# 运行如下命令: | |
# $ sudo sed -i 's/%sudo ALL=(ALL) ALL/%sudo ALL=(ALL) NOPASSWD:ALL/' /etc/sudoers | |
#================================================== |
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 | |
# 改变当前git库所有分支git 历史提交人的信息 | |
git filter-branch --env-filter ' | |
an="$GIT_AUTHOR_NAME" | |
am="$GIT_AUTHOR_EMAIL" | |
cn="$GIT_COMMITTER_NAME" | |
cm="$GIT_COMMITTER_EMAIL" |
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
import boto3 | |
import json | |
from datetime import datetime | |
# 本脚本只适用于适用特定的用户操作Firehose, 模拟角色可以参考 | |
# http://boto3.readthedocs.io/en/latest/reference/services/sts.html#STS.Client.assume_role | |
# https://gist.github.com/gene1wood/938ff578fbe57cf894a105b4107702de | |
def list_delivery_streams(client): | |
response = client.list_delivery_streams( |
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
# Refer: https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ | |
brew install coreutils | |
brew tap homebrew/dupes | |
brew install binutils | |
brew install diffutils | |
brew install ed --with-default-names | |
brew install findutils --with-default-names | |
brew install gawk | |
brew install gnu-indent --with-default-names | |
brew install gnu-sed --with-default-names |
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
from scrapy.loader.processors import Compose, MapCompose | |
proc = Compose(lambda v: v[0], str.upper) | |
proc(['hello', 'world']) # HELLO | |
mproc = MapCompose(lambda v: v[0], str.upper) | |
mproc(['hello', 'world']) # ['H', 'W'] |
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
# get current ec2 AutoScaling group name | |
# note: change region option as yours | |
aws autoscaling describe-auto-scaling-instances --region us-east-1 --output text --query=AutoScalingInstances[].AutoScalingGroupName --instance-ids=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) |