Skip to content

Instantly share code, notes, and snippets.

Working from home

Tung Nguyen V. N. ntung

Working from home
View GitHub Profile
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 {
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 / 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 /
Created Mar 3, 2020 — forked from rdump/
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

We need to run multiple versions of kubectl for compatibility with various kubernetes clusters.

It's a bit easier to get and use multiple versions of kubectl using Homebrew than it is using Macports.

With brew, it's simple to:

  • Install a bunch of versions of kubectl (in the kubernetes-cli Formula)
  • Switch between them as needed
ntung /
Created Mar 3, 2020 — forked from kevin-smets/
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry


Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!


ntung / Grails_Groovy_Versions.txt
Created Feb 13, 2020 — forked from ishults/Grails_Groovy_Versions.txt
List of Groovy version for Grails
View Grails_Groovy_Versions.txt
// Compiled by Igor Shults
// Last Updated: Nov. 26, 2019
4.0.1 2.5.6
4.0.0 2.5.6
3.3.11 2.4.17
3.3.10 2.4.17
3.3.9 2.4.15
ntung / DataNukerService.groovy
Created Jan 17, 2020 — forked from eliotsykes/DataNukerService.groovy
Grails GORM Truncate Tables in H2
View DataNukerService.groovy
* Truncates H2 tables mapped by the domainClasses variable. Useful for cleaning up test data.
* Temporarily disables referential integrity to avoid constraint violation errors when
* deleting records.
* Inspired by Luke Daley's blog post on how to do this in MySQL:
ntung / UserController.groovy
Created Jul 2, 2019 — forked from roalcantara/UserController.groovy
Grails + Spock: Testing Rendering views
View UserController.groovy
class UserController {
def index(final String username) {
flash.errors = "ops!"
render view: "index", model: [username:username, text:username]
View Country Dropdown List
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antartica">Antarctica</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
ntung /
Created Mar 9, 2019 — forked from nrollr/
Install Redis via Homebrew
brew install redis # Install Redis using Homebrew
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl
# homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping # Check if the Redis server is running
You can’t perform that action at this time.