Skip to content

Instantly share code, notes, and snippets.

View zheng1's full-sized avatar
👓
Mogician

Zhengyi Lai zheng1

👓
Mogician
View GitHub Profile
@ccloli
ccloli / 115-online-player.user.js
Last active May 3, 2024 06:37
115 Online Player
// ==UserScript==
// @name 115 Online Player
// @version 1.1.1
// @description Play videos from 115 online
// @match http://*.115.com/*
// @match http://*.115.com/*
// @author 8qwe24657913 | 864907600cc
// @run-at document-end
// @grant none
// @updateURL http://ext.ccloli.com/temporary/115-online-player.user.js
@snakevil
snakevil / howto-setup-transparent-proxied-router.md
Last active April 1, 2024 01:28
如何在路由器中实现透明代理?

如何在路由器中实现透明代理?

0 互联网现状

目前整个互联网环境,被破坏最严重地部分,是 Web 服务体验。当直接破坏难以实现时,就会从流程链的上下游着手,如:DNS 污染。

其它地互联网服务类型,例如:邮件,可能小部分会受到 Web 服务上下游破坏地余震,但整体上基本不受影响。

@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@sh2
sh2 / tpcc_load_parallel.sh
Created August 25, 2012 02:14
Parallel load script for tpcc-mysql
#!/bin/bash
# Configration
MYSQL=/usr/bin/mysql
TPCCLOAD=./tpcc_load
TABLESQL=./create_table.sql
CONSTRAINTSQL=./add_fkey_idx.sql
DEGREE=`getconf _NPROCESSORS_ONLN`
@jacaetevha
jacaetevha / login-hook.sh
Created June 3, 2012 03:37
Mac OS/X login/logout hooks to save login/logout information to a Mongo DB
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
MONGO="${MONGO:-/usr/local/bin/mongo}"
MONGO_USER='<mongo username>'
MONGO_PWD='<mongo password>'
MONGO_URL="<database server>:<port>/<database name>"
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@xjamundx
xjamundx / express-pagination.js
Created April 19, 2011 05:28
sample pagination using express route-specific middleware
// articles per page
var limit = 10;
// pagination middleware function sets some
// local view variables that any view can use
function pagination(req, res, next) {
var page = parseInt(req.params.page) || 1,
num = page * limit;
db.articles.count(function(err, total) {
res.local("total", total);
@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):