Skip to content

Instantly share code, notes, and snippets.

@cute
cute / tun-ping-linux.py
Created January 8, 2016 10:05 — forked from glacjay/tun-ping-linux.py
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2

原文

警告:请务必读完本文!全篇读完!

无论新老用户,都有可能掉进陷阱。 下面我们列出了常见的问题,并解释如何解决他们。 在 Freenode IRC 的 #nginx 频道,我们经常看到这些问题。

[TOC]

@cute
cute / surge.conf
Created January 24, 2016 11:37 — forked from Zhiw/surge.conf
surge.conf for surge
[General]
# warning, notify, info, verbose
loglevel = notify
bypass-system = true
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local, e.crashlynatics.com
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 1
@cute
cute / gist:c4f3089da4a28867c659
Created February 17, 2016 01:36 — forked from Liqianyu/bestroutetb
bestroutetb china route UPDATE:2016-2-15
0.0.0.0/254.0.0.0
14.0.0.0/255.0.0.0
14.0.0.0/255.255.248.0
14.0.12.0/255.255.252.0
14.1.0.0/255.255.252.0
14.192.60.0/255.255.252.0
14.192.64.0/255.255.224.0
27.0.0.0/255.192.0.0
27.50.40.0/255.255.248.0
27.98.208.0/255.255.240.0
{
"name": "libsodium",
"version": "1.0.10",
"license": {
"type": "BSD",
"text": "Copyright © 2013\\nFrank Denis <j at pureftpd dot org>\\n\\nPermission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\\n\\n"
},
"homepage": "https://github.com/jedisct1/libsodium",
"authors": {
"Frank Dennis": "j@pureftpd.org"
@cute
cute / ss-install.md
Created May 3, 2016 08:31 — forked from aa65535/ss-install.md
shadowsocks-libev install at Debian or CentOS

Debian

cd /tmp
# 下载源码
git clone https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
cd shadowsocks-libev
./autogen.sh
./configure --prefix=/usr && make
make install
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@cute
cute / async_dns.c
Created August 21, 2016 08:09 — forked from mopemope/async_dns.c
c-ares example
#include <ares.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
@cute
cute / libevent.podspec
Created August 25, 2016 03:52 — forked from dpassage/libevent.podspec
podspec for libevent
Pod::Spec.new do |s|
s.name = "libevent"
s.version = "2.1.5-beta"
s.summary = "An event notification library."
s.description = <<-DESC
The libevent API provides a mechanism to execute a callback function when a
specific event occurs on a file descriptor or after a timeout has been reached.
@cute
cute / README.md
Created September 10, 2016 07:46 — forked from bomberstudios/README.md
Loading a Cocoa Framework in a Sketch Plugin

This is what Craft does:

function loadFramework(pluginRoot) {
  if (NSClassFromString('PanelsManager') == null) {
    var mocha = [Mocha sharedRuntime];
    return [mocha loadFrameworkWithName:'Panels' inDirectory:pluginRoot];
  } else {
    return true;
 }