start new:
tmux
start new with session name:
tmux new -s myname
| # show, list or set java version for current shell | |
| # usage: jv; jv -l; or jv 8 | |
| jv() { | |
| local d v="$1" | |
| if [ $# -ge 1 ]; then | |
| [ -z "${v#-[lLV]}" ] && { /usr/libexec/java_home -V; return; } | |
| [ -z "${v##-*}" ] && { /usr/libexec/java_home "$@"; return; } | |
| [ ${#v} -eq 1 -a -z "${v#[0-8]}" ] && v="1.$v" | |
| [ -n "$v" ] && d=$(/usr/libexec/java_home -v "$v") && \ | |
| export JAVA_HOME="$d" |
| readlink_f() { | |
| local _dir _path="$1" | |
| [ -d "$_path" ] && _path=$(cd "$_path"; pwd -P) | |
| while [ -L "$_path" ]; do | |
| _dir=$(dirname "$_path") | |
| _path=$(readlink "$_path") | |
| [ -n "${_path##/*}" ] && _path="${_dir}/${_path}" | |
| done | |
| [ -f "$_path" ] && _path="$(cd "$(dirname "$_path")"; pwd -P)/${_path##*/}" | |
| echo "${_path%/}" |
| : sd | |
| #*TAG:39985 20:1973-09-17:0755:../d.proj-sd/sd | |
| # Author: Brian Hiles <bsh@iname.com> | |
| # Date: 1998/11/20 | |
| # Description: sed debugger with conditional spypoints | |
| # License: copyright (c) 1996-2002 | |
| # Name: sd | |
| # Project: @(#)sd-standalone.sh 3.3 2001-04 bsh@iname.com (Brian Hiles) | |
| # Requires: echon(3S), expr(1), rm(1), sed(1) | |
| # Thanks-to: Walter Briscoe <w.briscoe@ponl.com> for AIX compatibility |
| #!/bin/bash | |
| # install ncurses if not yet | |
| # [ -z "$(brew info ncurses | grep 'Not installed')" ] || \ | |
| brew install ncurses | |
| # setup $LDFLAGS and $CPPFLAGS | |
| # source <(brew info ncurses | grep 'FLAGS' | sed -r -e 's/: +/=/' -e 's/^ +/export /') | |
| export LDFLAGS=-L/usr/local/opt/ncurses/lib | |
| export CPPFLAGS=-I/usr/local/opt/ncurses/include |
| // http://johannesbrodwall.com/2018/05/15/a-wicked-java-trick-to-make-the-jvm-forget-to-check-exceptions/ | |
| // https://www.reddit.com/r/java/comments/8kz1tl/a_wicked_java_trick_to_make_the_jvm_forget_to/ | |
| // https://www.reddit.com/r/programming/comments/8kz1vf/a_wicked_java_trick_to_make_the_jvm_forget_to/ | |
| static RuntimeException softenException(Exception e) { | |
| return checkednessRemover(e); | |
| } | |
| static <T extends Exception> T checkednessRemover(Exception e) throws T { | |
| throw (T) e; |
| # see https://www.thingy-ma-jig.co.uk/blog/22-09-2014/homebrew-list-packages-and-what-uses-them | |
| brew list -1 | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done |
| launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist | |
| sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist | |
| sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz | |
| sudo pkgutil --forget org.macosforge.xquartz.pkg | |
| # Log out and log in |
| #!/bin/sh | |
| # to run this, use the following: | |
| # curl https://matthewbauer.us/kernel-panic.sh | sh | |
| cfile=$(mktemp).c | |
| cat <<EOF >> $cfile | |
| #include <unistd.h> | |
| #include <sys/syscall.h> | |
| #include <signal.h> |
| ############## | |
| # pretty prompt and font colors | |
| ############## | |
| # alter the default colors to make them a bit prettier | |
| echo -en "\e]P0000000" #black | |
| echo -en "\e]P1D75F5F" #darkred | |
| echo -en "\e]P287AF5F" #darkgreen | |
| echo -en "\e]P3D7AF87" #brown | |
| echo -en "\e]P48787AF" #darkblue |