Skip to content

Instantly share code, notes, and snippets.

View louisje's full-sized avatar
💯
左手寫程式 (">_<) 右手做測試

Louis Jeng louisje

💯
左手寫程式 (">_<) 右手做測試
View GitHub Profile
@louisje
louisje / css.js
Created July 13, 2012 04:33
A RequireJS plugin to load css file
/**
* RequireJS Plugin - CSS Loader
*
* [ex.]
* define(['css!jquery-ui-css', 'jquery', 'jquery-ui'], { });
*
* Its better to put 'css!' in front of other js dependencies to get
* faster loading speed
*
*/
@louisje
louisje / install-outland.sh
Created July 20, 2012 02:44
outland installation script
#!/bin/bash
cd $HOME
wget -qO- http://outland.s3.amazonaws.com/outland.tar.gz | tar zxvf -
#git clone git://github.com/louisje/outland.git
outland/bin/ol-build
echo
echo "You need to \`source .bash_profile\` to make everything active"
echo
@louisje
louisje / sprintf.js
Created July 23, 2012 10:42
Javascript sprintf()
/**
* sprintf()
*/
(function() {
define(function() {
return function() {
var convert = function(match, nosign) {
if (nosign) {
@louisje
louisje / vimrc.vim
Created August 26, 2012 03:33
vimrc sample
set nocompatible " not compatible with the old-fashion vi mode
set backspace=2 " allow backspacing over everything in insert nc >kkmode
set history=1000 " keep 1000 lines of command line history
set undolevels=100
set ruler " show the cursor position all the time
set autoread " auto read when file is changed from outside
set wrap
set linebreak
set nolist
set hidden
var logger = console.log;//<?php function logger($msg) {echo "\n".$msg;};
function fibonacci($seq) {
if ($seq < 2) {
return $seq;
} else {
return fibonacci($seq - 1) + fibonacci($seq - 2);
}
}
package acloudsvc.hadoop.examples;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
#!/bin/sh
# usage: ./date_of_year.sh [ {year} ]
year=$1
if test -z "$year"; then
year=`date +'%Y'`
fi
next_year=`echo "$year + 1" | bc`
now=`date +"%Y-%m-%d" -d "$year-01-01"`
end=`date +"%Y-%m-%d" -d "$next_year-01-01"`;
#!/bin/sh
export DISPLAY=":2"
#sudo apt-get install -y tightvncserver
sudo apt-get install -y psmisc
#vncserver -kill $DISPLAY
sudo pkill x11vnc
sudo pkill Xvfb
### x-window ###
sudo apt-get install -y xfonts-cyrillic xfonts-100dpi xfonts-75dpi xvfb x11vnc xfce4
#vncserver $DISPLAY -geometry 1372x874 -depth 24
@louisje
louisje / morse.sh
Last active December 21, 2015 09:01
#!/bin/bash
# morse.sh - generate morse code from ascii
# you can contact me at:
# --. .-. ..- .-.. --- ... .--.-. --. -- .- .. .-..
# .-.-.- -.-. --- --
# if you don't like my "dots" and "dashes"
# you can change them
# dot=.
# dash=_
#!/bin/bash
#
# <pre>
#
# Copyright (c) 2016 Louis Jeng <louisje@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or