This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eEuo pipefail | |
# https://stackoverflow.com/questions/6928946/mysterious-lineno-in-bash-trap-err | |
# https://stackoverflow.com/questions/64786/error-handling-in-bash | |
# https://stackoverflow.com/questions/24398691/how-to-get-the-real-line-number-of-a-failing-bash-command | |
# https://unix.stackexchange.com/questions/39623/trap-err-and-echoing-the-error-line | |
# https://unix.stackexchange.com/questions/462156/how-do-i-find-the-line-number-in-bash-when-an-error-occured | |
# https://unix.stackexchange.com/questions/365113/how-to-avoid-error-message-during-the-execution-of-a-bash-script | |
# https://shapeshed.com/unix-exit-codes/#how-to-suppress-exit-statuses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# comment-coverage-report.sh | |
# generate comment coverage report, markdown table format | |
# | |
# NOTE: | |
# 1. run at project root dir | |
# 2. install ohcount: https://github.com/blackducksw/ohcount | |
# if you use mac install by brew: brew install ohcount | |
set -euo pipefail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcor() { | |
# http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit | |
# --sort=-committerdate : sort branch by commit date in descending order | |
# --sort=committerdate : sort branch by commit date in ascending order | |
git branch -a --sort=committerdate "$@" | | |
awk -F'remotes/origin/' '/remotes\/origin\//{print $2}' | | |
tail -1 | | |
xargs git checkout | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.immutable.ListSet | |
object ScalaLinearization { | |
case class Clazz(className: Symbol, superClasses: ListSet[Clazz]) | |
// Ignore Any, AnyRef. Simplify demo implementation | |
val animal = Clazz('Animal, ListSet()) | |
val furry = Clazz('Furry, ListSet(animal)) | |
val hasLegs = Clazz('HasLegs, ListSet(animal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class Linearization { | |
private static void linearization(String clazz, List<String> result, Map<String, List<String>> class2Supers) { | |
final List<String> supers = class2Supers.get(clazz); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run erlang MFA(Module-Function-Args) conveniently, like | |
# erun fac1 main 25 # example from book programming erlang. | |
erun() { | |
if [ $# -lt 2 ]; then | |
echo "Error: at least 2 args!" | |
return 1 | |
fi | |
erl -s "$@" -s init stop -noshell | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
" set backspace=indent,eol,start | |
syntax on | |
set ignorecase | |
set hlsearch | |
set number | |
set relativenumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghc() { | |
local url="${1:-$(git remote get-url origin)}" | |
if [ -z "$url" ]; then | |
echo "No arguement and Not a git repository!" | |
return 1 | |
fi | |
if [[ "$url" =~ '^http' ]]; then | |
echo "$url" | sed 's#^https?://#git@#; s#$#\.git#; s#(\.com|\.org)/#\1:#' -r | c | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<profile> | |
<id>java8+</id> | |
<activation> | |
<jdk>[1.6,1.7]</jdk> | |
</activation> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.5.1</version> |
NewerOlder