Skip to content

Instantly share code, notes, and snippets.

View laozhu's full-sized avatar
👨‍💻
Coding ideas

Ritchie Zhu laozhu

👨‍💻
Coding ideas
View GitHub Profile
@laozhu
laozhu / GSWD.md
Last active December 14, 2015 05:59
getting started with django cookbook

Upgrade the system

sudo nano /etc/apt/source.list
sudo apt-get update
sudo apt-get upgrade

Do some cleans

sudo apt-get clean

sudo apt-get autoclean

@laozhu
laozhu / regexp.md
Last active December 14, 2015 05:28
正则表达式匹配模式

电子邮件

Javascript Version

/^[\w\.\-]+@([\w\-]+\.)+[A-z]{2-6}$/

Python Version

(\b[\w.-]+@([\w-]+.)+[A-z]{2,6}\b)

@laozhu
laozhu / gist:4722314
Created February 6, 2013 12:45
当没法卸载device时候,加上 `-l` 参数就可以了
umount -l /mnt/funtoo
@laozhu
laozhu / gist:4721630
Created February 6, 2013 10:13
menu editor
sudo apt-get install alacarte
@laozhu
laozhu / gist:4679062
Last active December 11, 2015 23:48
verify a PNG file and get image dimensions
#!/usr/bin/env python
import struct
def get_image_info(data):
if is_png(data):
w, h = struct.unpack('>LL', data[16:24])
width = int(w)
height = int(h)
@laozhu
laozhu / gist:4500892
Created January 10, 2013 10:01
通过Javascript和Email地址获取特定大小的Gavatar头像
$(document).ready(function(){
var MD5 = function (string) {
function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}
function AddUnsigned(lX,lY) {
var lX4,lY4,lX8,lY8,lResult;
@laozhu
laozhu / gist:4471752
Last active October 21, 2016 23:14
# -*- coding: utf-8 -*-
from lxml import etree
from bottle import Bottle, run, request
import sae
app = Bottle()
"""
此处省略若干行
"""
@laozhu
laozhu / gist:3850695
Last active October 11, 2015 11:18
nginx conf file phpmyadmin
server {
listen 80;
server_name sql.laozhu.me;
location / {
root /home/laozhu/www/phpmyadmin;
index index.php;
try_files $uri $uri/ /index.php;
}
@laozhu
laozhu / gist:3850686
Created October 8, 2012 04:17
install phpmyadmin
mkdir www/phpmyadmin
cd www/phpmyadmin
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.2/phpMyAdmin-3.5.2-all-languages.tar.bz2
tar jxvf phpMyAdmin-3.5.2-all-languages.tar.bz2
@laozhu
laozhu / gist:3850586
Created October 8, 2012 03:31
nginx conf file
server {
listen 80;
server_name www.laozhu.me laozhu.me;
client_max_body_size 512M;
if ($http_host !~ 'www.laozhu.me') {
rewrite ^/(.*)$ http://www.laozhu.me/$1 permanent;
}
location / {