Skip to content

Instantly share code, notes, and snippets.

Jethro Yu jcppkkk

  • Taipei
View GitHub Profile
chusiang /
Last active Nov 17, 2018


Migrated to GitLab and GitHub.

看了《學徒模式》一書後,凍仁試著用 Gist 管理自己的待讀書單,並不時修改其閱讀順序。您可以在 revisions 找到編修記錄。


  1. 待讀書單
  2. 已讀書單
mgedmin / gist:9547214
Created Mar 14, 2014
Setting up a Jenkins slave on Linux
View gist:9547214
# This is how you add a Jenkins slave
# On master:
sudo -u jenkins -H ssh-keygen
# On slave
adduser --system --group --home=/var/lib/jenkins-slave --no-create-home --disabled-password --quiet --shell /bin/bash jenkins-slave
install -d -o jenkins-slave -g jenkins-slave /var/lib/jenkins-slave
pkuczynski /
Last active Apr 16, 2019
Read YAML file from Bash script
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
jcppkkk / OpenWithSublime.bat
Last active Mar 29, 2019 — forked from FoxColdMetal/OpenWithSublimeText.bat
[[[ Move to !!! ]]] Add context menu to allow user open file or folder with Sublime as User (or as Admin).
View OpenWithSublime.bat
@echo off
:: Path to Sublime Text installation dir.
SET stPath=%~dp0sublime_text.exe
SET stPathOnly=%~dp0
:: Key name for the registry entries.
SET UserEntry=Sublime Text
SET AdminEntry=Sublime Text As Admin
:: Context menu texts.
SET "UserMenuText=Open with Sublime(&-)"
SET "AdminMenuText=Open with Sublime As Admin(&+)"
prwhite / Makefile
Last active Apr 16, 2019
Add a help target to a Makefile that will allow all targets to be self documenting
View Makefile
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
View gist:7030300
function errexit() {
local err=$?
set +o xtrace
local code="${1:-1}"
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
You can’t perform that action at this time.