Skip to content

Instantly share code, notes, and snippets.

View tossmilestone's full-sized avatar
:octocat:
Coding life

Shaw Ho tossmilestone

:octocat:
Coding life
  • Alauda
  • Nanjing, China
View GitHub Profile
@tossmilestone
tossmilestone / SimpleHTTPServerWithUpload.py
Created March 10, 2022 04:03 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@tossmilestone
tossmilestone / Certificates.go
Created January 8, 2020 02:17 — forked from Mattemagikern/Certificates.go
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@tossmilestone
tossmilestone / python.rb
Last active January 6, 2020 17:04 — forked from SamuelMarks/python.rb
python 3.6.8 brew formula
class Python < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz"
sha256 "35446241e995773b1bed7d196f4b624dadcadc8429f26282e756b2fb8a351193"
revision 1
bottle do
sha256 "1bc5a2d3f0a8602bf2f46de7c43fcb6dde4f110c0f4518d4e802cb1f733a43de" => :high_sierra
sha256 "131d39120ac6ca2f21bf231de7414c08916cea472bc5219e0bcb49541f77cb9f" => :sierra

##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 可用,但端口一致,就设置这个
@tossmilestone
tossmilestone / .cvimrc
Last active January 20, 2017 01:32 — forked from calorie/.cvimrc
.cvimrc
set nocncpcompletion
set nosmoothscroll
set nohud
set noregex
set noinsertmappings
set noautoupdategist
set nochangelog
set typelinkhints
set defaultnewtabpage
let scrollduration = 10
@tossmilestone
tossmilestone / kisscli.py
Created April 26, 2016 07:37 — forked from jpic/kisscli.py
Non blocking GNU readline usage example for python, proof of concept
import sys
from select import select
import socket
import readline
# HACK - python doesn't include a binding to rl_callback_read_char
import readline
import ctypes
rl_lib = ctypes.cdll.LoadLibrary("libreadline.so")
/*
* Scaffolding
* Basic and global styles for generating a grid system, structural layout, and page templates
* ------------------------------------------------------------------------------------------- */
.container
Sets a width of 940px which also centres the content (clears floated elements before/after)
.container-fluid
Sets a minimum width of 940px (clears floated elements before/after)
@tossmilestone
tossmilestone / uri.js
Created February 27, 2014 04:29 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"