Skip to content

Instantly share code, notes, and snippets.

View orangle's full-sized avatar
🎯
Focusing

orangleliu orangle

🎯
Focusing
View GitHub Profile
@orangle
orangle / git_log
Last active March 24, 2017 09:50
git
lzz@ubuntu:~/gitTest$ git config --global user.name 'orangle'
lzz@ubuntu:~/gitTest$ git config --global user.email 'liuzhizhi123@126.com'
lzz@ubuntu:~/gitTest$ get init
lzz@ubuntu:~/gitTest$ git add .
lzz@ubuntu:~/gitTest$ git commit
lzz@ubuntu:~/gitTest$ git diff
lzz@ubuntu:~/gitTest$ git status
lzz@ubuntu:~/gitTest$ git add first.txt
lzz@ubuntu:~/gitTest$ git commit
lzz@ubuntu:~/gitTest$ git log
@orangle
orangle / random_weight.py
Created October 11, 2014 09:43
基于权重的随机数2种实现方式
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#python2.7x
#random_weight.py
#author: orangleliu@gmail.com 2014-10-11
'''
每个元素都有权重,然后根据权重随机取值
输入 {"A":2, "B":2, "C":4, "D":10, "E": 20}
@orangle
orangle / py_clean.bat
Created November 6, 2014 06:29
删除项目的svn文件,递归删除(目录删除)| python项目编译成.pyc文件之后,把项目中的.py删除(递归删除文件)
@echo on
color 2f
mode con: cols=80 lines=25
@REM
@echo start to clean all .py files in current directory and children directories
@rem for /r . %%a in (.) do @if exist "%%a\*.py" @echo "%%a\*.py"
@for /r . %%a in (.) do @if exist "%%a\*.py" del /a /f /s "%%a\*.py"
@echo 清理完毕!
@pause
@orangle
orangle / psutiltest.py
Created December 12, 2014 03:20
psutil use
#-*- coding: utf-8 -*-
#python2.7x
#author: orangleliu@gmail.com 2014-12-12
#psutiltest.py
'''
照着教程简单学习下psutil的使用,windows下试试
'''
import psutil
import datetime
@orangle
orangle / alipayServer.py
Created December 17, 2014 06:39
支付宝即时到账服务器模拟
#-*- coding: utf-8 -*-
#python2.7x
#author: orangleliu@gmail.com 2014-12-16
#alipayServer
'''
模拟接收支付宝充值请求和返回交易信息处理
'''
import hashlib
import threading
import urllib, urllib2
@orangle
orangle / models.py
Last active March 27, 2017 09:07
图片处理代码
# -*- encoding=utf-8 -*-
import os
from time import time
from tempfile import NamedTemporaryFile
try:
from PIL import Image
except ImportError:
import Image
from settings import MEDIA_ROOT
@orangle
orangle / counting_nginx.py
Last active July 15, 2016 14:22
使用nginx post_action参数来统计文件下载情况,从而统计用户下载文件完整性
#!/usr/bin/python
#-*- coding:utf-8 -*-
############################
#File Name: counting_file.py
#Author: orangleliu
#Mail: orangleliu@gmail.com
#Created Time: 2015-03-11 16:41:05
#License: MIT
############################
'''
@orangle
orangle / uwsgi.sh
Created April 3, 2015 09:10
用到的运维脚本
#! /bin/sh
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin
CONFIGURE=uwsgi.ini
PID_FILE=/var/portal/uwsgi.pid
case "$@" in
start)
uwsgi --ini $CONFIGURE
echo "start uwsgi ok.."
@orangle
orangle / runinenv.sh
Last active August 29, 2015 14:19 — forked from parente/runinenv.sh
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@orangle
orangle / filemoniter.sh
Created May 12, 2015 08:09
监控配置文件变化,并且执行对应的操作。 monitoring file changed, and do some action
#!/bin/bash
#author: orangleliu@gmail.com
#use this shell script with cron
file=/home/ftp/rulebase/rules.list
md5checkfile=/tmp/rulebase.md5
if [ ! -f $file ]
then
echo "$file not exist .."
exit 1