Skip to content

Instantly share code, notes, and snippets.

View yanyaoer's full-sized avatar

yanyaoer yanyaoer

View GitHub Profile
@chaosong
chaosong / auth_callback.lua
Last active February 10, 2022 12:44
sso in nginx (by openresty)
local cjson = require('cjson')
local util = require('login_util')
if ngx.var.request_method ~= 'POST' then
ngx.log(ngx.WARN, 'request method is not post')
ngx.exit(400)
end
ngx.req.read_body()
local args = ngx.req.get_post_args()
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@messense
messense / proxy.pac
Last active December 17, 2015 09:39
pac file
/**
* GenPAC 0.2.1 http://jeeker.net/projects/genpac/
* Generated: Fri, 17 May 2013 14:15:55 GMT
* GFWList Last-Modified: Fri, 17 May 2013 12:41:31 GMT
*/
// proxy
var P = "PROXY 192.168.1.1:8118; DIRECT";
// user rules
@bootandy
bootandy / python_logging.yaml
Last active August 26, 2021 07:14
Sample logging config file for python logging module
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes
version: 1
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
detail:
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s'
@onlytiancai
onlytiancai / python_infrastructure.md
Created October 12, 2012 08:55
python 基础设施讨论贴

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

@uchida
uchida / dlclt.py
Created August 31, 2012 22:22
CUI Downloader of Command Line Tools for Xcode
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CUI Downloader of "Command Line Tools for Xcode"
# by Akihiro Uchida, CC0 dedicated to the public domain
# see http://creativecommons.org/publicdomain/zero/1.0/
import sys, os
import urllib, urllib2, cookielib
from getpass import getpass
from HTMLParser import HTMLParser
@xinz
xinz / haproxy.conf
Created July 9, 2012 10:39
a simple HAProxy configure for the websocket
global
log 127.0.0.1 local0 info
maxconn 5000
ulimit-n 10000
defaults
log global
mode http
frontend pub-srv 0.0.0.0:8080
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dndx
dndx / xiami_decode.py
Created April 29, 2012 14:42
Xiami URL Decoder
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
@lotem
lotem / alternative.yaml
Created April 8, 2012 03:44
Rime 別樣設定,使用西文標點、[ ] 鍵換頁
# Rime alternative settings
# encoding: utf-8
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
# (Linux) ~/.config/ibus/rime/alternative.yaml
# (Mac OS) ~/Library/Rime/alternative.yaml