Skip to content

Instantly share code, notes, and snippets.

View bearice's full-sized avatar
🐻

Bearice Ren bearice

🐻
View GitHub Profile
@bearice
bearice / A
Created June 22, 2016 09:52
run with "node --log_gc --trace_gc test.js" http://www.v2ex.com/t/287602
[34346:0x102800400] 1466588998869 ms: Mark-sweep 0.9 (37.1) -> 0.9 (37.1) MB, 1.3 / 0 ms [Logger::LogCodeObjects] [GC in old space requested].
[34346:0x102800400] 1466588998870 ms: Mark-sweep 0.9 (37.1) -> 0.9 (37.1) MB, 0.9 / 0 ms [Logger::LogCompiledFunctions] [GC in old space requested].
[34346:0x102800400] 11 ms: Scavenge 2.1 (37.1) -> 2.1 (37.1) MB, 0.9 / 0 ms [allocation failure].
[34346:0x102800400] 16 ms: Scavenge 2.2 (37.1) -> 2.2 (38.1) MB, 1.0 / 0 ms [allocation failure].
[34346:0x102800400] 125 ms: Scavenge 4.0 (41.1) -> 3.7 (41.1) MB, 1.1 / 0 ms [allocation failure].
[34346:0x102800400] 719 ms: Scavenge 5.1 (41.1) -> 4.5 (42.1) MB, 2.4 / 0 ms [allocation failure].
[34346:0x102800400] 1278 ms: Scavenge 5.7 (42.1) -> 5.1 (42.1) MB, 3.1 / 0 ms [allocation failure].
[34346:0x102800400] 2732 ms: Scavenge 8.4 (42.1) -> 6.8 (43.1) MB, 4.7 / 0 ms [allocation failure].
[34346:0x102800400] 3755 ms: Scavenge 9.1 (43.1) -> 8.0 (45.1) MB, 5.9 / 0 ms [allocation failure].
[343
a='q=String.fromCharCode(39);console.info("a=%s%s%s;eval(a)",q,a,q)';eval(a)
fs = require 'fs'
request = require 'request'
rp = require 'request-promise'
errors = require 'request-promise/errors'
JSONStream = require 'JSONStream'
http = require 'http'
cluster = require 'cluster'
http.globalAgent = new http.Agent
keepAlive: false
maxSockets: Infinity
#!/bin/bash
function get(){
echo "GET $1" >&2
curl -H"User-Agent: ADSL t\355 s\371 q\354/1.1 (iPad; iOS 7.1.1; Scale/2.00)" \
-H'Accept-Language: en;q=1, zh-Hans;q=0.9, fr;q=0.8, de;q=0.7, ja;q=0.6, nl;q=0.5' \
-s $1
}
vars=$(get 'http://bj.wokuan.cn/web/startenrequest.php' | perl -ne'print $1 if /((\w+=\w+\&)+\w+=\w+)/' | tr '&' "\n")
@bearice
bearice / gist:e2dd5d4245472e1b3992
Last active August 29, 2015 14:18
openssl bug
bearice@master ~%openssl x509 -text < r
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=JimuBox CA, O=Jimubox.com, OU=System Administrators, ST=Beijing, C=CN, L=Beijing/emailAddress=sa@jimubox.com
Validity
Not Before: Mar 20 03:29:19 2014 GMT
Not After : Mar 17 03:29:19 2024 GMT
公网机器:
ip tunnel add tunnel0 remote {对方内网地址} local {本机内网地址} mode ipip
ifconfig tunnel0 192.168.123.1/24
ifconfig tunnel0 up
iptables -t nat -A POSTROUTING -s 192.168.123.0/24 -j MASQUERADE
内网机器:
ip tunnel add tunnel0 remote {对方内网地址} local {本机内网地址} mode ipip
ifconfig tunnel0 192.168.123.2/24

DAEMONTOOLS: http://cr.yp.to/daemontools.html

安装

apt-get install daemontools-run

安装之后使用 nohup setsid svscanboot >/dev/null 2>&1 启动(只需要安装后第一次启动,以后会随着系统自动启动)

新建服务

@bearice
bearice / gist:8f87eb1f87bed8b3b4ee
Last active August 29, 2015 14:07
TCP TraceRoute of MITM attack on www.icloud.com
# captured packets ->https://www.cloudshark.org/captures/03a6b0593436
bearice@Bearice-Mac-Air-Haswell ~
%tcptraceroute 23.59.94.46 443 !26471 [9:23:19]
Selected device en0, address 192.168.100.16, port 52406 for outgoing packets
Tracing the path to 23.59.94.46 on TCP port 443 (https), 30 hops max
1 192.168.100.254 1.737 ms 0.793 ms 0.798 ms
2 111.192.144.1 2.893 ms 2.967 ms 2.422 ms
3 61.51.246.25 2.913 ms 2.893 ms 3.968 ms
4 124.65.61.157 4.824 ms 2.658 ms 3.902 ms
From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
From: Bearice Ren <bearice@icybear.net>
Date: Tue, 20 Sep 2016 11:52:08 +0800
Subject: [PATCH] add filter-aaaa option
---
src/dnsmasq.h | 3 ++-
src/option.c | 3 +++
src/rfc1035.c | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
_ = require 'underscore'
class Board
constructor: (@width=10,@height=10,@mine_count=10) ->
@cells = []
for i in [0..@width*@height-1]
@cells.push {x: i % @width, y: Math.floor(i / @width), c:'x', g:'x', b:false, v:false}
tmp = _.sample(@cells, @mine_count)
_.each tmp,(c) ->