Skip to content

Instantly share code, notes, and snippets.

Ruqi liruqi

Block or report user

Report or block liruqi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
class LRUCache(collections.OrderedDict):
def __init__(self, capacity: int):
self.maxsize = capacity
def get(self, key: int) -> int:
if key in self:
value = super().__getitem__(key)
liruqi / extract-testflight.js
Created Oct 10, 2018 — forked from creaoy/extract-testflight.js
Extract TestFlight user email addresses from iTunes Connect
View extract-testflight.js
//Make sure you scroll down to get all data loaded
var text = '';
$('.col-email').each(function(index,el) {
if (index == 0) {
text = 'Email, First Name, Last Name\n';
else {
text = text + $.trim($(el).find("a").text()) + ',';
//First Name
liruqi /
Last active Aug 9, 2018
shadowsocks server setup
#Ubuntu 16.04
apt install -y python-pip
apt install -y libsodium-dev
pip install
liruqi / iptables.conf
Created Apr 11, 2018
iptables disable non-http(s) traffic
View iptables.conf
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
iptables -A FORWARD -p tcp -j REJECT --reject-with tcp-reset
liruqi /
Created Dec 18, 2017
Check expired domains
import socket
import pprint
import sys
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--input', default='')
parser.add_argument('--output', default='output.txt')
args = parser.parse_args()
liruqi / worker nginx conf
Created Nov 28, 2017 — forked from fqrouter/worker nginx conf
Youtube Reverse Proxy
View worker nginx conf
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $;
add_header Content-Disposition "attachment; filename=video.mp4;";
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;
liruqi /
Created Nov 27, 2017 — forked from nicktoumpelis/
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
import random
random.sample(range(1,201), 20)
liruqi / shadowsocks.cs
Last active Jun 1, 2017
shadowsocks uri
View shadowsocks.cs
public static readonly Regex
UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase),
DetailsParser = new Regex(@"^((?<method>.+?):(?<password>.*)@(?<hostname>.+?):(?<port>\d+?))$", RegexOptions.IgnoreCase);
liruqi / gist:c0d15fa2950864b61282700063278a9c
Created Mar 7, 2017 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gist:c0d15fa2950864b61282700063278a9c

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
You can’t perform that action at this time.