Skip to content

Instantly share code, notes, and snippets.

View ulinkwo's full-sized avatar
:fishsticks:
Out sick

Kyle Liu ulinkwo

:fishsticks:
Out sick
View GitHub Profile
private void createImage(OutputStream out) {
int width = 100;
int height = 100;
BufferedImage buffer = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
Graphics2D g = buffer.createGraphics();
// set background:
g.setBackground(Color.BLUE);
g.clearRect(0, 0, width, height);
// set fore color:
#/bin/sh
# Here is how to tell sudo not to ask for password...
visudo
# Or if you are an expert, then directly edit the file /etc/sudoers
vi /etc/sudoers
# Add this line to the end of the file (this should be the LAST line!!!)...
@ulinkwo
ulinkwo / usefull-validation.js
Created March 31, 2009 09:42
Some Usefull Validations
//validate string length
function ValidLen(s,min,max){
if (s.length < min || s.length > max) { return false; }
return true;
}
// validate email
function ValidEmail(s){
var check = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/;
if (!check.test(s)) { return false; }
@ulinkwo
ulinkwo / subversion-daemon-script
Created March 11, 2009 12:04
The Subversion as Daemon Script
#!/bin/sh
#
# start/stop subversion daemon.
test -f /usr/bin/svnserve || exit 0
OPTIONS=”-d -r /svnroot”
case “$1″ in
start)