Skip to content

Instantly share code, notes, and snippets.

View ninozhang's full-sized avatar

nino ninozhang

  • WeiYi
  • Canton/GuangZhou
View GitHub Profile
@ninozhang
ninozhang / gist:5403131
Last active December 16, 2015 07:59
Java 获取指定字段的值
Field title = tip.getClass().getDeclaredField("title");
title.setAccessible(true);
System.out.println(title.get(tip));
@ninozhang
ninozhang / IPUtil.java
Created April 18, 2013 06:29
Java 获取本地 IP 地址
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import org.apache.log4j.Logger;
public abstract class IPUtil {
@ninozhang
ninozhang / node-http-upload-file.js
Created May 19, 2013 10:57
node-http-upload-file
/*
Expected Response:
{error: '',
msg: ' File Name: coolaj86-2010.jpg, File Size: 258472'
}
*/
(function () {
"use strict";
@ninozhang
ninozhang / download.js
Created May 22, 2013 10:01
download file by js.
var download = function (url) {
var iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.display = 'none';
document.body.appendChild(iframe);
};
#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 10, delay = 0.5 (seconds)"
exit 1
fi
pid=$1 # required
user=$2 # required
count=${3:-10} # defaults to 10 times
delay=${4:-0.5} # defaults to 0.5 seconds
@ninozhang
ninozhang / jmap.sh
Created June 11, 2013 16:19
jmap.sh
#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 1000, delay = 10 (seconds)"
exit 1
fi
pid=$1 # required
count=${2:-1000} # defaults to 10 times
delay=${3:-10} # defaults to 0.5 seconds
while [ $count -gt 0 ]
@ninozhang
ninozhang / install-sublimetext-package-contall
Created June 24, 2013 13:35
sublimetext 安装 package control 命令
使用Package Control组件安装
按Ctrl+`调出console;
粘贴以下代码到底部命令行并回车:
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
重启Sublime Text 2,如果在Perferences->package settings中看到package control这一项,则安装成功;
@ninozhang
ninozhang / git-delete-remote-branch
Created July 4, 2013 10:36
git-delete-remote-branch
As of Git v1.7.0, you can delete a remote branch using
git push origin --delete <branchName>
which is easier to remember than
git push origin :<branchName>
which was added in Git v1.5.0 "to delete a remote branch or a tag."