Skip to content

Instantly share code, notes, and snippets.

@netwjx
netwjx / minify-bb8310-os45.bat
Created July 1, 2012 11:12
Minify bb8310 os4.5 rom
@echo off
set w="%cd%"
if "%1"=="" goto help
echo 操作目录 %1
cd "%1"
if errorlevel 1 goto error
echo 检查目录
cd Java
if errorlevel 1 goto error
echo 创建备份目录
@netwjx
netwjx / Validator.js
Created August 31, 2012 08:03
Validator.js
// 按键事件处理工具,直接调用将返回一个工具实例,e参数是event参数,对于ie是window.event,对于ff是callback的第一个参数
// 需要注意ie下keypress不会因Backspace Delete Home End 方向键而触发,但是会因Esc Enter键而触发keypress事件
// ff下始终会触发,这里charCode和keyChar也因此而起
function keyPressUtil(e) {
if (this instanceof arguments.callee) {
this.__event = e;
} else {
return new arguments.callee(e);
}
}
@netwjx
netwjx / PhoneNumber.java
Created October 18, 2012 03:41
使用BitSet排除重复的手机号码
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.BitSet;
public class PhoneNumber {
public static void main(String[] args) throws Exception {
@netwjx
netwjx / a.js
Last active December 16, 2015 12:19
sed多行内容替换
// many many codes
document.write('foo bar');
document.write('</div>');
// new code
var a = 'bar.js', stamp = +new Date() + '=';
document.write('<script id="foo" src="' + a + '?' + stamp + '"></script>');
// other code
document.write('<div> other text</div>');
@netwjx
netwjx / upload.sh
Created April 24, 2013 08:12
batch upload files through by ftp
#!/usr/bin/env bash
updir=.
todir=target/dir
excludes='
upload.sh
TODO.md
node_modules*
package.json
@netwjx
netwjx / .md
Last active December 17, 2015 01:49
use google better in china

in firefox

url: about:config, search keyword :

keyword.URL
https://www.google.com.hk/search?safe=strict&hl=zh-CN&site=webhp&source=hp&q=

in linux

searchplugins folders:

@netwjx
netwjx / autoproxy.md
Last active December 9, 2017 12:29
autoproxy rules

AutoProxy 代理规则

  • 查看
  • 修订版本

Posted in

  • AutoProxy
  • gfwList
  • Rule
@netwjx
netwjx / output
Created June 6, 2013 10:03
统计最近一段时间git版本库中代码提交量
git log '@{1 weeks ago}..HEAD' --shortstat --pretty=format:%an | awk '/.+/ {
if($2 != "file" && $3 != "changed,") {
curr = $1
} else {
files[curr]+=$1
inserts[curr]+=$4
deletes[curr]+=$6
}
}
END {
@netwjx
netwjx / git-last-change.fish
Created August 16, 2013 08:26
查找当前目录下所有git项目,并输出各自的最后修改时间
repos for i in (find . -type d -a -name .git -exec dirname '{}' \; | sed "s|./||"); echo $i; pushd $i; git log -1 --pretty=format:' %ci %s%n%n'; popd; end
@netwjx
netwjx / Minify.pm
Last active December 26, 2015 22:59 — forked from hjue/Minify.pm
看起来fork一份就可以修改了,貌似是新的了
package Minify;
use nginx;
use JavaScript::Minifier qw(minify);
sub handler {
my $r=shift;
my $cache_dir="/tmp";
my $cache_file=$r->uri;
$cache_file=~s!/!_!g;
$cache_file=$r->header_in("Host").$cache_file;