Skip to content

Instantly share code, notes, and snippets.

@qnnnnez
qnnnnez / cqooc.py
Last active November 26, 2019 09:16
cqooc.com Quick Learner
# config
username = '' # your username used to login
user_id = int() # should be a integer
courseId = ''
cookie_xsid = '' # find it in your browser after logging in
finish_time = '' # e.g. 20181222
parentId = ''
@qnnnnez
qnnnnez / generate.py
Created June 18, 2018 06:20
V2Ray geoip.dat and geosite.dat generation
import socket
import config_pb2
geoiplist = config_pb2.GeoIPList()
geoip = geoiplist.entry.add()
geoip.country_code = 'CN'
for l in open('china_ip_list.txt', 'r').readlines():
l = l.strip()
network, prefix = l.split('/')
@qnnnnez
qnnnnez / torrentz2-magnet.user.js
Created March 31, 2018 16:53
torrentz2.eu magnet link generator
// ==UserScript==
// @name Torrentz2 magnet link generator
// @namespace qnnnnez's namespace
// @version 0.1
// @description Generate magnet link from infohash and tracker list.
// @author qnnnnez
// @match https://torrentz2.eu/*
// @exclude https://torrentz2.eu
// @exclude https://torrentz2.eu/
// @exclude https://torrentz2.eu/search?*
@qnnnnez
qnnnnez / assignment1.markdown
Created March 24, 2018 11:19
SRE 第一次作业

写一个 Dockerfile,实现 shadowsocks-libev 服务容器化

任意选择一个基础镜像,从 https://github.com/shadowsocks/shadowsocks-libev 下载源码,编译成可以执行文件。

通过环境变量指定密码、加密方式,暴露服务端口。 用 ENTRYPOINT 指定 ss-server 的可执行文件,这样 docker run 的时候可以附加自定义参数。

可以自己加一些其他的实用功能。

完成之后提交你的 Dockerfile[email protected]

def foo(first, middle):
assert len(first) == len(middle) and set(first) == set(middle)
if len(first) == 0:
return None
if len(first) == 1:
return (first[0],)
root = first[0]
root_pos = middle.index(root)
middle_left = middle[:root_pos]
middle_right = middle[root_pos+1:]
@qnnnnez
qnnnnez / aioforwarder.cpp
Last active November 10, 2017 14:33
Port Forwarder built with boost::asio
#include <memory>
#include <functional>
#include <queue>
#include <iostream>
#include <boost/asio.hpp>
using boost::system::error_code;
using boost::asio::ip::tcp;
using boost::asio::mutable_buffer;
@qnnnnez
qnnnnez / fbi_upload.py
Last active September 6, 2017 17:37
python3 fbi_upload.py 3ds.hostname game.cia
#!/usr/bin/env python3
LISTEN_PORT = 10086
import tornado.ioloop
import tornado.web
import os
import socket
import struct
@qnnnnez
qnnnnez / domains2unbound.py
Created August 22, 2017 12:49
红岩AB区翻墙的一些脚本
from sys import stdin, stdout
domains = set()
for line in stdin:
line = line.strip()
if line.startswith('.'):
line = line[1:]
@qnnnnez
qnnnnez / gpg-agent-forward.sh
Created April 6, 2017 11:07 — forked from dtaylor84/gpg-agent-forward.sh
Cygwin GPG Agent Forwarding Script (for use with Gpg4Win 3, requires openssh and ssh-pageant)
#!/bin/bash -e
remote="$1@$2"
echo -ne '\e]0;wait... '"$remote"'\a'
eval $(/usr/bin/ssh-pageant -r -a "/tmp/.ssh-pageant-$USERNAME")
localdir="$(cygpath -u "$APPDATA")/gnupg"
extrasock="$localdir/S.gpg-agent.extra" # file containing "PORT\nNONCE"
rdir='$HOME/.gnupg' # remote prefix
rinsock="$rdir/S.gpg-agent" # listen on this socket on server
@qnnnnez
qnnnnez / natcp.py
Last active April 15, 2017 07:29
TCP 劫持
import asyncio
import socket
import struct
SO_ORIGINAL_DST = 80
class NATCPServerProtocol(asyncio.Protocol):
def connection_made(self, transport):