Skip to content

Instantly share code, notes, and snippets.

@jiaozhu
jiaozhu / Str2MD5.java
Created June 17, 2015 11:47
Java 编程下字符串的 16 位、32位 MD5 加密
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Str2MD5 {
public static void main(String[] args) {
MD5("sunzn");
}
private static String MD5(String sourceStr) {
@jiaozhu
jiaozhu / OSValidator.java
Created June 8, 2015 16:19
How to detect OS in Java
public class OSValidator {
private static String OS = System.getProperty("os.name").toLowerCase();
public static void main(String[] args) {
System.out.println(OS);
if (isWindows()) {
System.out.println("This is Windows");
@jiaozhu
jiaozhu / placeholder
Last active August 29, 2015 14:21 — forked from oec2003/placeholder
/*! http://mths.be/placeholder v2.0.6 by @mathias */;
(function (g, i, d) {
var a = 'placeholder' in i.createElement('input'),
e = 'placeholder' in i.createElement('textarea'),
j = d.fn,
c = d.valHooks,
l, k;
if (a && e) {
k = j.placeholder = function () {
return this
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
package com.blogspot.alotacode.scheduler;
import java.util.List;
import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.QuartzJobBean;
@jiaozhu
jiaozhu / gist:0b2993074df77be2c8b4
Created September 14, 2014 13:58
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@jiaozhu
jiaozhu / healthcheck.sh
Last active August 29, 2015 14:03
定期检测JAVA进程CPU占用,假如超过10%,则生成THREADDUMP信息
#/bin/sh
#####################################################################
# #
# Env:Aix #
# Copyright (c) 2014, jiaozhu <[email protected]> #
# All rights reserved. #
# Distributed under the GNU General Public License, version 3.0. #
# #
#####################################################################
@jiaozhu
jiaozhu / CheckCpuUsage.sh
Last active August 29, 2015 14:02
定期检测操作系统的CPU使用率,如果超过60%,则生成THREADDUMP文件
#!/bin/ksh
#####################################################################
# #
# Env:Aix #
# Copyright (c) 2014, jiaozhu <[email protected]> #
# All rights reserved. #
# Distributed under the GNU General Public License, version 3.0. #
# #
#####################################################################
@jiaozhu
jiaozhu / 0_reuse_code.js
Created June 13, 2014 23:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jiaozhu
jiaozhu / gist:9500373
Last active August 29, 2015 13:57 — forked from lucasfais/gist:1207002
Sublime Text 2 – Useful Shortcuts (Mac OS X)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt