Skip to content

Instantly share code, notes, and snippets.

#include "common.h"
#include <boost/asio.hpp>
#include <sstream>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/posix_time/posix_time_io.hpp>
using handler_t = std::function<std::string(std::string)>;
int main() {
using boost::asio::ip::tcp;
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
font-family: 'Segoe UI', 'Microsoft Yahei UI', Tahoma, Geneva, Verdana, sans-serif
}
<html>
<head>
<title></title>
<meta charset="UTF-8">
<style>
body {
background: gray;
}
.transform {
#!/bin/bash
# Use ss-redir to proxy all tcp connections.
RED='\033[0;31m'
NC='\033[0m'
# Options for ss-redir.
SERVER="233.com.cn"
PORT=""
METHOD="chacha20"
@ntzyz
ntzyz / makeUserName.sh
Created January 11, 2017 07:56
Generate PAP/CHAP user name for CMCC PPPoE server.
#!/bin/zsh
uuid=`uuidgen -t`
text1=`echo $uuid | sed "s/-//g"`
text2="YourPhoneNumberHere"
number=0
for ((i=0;i<3;++i)); do;
number=$((number + $(printf '%d ' "'${text1:$i:1}")))
done

Keybase proof

I hereby claim:

  • I am ntzyz on github.
  • I am ntzyz (https://keybase.io/ntzyz) on keybase.
  • I have a public key whose fingerprint is 076B 4791 4159 B7F1 B1D8 7889 81DE 95E6 61E8 1565

To claim this, I am signing this object:

@ntzyz
ntzyz / nat.sh
Last active December 31, 2016 12:28
#!/bin/bash
# Interfaces
WAN=ens38
LAN=ens33
# Source IP, destination IP and LAN subnet
WAN_IP=`ip -4 addr show $WAN | grep -P '\d+?\.\d+?\.\d+?\.\d+' -o | head -n 1`
LAN_DEST=10.0.0.2
LAN_SUBNET=10.0.0.0/24
function start() {
window.max = 0;
window.ntzyz = setInterval(() => {
window.max = Math.max(document.getElementsByClassName('bilibili-player-video-danmaku')[0].childElementCount,window.max);
}, 100);
}
function stop() {
console.log(`最大同屏弹幕数:${window.max}`);
clearInterval(window.ntzyz);
@ntzyz
ntzyz / tmp.js
Last active October 19, 2016 10:23
var findMinHeightTrees = function(n, edges) {
'use strict';
let nodes = new Array(n).fill(0).map(() => {
return {
nexts: [],
distance: [],
}
});
'use strict';
const request = require('request');
const fs = require('fs');
function download(list, offset) {
console.log(`Now downloading ${list[offset]}...`);
request(list[offset])
.on('response', res => {
if (++offset == list.length) {