Skip to content

Instantly share code, notes, and snippets.

@scola
scola / alljava.py
Created March 26, 2018 05:00
get all java code to generate one txt
import os
import glob
def getalljava(folder):
for file in os.listdir(folder):
if os.path.isdir(os.path.join(folder, file)):
getalljava(os.path.join(folder, file))
elif file.endswith(".java") or file.endswith("java.txt"):
alljava.append(os.path.join(folder, file))
import thread
import time
def hello(name=''):
while 1:
time.sleep(2)
print "hello ", name
def main():
thread.start_new_thread(hello, ('bob',))
/*
* Commandline interface for proxy settings.
* This requires revision >= 4430 for subCommands.
*
* examples:
* - display current proxy type
* :proxy
* - do not use proxy
* :proxy direct
* - manual proxy configuration
@scola
scola / 00-README.txt
Last active August 29, 2015 14:15 — forked from klzgrad/00-README.txt
$ LD_PRELOAD=$PWD/sendmsg.so dig twitter.com @8.8.8.8
;; Warning: Message parser reports malformed message packet. <-- malformed 因为把压缩指针当作域名一部分了
;; Question section mismatch: got twitter.com/RESERVED0/CLASS256
; <<>> DiG 9.9.5-3-Ubuntu <<>> twitter.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44722
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
@scola
scola / mytweets.py
Last active August 29, 2015 14:09 — forked from tsileo/mytweets.py
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import requests
from requests_oauthlib import OAuth1
from urlparse import parse_qs
REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token"
AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize?oauth_token="
ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token"
@scola
scola / ieSetAutoProxyURL.cpp
Created October 1, 2014 03:25
set auto proxy url for IE or windows system proxy
#include "stdio.h"
#include "windows.h"
#include "wininet.h"
#pragma comment(lib, "wininet.lib")
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
LPWSTR *szArgList;
int argCount;
szArgList = CommandLineToArgvW(GetCommandLine(), &argCount);
@scola
scola / iptable-anti-dns-poison.sh
Created July 12, 2014 13:52
use iptables to anti-dns poison on linux or openwrt
#!/bin/bash
iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x1010101,0xffffffff,0x4a7d7f66,0x4a7d9b66,0x4a7d2766,0x4a7d2771,0xd155e58a,0x42442b2,0x807c62d,0x253d369e" -j DROP
iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x2e52ae44,0x3b1803ad,0x402158a1,0x4021632f,0x4042a3fb,0x4168cafc,0x41a0db71,0x422dfced,0x480ecd68,0x480ecd63" -j DROP
iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x4e10310f,0x5d2e0859,0x80797e8b,0x9f6a794b,0xa9840d67,0xc043c606,0xca6a0102,0xcab50755,0xcba1e6ab,0xcb620741" -j DROP
iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xcf0c5862,0xd0381f2b,0xd1913632,0xd1dc1eae,0xd1244921,0xd155e58a,0xd35e4293,0xd5a9fb23,0xd8ddbcb6,0xd8eab30d" -j DROP
iptables -I INPUT -p udp -m udp --sport 53 -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xf3b9bb03,0xf3b9bb27,0x807c62d,0xf3b9bb1e,0x9f1803ad
@scola
scola / network
Created January 24, 2014 13:32
openwrt pppoe config
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option type 'bridge'
option proto 'static'
@scola
scola / network
Created January 24, 2014 13:30
openwrt bridge to another route config file
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'ifname' 'eth0'
option 'type' 'bridge'
option 'proto' 'static'
@scola
scola / Makefile
Created January 22, 2014 14:33
Makefile for liboauth-openwrt
include $(TOPDIR)/rules.mk
PKG_NAME:=liboauth
PKG_VERSION:=0.9.7
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://sourceforge.net/projects/liboauth/files/
#PKG_MD5SUM:=9b7dc52656f5cbec846a7ba3299f73bd