Skip to content

Instantly share code, notes, and snippets.

View askdaddy's full-sized avatar

Seven Chan askdaddy

  • Internet
View GitHub Profile
@wen-long
wen-long / ss-redir 透明代理.md
Last active March 18, 2024 12:13
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
Game = require '../models/game'
game = null
sendGameUpdate = (game)->
process.send
type: 'game'
game: game.toJSON()
sendGameStop = (game)->
@Integralist
Integralist / GitHub curl.sh
Last active September 7, 2023 03:53 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@DavidWittman
DavidWittman / mongo-ansible.py
Last active April 18, 2023 18:16
MongoDB-backed dynamic inventory script for Ansible
#!/usr/bin/env python
#
# MongoDB-backed dynamic inventory script for Ansible
# http://docs.ansible.com/intro_dynamic_inventory.html
import os
from argparse import ArgumentParser
import pymongo
@romanov
romanov / gist:abc494ee7b08f232f539
Last active January 16, 2016 14:40
node-webkit debug on Windows via Powershell
# path to nw.exe
$nodePath = "d:\Projects\node-webkit-v0.9.2-win-ia32\nw.exe"
# release file path
$releaseFile = "d:\Projects\app.nw"
# path to the app project
$appFolder = "d:\Projects\nodeApp1\app"
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem
@shuax
shuax / decorator
Created July 2, 2014 06:07
lua decorator,类似python那样的装饰器
local function decorator(str)
local rebuild_str = {}
local rebuild_fun = "(\0)"
local state = 0
for line in str:gmatch('[^\r\n]+') do
if line:find("@") then
rebuild_fun = string.format("(%s"..rebuild_fun..")", line:sub(2))
state = 1
else
if state==0 or state==3 then
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /tmp/nginx_debug_error.log debug;
#pid logs/nginx.pid;
@hideki
hideki / Issue330Test
Created January 16, 2015 00:01
Sample code how to set custom SSLSocketFactory for Couchbase Lite Android/Java
package com.couchbase.lite;
import android.net.SSLCertificateSocketFactory;
import android.os.Build;
import android.test.AndroidTestCase;
import android.util.Log;
import com.couchbase.lite.android.AndroidContext;
import com.couchbase.lite.replicator.Replication;
import com.couchbase.lite.support.CouchbaseLiteHttpClientFactory;
--- git.js 2015-05-11 16:19:29.114852900 -0400
+++ git-patched.js 2015-05-11 16:19:35.788234600 -0400
@@ -12,14 +12,23 @@
, git = npm.config.get("git")
, assert = require("assert")
, log = require("npmlog")
+ , win32 = process.platform === "win32"
+ , cygwin = win32 && (process.env.ORIGINAL_PATH || '').indexOf('/cygdrive/') != -1
function prefixGitArgs () {
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection