Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tung Nguyen V. N. ntung

🏠
Working from home
View GitHub Profile
@ntung
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
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
ntung / JedisTest.java
Created Jul 10, 2020 — forked from FredrikWendt/JedisTest.java
Example usage of Jedis
View JedisTest.java
package se.wendt.statoil.mastercard;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
public class JedisTest {