Skip to content

Instantly share code, notes, and snippets.

@tarivs
tarivs / install-redis.sh
Created March 5, 2016 16:22 — forked from FUT/install-redis.sh
Install Redis on EC2
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
/etc/localtime
sudo yum -y install gcc make
2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download)
@tarivs
tarivs / 301 Redirect in Nginx
Last active May 31, 2016 10:45
301 Redirect in Nginx
实现301跳转
server {
listen 80;
server_name example.org;
return 301 $scheme://$host$request_uri;
}
其中以下为nginx全局变量:
$scheme : HTTP方法,如http,https;
$host : 请求主机头字段,否则为服务器名称;
$request_uri : 包含请求参数的原始URI,不包含主机名,如:”/foo/bar.php?arg=abc”;
@tarivs
tarivs / using multiple remote locations with Git.md
Created May 31, 2016 13:21
using multiple remote locations with Git

操作系统:windows10 将同一项目通过ssh提交到github.com 和 coding.net

Part 1 添加多个ssh

生成ssh公钥

ssh-keygen -t rsa -b 4096 -C "[email protected]"  -f  ~/.ssh/id_rsa_coding

ssh-keygen -t rsa -b 4096 -C "[email protected]" -f ~/.ssh/id_rsa_github

@tarivs
tarivs / Deploy your own git server in ten minutes.md
Last active March 12, 2017 11:47
Deploy your own git server in ten minutes

十分钟部署自己的git服务器

本教材适用于Ubuntu,Debian,Centos等大部分Linux By Tarivs

安装dockers

利用daocloud的安装脚本一键完成docker安装,详见https://get.daocloud.io/

curl -sSL https://get.daocloud.io/docker | sh
#!/usr/bin/python
# Ref: https://askubuntu.com/questions/219609/how-do-i-show-active-dhcp-leases
# /var/lib/dhcp/dhcpd.leases
import datetime, bisect
def parse_timestamp(raw_str):
tokens = raw_str.split()
if len(tokens) == 1:
if tokens[0].lower() == 'never':
@tarivs
tarivs / address.md
Created July 11, 2019 07:30
收件人地址清洗
@tarivs
tarivs / python_package_source_configure.md
Created August 6, 2019 06:44
python_package_source_configure
package com.data;
public interface Animal {
public String getName();
}
/**/
class Cat implements Animal {