Skip to content

Instantly share code, notes, and snippets.

View trustin's full-sized avatar
🌄
▂▃▅▇█▓▒░۩۞۩░▒▓█▇▅▃▂

Trustin Lee trustin

🌄
▂▃▅▇█▓▒░۩۞۩░▒▓█▇▅▃▂
View GitHub Profile
@trustin
trustin / bash_prompt.sh
Created April 27, 2011 11:37
Some useful git scripts I wrote - use with 'git config --global alias.<name> '!<script path>'
#!/bin/bash
# Git-aware bash command prompt
#
# Put this script at $HOME/.bash_prompt and add the following to your .bashrc:
#
# if [ "$PS1" ]; then
# if [ -f "$HOME/.bash_prompt" ]; then
# PROMPT_COMMAND="$HOME/.bash_prompt"
# if [ "$EUID" == "0" ]; then
# PS1="\n# "
@trustin
trustin / crashplan.excludes
Last active January 18, 2020 13:49
Trustin's CrashPlan exclusion regular expressions for Linux (crashplan)
# Put expressions that hit more files first.
/home/chroot/.*
/home/[^/]+/Workspaces?/.*/target/.*
/home/[^/]+/\.m2/repository/.*
/home/[^/]+/\.ivy2/(?:cache|local|limiter)/.*
/home/[^/]+/.*(?:~|\.(?:log|tmp|bak|lock))
/home/[^/]+/Virt/Machines/.*
# Put expressions that hits specific applications later.
/home/[^/]+/\.(?:adobe|cache|ccache|dbus|dropbox|dropbox-dist|fontconfig|gconfd|gstreamer[^/]*|gvfs)/.*
@trustin
trustin / gist:2404506
Last active October 3, 2015 05:58
Trustin's CrashPlan exclusion regular expressions for Windows (crashplan)
(?i)C:/Users/[^/]+/Music/iTunes/iTunes Media/Mobile Applications/.*
(?i)C:/Users/(Default|Public|All Users|Default User)/.*
(?i).*/(desktop\.ini|thumbs.db|ntuser\.ini)
(?i).*\.(bak|tmp|log[0-9]*|old)
(?i)C:/Users/[^/]+/(Application Data|NetHood|Contacts|Cookies|Dropbox|Links|Local Settings|My Documents|PrintHood|Recent|riotsGamesLogs|Saved Games|Searches|SendTo|시작 메뉴)/.*
(?i)D:/CrashPlan/.*
@trustin
trustin / fontfix.patch
Last active November 30, 2015 15:47
OpenJDK 7 font rendering patch for Linux (cd openjdk/jdk; patch -p1 < fontfix.patch)
diff -r 19cc3b567644 make/sun/font/Makefile
--- a/make/sun/font/Makefile Wed Jan 22 12:34:24 2014 -0800
+++ b/make/sun/font/Makefile Fri Jan 24 21:41:23 2014 +0900
@@ -138,7 +138,7 @@
ifeq ($(USING_SYSTEM_FT_LIB), false)
FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6
endif
- OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype
+ OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype -lfontconfig
endif
@trustin
trustin / hairtunes.patch
Created June 16, 2012 09:10
hairtunes.c patch that fixes stall hairtunes process
diff --git a/hairtunes.c b/hairtunes.c
index 6859cff..b5f3e7e 100644
--- a/hairtunes.c
+++ b/hairtunes.c
@@ -417,17 +417,25 @@ static void *rtp_thread_func(void *arg) {
int sock = rtp_sockets[0], csock = rtp_sockets[1];
int readsock;
char type;
+ struct timeval timeout;
@trustin
trustin / gist:2959515
Created June 20, 2012 11:51
XWiki InsertGistMacro example
function help() {
echo 'Want to embed this Gist?'
echo 'Use this: {{gist id="2959515"/}}'
}
$ help
Want to embed this Gist?
Use this: {{gist id="2959515"/}}
@trustin
trustin / pom.xml
Created June 21, 2012 12:27
Adding Netty to your POM's dependency set
<dependencies>
...
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>X.Y.Z.Q</version>
<scope>compile</scope>
</dependency>
...
</dependencies>
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.nio.ByteOrder;
ByteBuf buf = Unpooled.buffer(4);
buf.setInt(0, 1);
// Prints '00000001'
System.out.format("%08x%n", buf.getInt(0));
ByteBuf leBuf = buf.order(ByteOrder.LITTLE_ENDIAN);
// Before:
void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception;
void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception;
// After:
void channelRegistered(ChannelHandlerContext ctx) throws Exception;
void channelUnregistered(ChannelHandlerContext ctx) throws Exception;
void channelActive(ChannelHandlerContext ctx) throws Exception;
void channelInactive(ChannelHandlerContext ctx) throws Exception;
void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception;
// Before:
ctx.sendUpstream(evt);
// After:
ctx.fireInboundBufferUpdated();