Skip to content

Instantly share code, notes, and snippets.

Working from home

Tung Nguyen V. N. ntung

Working from home
View GitHub Profile
ntung / git-log-pretty
Created May 15, 2020 — forked from miebach/git-log-pretty
pretty git log graph with coloured branches
View git-log-pretty
# Visualizing branch topology in git on the commandline
git log --graph --oneline --full-history --all
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s"
# With colors in Bash:
git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"
ntung / sync.groovy
Created Jul 7, 2020 — forked from pditommaso/sync.groovy
Prevent multiple JVM to access concurrently the same file
View sync.groovy
import java.nio.channels.FileLock
final file = new RandomAccessFile(new File("foo.lock"), "rw")
println "<Entering in critical section>"
try {
* wait to acquire a lock
def secs = 0
FileLock lock
ntung /
Created Jul 10, 2020 — forked from FredrikWendt/
Example usage of Jedis
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
public class JedisTest {