Skip to content

Instantly share code, notes, and snippets.

@andyliu
andyliu / backup.sh
Last active April 12, 2016 08:46
VPS backup
#!/bin/bash
# MYSQL数据库帐号密码
#MYSQL_USR="root" # 数据库帐号
#MYSQL_PWD="password" # 数据库密码
MAIL_TO=kdo@qq.com
# 定义需要备份的目录
NGINX_CONF_DIR=/usr/local/nginx/conf # nginx配置目录
WEB_DIR=/home/wwwroot # 网站数据存放目录
@andyliu
andyliu / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#! /bin/bash
#====================================================================
# vps_auto_backup.sh
#
# Copyright (c) 2011, WangYan <webmaster@wangyan.org>
# All rights reserved.
# Distributed under the GNU General Public License, version 3.0.
#
# vps automatic local and offsite backup shell cript
#
#encoding: utf-8
import requests
from pyquery import PyQuery as pq
agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
content_type = "applicationself.s.xsrf/x-www-form-urlencoded; charset=UTF-8"
class Sjtu:
def __init__(self,url):
self.host = url
@andyliu
andyliu / jandan.sh
Created September 15, 2013 14:55 — forked from cdfmr/jandan.sh
#!/bin/sh
delay=0
timeout=10
retry=2
usage()
{
echo "Usage: `basename $0` frompage topage"
exit 1

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@andyliu
andyliu / gist:6079743
Created July 25, 2013 13:42
测试下
hello world

What are your thoughts on the push against the open and free Internet that we have been seeing in the recent past and present (such as sopa, etc)?

There are two things this could reference. One is the free/pay for software mix. The Internet has benefited from having lots of free stuff and lots of commercial software. It has been interesting see people inventing hybrid models. Even stuff that is pretty commercial often has free versions for some audiences. Even the most open stuff often have services people choose to pay for.

The second thing is the anonymous versus identified tension. This is another one where both will probably thrive since you want anonymity for some things and full identity for others. I am surprised how little progress has been made in the identity space but it will improve.


*[What do people give you for your birthday, given that you can buy anything you want?](http:

@andyliu
andyliu / duoshuo
Created September 25, 2012 15:44 — forked from fddxyz/duoshuo
duoshuo sso auth class
<?php
//more info at:http://dev.duoshuo.com/threads/5023323ce9b7bde608000012
class duoshuo extends CI_Controller
{
public $short_name="";
public $secret ="";
public $remote_auth ="";
public $access_token ="";