Skip to content

Instantly share code, notes, and snippets.

View krast's full-sized avatar
🇨🇳
I may be slow to respond.

Krast krast

🇨🇳
I may be slow to respond.
View GitHub Profile
@krast
krast / 0_reuse_code.js
Created May 4, 2016 05:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@krast
krast / create-centos-7.2-mini-unattended-iso.sh
Created November 16, 2016 15:25 — forked from skiane/create-centos-7.2-mini-unattended-iso.sh
create-centos-7.2-mini-unattended-iso.sh
# This script create a Centos Minimal Unattended ISO
# This method is based on excellent article http://pyxlmap.net/technology/software/linux/custom-centos-iso
#
# This script has be tested with CentOS 7.2 (on the orign server) to install CentOS 7.2 (on the target server)
# TODO:
# * test package update to reduce the update task on the target system. The following command downloads all updates :
# (cd $CENTOS_CUSTOM_PATH/Packages ; yumdownloader $(for i in *; { echo ${i%%-[0-9]*}; } ) )
# Some global settings :
@krast
krast / haproxy.cfg
Created November 29, 2016 16:39 — forked from meineerde/haproxy.cfg
HAProxy: Route requests based on an environment variable
frontend http
bind 10.0.0.1:80
mode http
# Add a new header with the environment variable and the path concatenated
http-request set-header X-ROUTING %[env(SERVER_AUTH)]::%[path]
# Then compare the value using a regular expression with back-references
# We need to use a named capture because of "reasons". Backreferences to normal captures seem to be rejected by HAProxy
use_backend app if { req.hdr(X-ROUTING) -m reg ^(?<auth>.+)==\1 }
# Cleanup in case we hadn't matched yet
@krast
krast / setup-taiga-centos.sh
Created January 23, 2017 03:25 — forked from sink66/setup-taiga-centos.sh
Taiga.io minimum install & run commands / CentOS7.2
#!/bin/bash
# How to use
# 1. Replace the "YOURIP" to yourIP
#sed -i -e 's/YOURIP/192.168.x.x/g' setup-taiga-centos.sh
# 2. Run at the root
#source setup-taiga-centos.sh
@krast
krast / ss-redir 透明代理.md
Created April 12, 2017 17:53 — forked from wen-long/ss-redir 透明代理.md
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 可用,但端口一致,就设置这个
@krast
krast / howto-setup-transparent-proxied-router.md
Created April 12, 2017 17:53 — forked from snakevil/howto-setup-transparent-proxied-router.md
如何在路由器中实现透明代理?

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

0 互联网现状

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

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

@krast
krast / shadowsocks-on-openwrt.md
Created April 14, 2017 01:23 — forked from crazygo/shadowsocks-on-openwrt.md
shadowsocks on openwrt

配置 shadowsocks

架设好 shadowsocks 服务端,在路由器上安装 shadowsocks 客户端,并配置 /etc/config/shadowsocks.json ,假设本地监听端口为 1080 。启动 shadowsocks

/etc/init.d/shadowsocks start

配置 privoxy

安装 privoxy openwrt 版。

#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
@krast
krast / Quiver_HTML_importer.py
Created September 13, 2018 07:04 — forked from kspeeckaert/Quiver_HTML_importer.py
Quiver HTML importer
import json
import uuid
from pathlib import Path
from urllib.parse import urlparse
from datetime import datetime
import html2text
import requests
from bs4 import BeautifulSoup