Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ntung's full-sized avatar
🏠
Working from home

Tung Nguyen ntung

🏠
Working from home
View GitHub Profile
@ntung
ntung / git-tag-delete-local-and-remote.sh
Created September 5, 2018 09:56 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@ntung
ntung / ErrorController.groovy
Created November 27, 2018 14:31 — forked from aeischeid/ErrorController.groovy
Alternate grails controller template and url mapping for adding a scaffolded JSON API
package gvl
import grails.converters.JSON
class ErrorController {
// Forbidden
def error403() {
withFormat {
html { render(view: 'error403') }
@ntung
ntung / squash-commits.sh
Created January 17, 2019 17:43 — forked from jbub/squash-commits.sh
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
@ntung
ntung / Redis.sh
Created March 9, 2019 14:08 — forked from nrollr/Redis.sh
Install Redis via Homebrew
#!/bin/bash
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
@ntung
ntung / Country Dropdown List
Created March 31, 2019 10:08
Country Dropdown
<select>
<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
ntung / UserController.groovy
Created July 2, 2019 16:57 — forked from roalcantara/UserController.groovy
Grails + Spock: Testing Rendering views
class UserController {
def index(final String username) {
flash.errors = "ops!"
render view: "index", model: [username:username, text:username]
}
}
@ntung
ntung / DataNukerService.groovy
Created January 17, 2020 13:46 — forked from eliotsykes/DataNukerService.groovy
Grails GORM Truncate Tables in H2
package com.jetbootlabs.services
/*
* 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:
* http://ldaley.com/post/398082618/brute-force-fixture-cleanup-in-grails
@ntung
ntung / Grails_Groovy_Versions.txt
Created February 13, 2020 19:23 — forked from ishults/Grails_Groovy_Versions.txt
List of Groovy version for Grails
// Compiled by Igor Shults
// Last Updated: Nov. 26, 2019
GRAILS GROOVY SOURCE
4.0.1 2.5.6
4.0.0 2.5.6 https://github.com/grails/grails-core/blob/v4.0.0/build.gradle
3.3.11 2.4.17
3.3.10 2.4.17 https://github.com/grails/grails-core/commit/06a05143ec9039e631a2543b11fb52576157643e#diff-c197962302397baf3a4cc36463dce5ea
3.3.9 2.4.15
@ntung
ntung / 1_kubernetes_on_macOS.md
Created March 3, 2020 05:52 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

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!

Prerequisites

@ntung
ntung / kubectl-multi-version-brews.md
Created March 3, 2020 06:18 — forked from rdump/kubectl-multi-version-brews.md
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