Skip to content

Instantly share code, notes, and snippets.

View likejazz's full-sized avatar

Sang Park likejazz

View GitHub Profile
@likejazz
likejazz / gist:2658100
Created May 11, 2012 07:19
Showing full path in bash prompt
export PS1='[\u@\h:\w]\$ '
@likejazz
likejazz / gist:3140040
Created July 19, 2012 00:53
find and kill a process in one line
kill -9 `ps aux | grep KEYWORD | grep -v grep | awk '{print $2}'`
@likejazz
likejazz / gist:3915926
Created October 19, 2012 02:30
Forcing error messages for python debugging
assert False, msg
@likejazz
likejazz / gist:4563963
Last active December 11, 2015 07:08
PCRE example. extract title from docids.
#!/bin/bash
trim() {
# Determine if 'extglob' is currently on.
local extglobWasOff=1
shopt extglob >/dev/null && extglobWasOff=0
(( extglobWasOff )) && shopt -s extglob # Turn 'extglob' on, if currently turned off.
# Trim leading and trailing whitespace
local var=$1
var=${var##+([[:space:]])}
@likejazz
likejazz / gist:4564778
Last active December 11, 2015 07:18
tumblr image sprites css
.links .icon {
width: 12px;
height: 12px;
background: #383838 url('http://static.tumblr.com/thpaaos/1xRm66voi/icons_sprite.png');
margin: 0 8px 0 0;
display: inline-block;
}
.links a:hover .icon {
background-color: #000000;
@likejazz
likejazz / after.java
Last active December 11, 2015 14:59
refactoring. before and after.
public static HashMap<String, String> extractFABThumbnailJSON(String json)
throws Exception {
String YES = "y";
String NO = "n";
HashMap<String, String> map = new HashMap<String, String>();
boolean isVideo = Boolean.FALSE;
boolean isImage = Boolean.FALSE;
Feb 4, 2013 9:58:50 AM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:convbridge' did not find a matching property.
Feb 4, 2013 9:58:51 AM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class] from Jar [jar:file:/home/spring/Java/springsource/vfabric-tc-server-developer-2.7.1.RELEASE/spring-insight-instance/wtpwebapps/convbridge/WEB-INF/lib/icu4j-2.6.1.jar!/] for annotations
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.jav
#!/bin/bash
for gid in `seq 0 9`
do
for cid in `seq 0 1`
do
CMD="find ./$gid.$cid/ -mtime +30 -exec rm {} \;"
date
echo $CMD
find ./$gid.$cid/ -mtime +30 -exec rm {} \;
find . -maxdepth 1 -type d -mtime +30 -exec echo {} \;
@likejazz
likejazz / .profile
Last active August 29, 2015 13:59
My .profile in Mac Os X
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# Tell `ls` to be colourful
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Tell `grep` to highlight matches
export GREP_OPTIONS='--color=auto'