Skip to content

Instantly share code, notes, and snippets.

package main
import (
"crypto/tls"
"flag"
"io"
"log"
"net"
"net/http"
"net/http/httputil"
@rampageX
rampageX / block_bittorrent.sh
Created November 5, 2019 18:47
iptables block bittorrent
# Block Torrent algo string using Boyer-Moore (bm)
iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce" -j DROP
iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP
iptables -A FORWARD -m string --algo bm --string "/default.ida?" -j DROP
@rampageX
rampageX / iperf.sh
Created April 30, 2019 09:37 — forked from Mygod/iperf.sh
Bandwidth test for shadowsocks
#!/bin/bash
number=$1
method=$2
ss-tunnel -k test -m $method -l 8387 -L 127.0.0.1:8388 -s 127.0.0.1 -p 8389 &
ss_tunnel_pid=$!
ss-server -k test -m $method -s 127.0.0.1 -p 8389 &
ss_server_pid=$!
@rampageX
rampageX / web-servers.md
Created April 10, 2019 07:43 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rampageX
rampageX / gen_Corefile.sh
Last active March 24, 2020 03:09 — forked from missdeer/gen_Corefile.sh
generate Corefile which uses your ISP's DNS servers to resolve domain names in China and uses OpenDNS/Cloudflare/Google DNS servers to resolve domain names outside China for CoreDNS. You should change 116.228.111.118 180.168.255.18 to your ISP's DNS server address or use public DNS server such as 114/DNSPod etc. directly.
#!/bin/bash
echo ". {" > Corefile
echo " forward . 208.67.222.222:443 208.67.222.222:5353 208.67.220.220:443 208.67.220.220:5353 127.0.0.1:5301 127.0.0.1:5302 127.0.0.1:5303 {" >> Corefile
china=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
apple=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
google=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
echo " except $china $apple $google" >> Corefile
echo " }" >> Corefile
echo " proxy . 116.228.111.118 180.168.255.18" >> Corefile
echo " log" >> Corefile
@rampageX
rampageX / openssl_configure.md
Created February 17, 2019 02:52
OpenSSL configure options

Deprecated - Use LibreSSL Portable instead

OpenSSL Configure Options (1.0.1e)

Standard party line

Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...]
                 [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw]
                 [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm]

[no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]

@rampageX
rampageX / distcc-ccache-setup.sh
Last active March 17, 2020 03:00 — forked from codatory/distcc-ccache-setup.sh
Ubuntu distcc & ccache setup script
#!/bin/bash
apt-get install -y distcc distcc-pump ccache
sed -ie 's/STARTDISTCC="false"/STARTDISTCC="true"/' /etc/default/distcc
sed -ie 's/ALLOWEDNETS="127.0.0.1"/ALLOWEDNETS="192.168.0.0\/16 172.16.0.0\/12 10.0.0.0\/8"/' /etc/default/distcc
sed -ie 's/LISTENER="127.0.0.1"/LISTENER="0.0.0.0"/' /etc/default/distcc
sed -ie "s/JOBS=\"\"/JOBS=\"`grep processor /proc/cpuinfo | wc -l`\"/" /etc/default/distcc
sed -ie 's/ZEROCONF="false"/ZEROCONF="true"/' /etc/default/distcc
#PATH here? https://midnightyell.wordpress.com/2012/10/14/a-good-compromise-cross-compiling-with-distcc/
@rampageX
rampageX / Shadowsocks_With_V2Ray.md
Created February 9, 2019 11:30
Install Shadowsocks With V2Ray Manually

Installing Packages

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean && sudo apt-get install build-essential haveged -y
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install curl -y
sudo apt-get install shadowsocks-libev -y
sudo apt-get install cron -y
sudo apt-get install screen -y

Install V2Ray

@rampageX
rampageX / index.php
Created December 2, 2018 06:42 — forked from oriolrivera/index.php
Simple Chat Using WebSocket and PHP Socket
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<style type="text/css">
<!--
.chat_wrapper {
width: 500px;
margin-right: auto;
margin-left: auto;