This file contains hidden or 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 | |
# | |
#script to make it easier to git cherry-pick the latest commit to another branch | |
numCommits=1 # but we can cherry-pick more than one if needs be | |
red="\033[1;31m" | |
norm="\033[0;39m" | |
grey="\033[0;37m" | |
green="\033[0;32m" |
This file contains hidden or 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 -euE | |
# Similar as `npm version`, bump version by git tags or custom version file | |
# | |
# by @allex_wang <https://iallex.com> | MIT | |
# | |
# Usage: | |
# | |
# git-rev |
This file contains hidden or 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
#!/usr/bin/env bash | |
#copy this in a folder from path ex: /usr/local/bin | |
#usage: docker-machine-rename default my-default | |
# Authors | |
# | |
# alexproca initial script | |
# eurythmia sed magic |
This file contains hidden or 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 | |
# vim: set ft=sh fdm=manual ts=2 sw=2 sts=2 tw=85 et: | |
# ================================================ | |
# Description: sync push local docker images to remote | |
# Last Modified: Tue Nov 19, 2024 16:36 | |
# Author: Allex Wang ([email protected]) | |
# GistID: 42f93720be61ec33c0542855f5a0f543 | |
# GistURL: https://gist.github.com/42f93720be61ec33c0542855f5a0f543 | |
# ================================================ |
This file contains hidden or 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 -eu | |
# Quote a single- or multi-line string for use in git's aliases | |
# Copyright (c) 2016 Tom Hale under https://en.wikipedia.org/wiki/MIT_License | |
quote() { | |
printf %s "$1" | sed -r 's/(["\\])/\\\1/g'; | |
} | |
IFS=$(printf '\n') |
This file contains hidden or 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
// Uses bit operation to reduce your codes (by allex) | |
// GistID: 459aaa91c9b584e127f3f45890026303 | |
const ADD = 4 | |
const UPDATE = 2 | |
const DELETE = 1 | |
const checkFlag = (v, mask) => (v & mask) === mask | |
const print = (v, desc) => { |
This file contains hidden or 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
-- print all nginx variables | |
-- author: allex_wang | |
-- GistID: b9f5206b58570d7686c6f22b8fed3144 | |
local inspect = require('inspect') | |
local keys = { | |
"args", | |
"binary_remote_addr", | |
"body_bytes_sent", |
This file contains hidden or 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
--[[ json.lua | |
A compact pure-Lua JSON library. | |
The main functions are: json.stringify, json.parse. | |
## json.stringify: | |
This expects the following to be true of any tables being encoded: | |
* They only have string or number keys. Number keys must be represented as | |
strings in json; this is part of the json spec. |
This file contains hidden or 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
#!/usr/bin/env bash | |
# fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f | |
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_run package.json "npm prune && npm install" |
This file contains hidden or 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/sh | |
# GistID: 8f9a8a45e86f0edef6caea81f0795031 | |
set -eE | |
echoerr() { | |
echo "$@" 1>&2; | |
} | |
error() { | |
if [ -t 1 ]; then | |
echoerr "\033[1;31m$@\033[0m" |