Skip to content

Instantly share code, notes, and snippets.

View orangle's full-sized avatar
🎯
Focusing

orangleliu orangle

🎯
Focusing
View GitHub Profile
@orangle
orangle / asyncio_1000_benckmark.py
Last active April 16, 2024 14:13
Python Multithreading Consumption and Efficiency Issues
import asyncio
import aiohttp
import time
async def make_request(session, qty_req, req_n):
url = "http://10.86.36.223:8080"
for idx in range(qty_req):
async with session.get(url) as resp:
if resp.status == 200:
await resp.text()
@orangle
orangle / ttcp.py
Last active June 29, 2017 06:29
simple ttcp tool, write in python2.7
# coding:utf-8
"""
orangleliu@gmail.com
package A : pack num, pack length
package B : pack lenght, pack payload
Client Send pA, get ack, then send pB, Server give ack
python ttcp.py server
@orangle
orangle / post-commit
Created November 7, 2016 09:31
BearyChat SVN hook,svn commit 自动提交叫bc的web hooks
#!/bin/bash
export LANG='zh_CN.UTF-8'
# bearychat svn
# Requires Curl and Subversion Server installed.
# Put this file as "post-commit" with 755 permissions on the hooks directory of your repo
REPO_PATH=$1
REV=$2
LOOK=/usr/bin/svnlook
@orangle
orangle / example.py
Created April 24, 2016 07:20 — forked from beenje/example.py
Twisted gateway
import json
import time
from twisted.internet import defer
from twisted.internet.protocol import ServerFactory
from twisted.protocols.basic import LineReceiver
from twisted.python import log
class BasicProtocol(LineReceiver):
@orangle
orangle / gist:ecec23e8e7afb8ee1aa5
Created February 25, 2016 05:28 — forked from lucifr/gist:1208100
Sublime Text 2 - 实用快捷键 (Mac OS X)
@orangle
orangle / nginx.conf
Created January 21, 2016 07:44 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
import socket
import sys
import time
import struct
host = 'localhost'
port = 8888
buffersize = 1024
N = 1000000
server_address = (host, port)
@orangle
orangle / crypto_test.py
Created September 10, 2015 02:53
AES in CBC mode Pydes vs crypto
#coding=utf-8
#filename crypto_test.py
#author: orangleliu
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
class AESCipher(object):
@orangle
orangle / punch.py
Last active August 29, 2015 14:26 — forked from koenbollen/punch.py
Proof of Concept: UDP Hole Punching
#!/usr/bin/env python
#
# Proof of Concept: UDP Hole Punching
# Two client connect to a server and get redirected to each other.
#
# This is the client.
#
# Koen Bollen <meneer koenbollen nl>
# 2010 GPL
#
@orangle
orangle / back_table_recods.py
Last active August 29, 2015 14:22
Some python scripts help me manage my linux server.
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#python2.7x
#authror: zhizhi.liu
#备份radius中的上网记录表,每个月备份一次,原始表中保留一份数据
#使用同一个数据库中的一个不同表名的表备份
import time
import datetime
import logging