Skip to content

Instantly share code, notes, and snippets.

@shenxgan
shenxgan / x.md
Created September 13, 2017 01:58
shell 字符串和变量组成新的变量
eval DEPLOY_PRODUCTION=\$${CURRENT}_PRODUCTION
eval DEPLOY_FASTCGI_PORT=(\${${CURRENT}_FASTCGI_PORT[@]})    
@shenxgan
shenxgan / mvln.sh
Created September 13, 2017 01:33
批量移动目录并建立软链接
#!/bin/bash
# 此脚本用来移动clean数据并建立软链接
export LANG="en_US.UTF-8"
# 路径
src="/data1"
dst="/data2"
@shenxgan
shenxgan / script_bat.sh
Last active September 13, 2017 01:38
批量运行py脚本,参数为时间
#!/bin/bash
# 此脚本用来批量执行分析或统计脚本
function usage() {
cat << EOF
Usage: $0 script begin [end]
script 要进行批处理的脚本,应该在当前路径下
begin, end 参数是日期字符串格式,示例:2015-10-01
@shenxgan
shenxgan / get_geocodes.py
Last active October 24, 2017 14:53
geopy 的使用
from geopy.geocoders import Nominatim
def get_geocodes(self, names):
if not isinstance(names, (list, tuple)):
names = [names]
geocodes = []
geolocator = Nominatim(country_bias='cn')
for name in names:
location = geolocator.geocode(name)
geocodes.append([location.longitude, location.latitude])
@shenxgan
shenxgan / ngrok-selfhosting-setup.md
Last active November 18, 2016 08:16 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems