Skip to content

Instantly share code, notes, and snippets.

@qnnnnez
qnnnnez / fakeuwp.html
Created March 4, 2017 03:58
模仿 UWP 磁贴的 3D 效果风格
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Fake UWP</title>
<style>
#viewport
{
@qnnnnez
qnnnnez / main.cpp
Created March 18, 2017 06:27
全组合 in C++
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int combinations(int n, int k)
{
int result = 1;
@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):
@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 / 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 / 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 / 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;
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 / assignment1.markdown
Created March 24, 2018 11:19
SRE 第一次作业

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

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

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

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

完成之后提交你的 Dockerfilesre.homework@outlook.com

@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?*