Skip to content

Instantly share code, notes, and snippets.

View able8's full-sized avatar

Able Lv able8

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 可用,但端口一致,就设置这个
@YoshihitoAso
YoshihitoAso / gist:9248476
Created February 27, 2014 11:31
[Python][PyQuery]pyqueryでスクレイピングを行うサンプル(毎日新聞のアーカイブ)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyquery import PyQuery
import json
q = PyQuery(url='http://mainichi.jp/select/biz/archive/')
url = 'http://mainichi.jp/select/news/'
links = []
@YoshihitoAso
YoshihitoAso / jma_temp.py
Created February 27, 2014 11:39
[Python][PyQuery]pyqueryでスクレイピングを行うサンプル(気象庁:過去の気温データ)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyquery import PyQuery as pq
def main():
# 気象庁 東京 2014年1月データ
url = ('http://www.data.jma.go.jp/obd/stats/etrn/view/daily_s1.php?'
'prec_no=44&block_no=47662&year=2014&month=1&day=&view=')
# pyquery
query = pq(url, parser='html')

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active February 21, 2025 08:33
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@Glutexo
Glutexo / current-date-and-time.applescript
Created September 14, 2014 12:48
AppleScript to get current date and time (YYYY-MM-DD HH:MM:SS). Usable as a Text Service in Mac OS X.
(*
The zero_pad function taken from:
http://www.nineboxes.net/2009/10/an-applescript-function-to-zero-pad-integers/
*)
on zero_pad(value, string_length)
set string_zeroes to ""
set digits_to_pad to string_length - (length of (value as string))
if digits_to_pad > 0 then
repeat digits_to_pad times
set string_zeroes to string_zeroes & "0" as string
from pyquery import PyQuery as pq
from multiprocessing.dummy import Pool as ThreadPool
import urllib
class Download():
def __init__(self, ext, url):
self.ext = ext
self.url = url
def getlinks(self):
# @return list of files
@metal3d
metal3d / gh_latest.go
Last active October 16, 2024 07:41
Go client to github to get latest release and assets for a given repository
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@pyllyukko
pyllyukko / rc4.sh
Created May 16, 2015 11:04
RC4 stream cipher algorithm written in Bash
#!/bin/bash
################################################################################
# file: rc4.sh
# created: 15-05-2011
# modified: 2014 Sep 04
#
# https://secure.wikimedia.org/wikipedia/en/wiki/RC4
#
# NOTES:
# - ord() & chr() from http://mywiki.wooledge.org/BashFAQ/071
@bogdanr
bogdanr / squid.conf
Created May 25, 2015 06:52
Squid.conf SSL transparent proxy
visible_hostname vm-gateway
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.10.10.0/24
acl localnet src 127.0.0.1