Skip to content

Instantly share code, notes, and snippets.

View lhns's full-sized avatar

Pierre Kisters lhns

View GitHub Profile
scriptPath="$(readlink -f "$(dirname "$0")")"
cd /opt/gitlab/embedded/service/gitlab-rails/public/assets/webpack
echo >> main.*.js
echo "$scriptPath/"*.js
cat "$scriptPath/"*.js >> main.*.js
gzip -c main.*.js > main.*.js.gz
curlShowErrors() {
local exitCode=0
local output
local status
output="$(curl -sS -w '%{http_code}' "$@" | base64 -w 0)" || exitCode="$?"
status="$(printf %s "$output" | base64 -d | tail -c 3)"
if [[ "$status" =~ 2.. ]]; then
printf %s "$output" | base64 -d | head -c -3
else
printf %s "http $status: " >&2
exec {SUBSHELL_STDOUT_FD}>&1; eval "$({
set -e
trap 'while IFS= read -r SUBSHELL_VAR; do SUBSHELL_VAL="${!SUBSHELL_VAR}"; [[ "$SUBSHELL_VAR" != SUBSHELL_VAR ]] && [[ "$SUBSHELL_VAR" != SUBSHELL_VAL ]] && [[ "$SUBSHELL_VAR" != SUBSHELL_STDOUT_FD ]] && [[ "$SUBSHELL_VAR" != SUBSHELL_VARS_FD ]] && unset "$SUBSHELL_VAR" 2> /dev/null && printf "%q=%q\\n" "$SUBSHELL_VAR" "$SUBSHELL_VAL" || true; done < <(compgen -v) >&${SUBSHELL_VARS_FD}' EXIT
test=asdf6
echo output
false
} {SUBSHELL_VARS_FD}>&1 >&${SUBSHELL_STDOUT_FD}-)"; exec {SUBSHELL_STDOUT_FD}<&-
set -e -o pipefail
shopt -s expand_aliases
throw() { return "${1:-1}"; }
trystderr() { printf %s "$TRY_INTERNAL_STDERR" | base64 -d >&2; }
alias try='TRY_INTERNAL_F() { '
alias catch=' }; [[ $- = *e* ]]; TRY_INTERNAL_E="$?"; set +e; exec {TRY_INTERNAL_STDOUT_FD}>&1; TRY_INTERNAL_=$(set -e -o pipefail; TRY_INTERNAL_F >&${TRY_INTERNAL_STDOUT_FD}-); ERR="$?"; exec {TRY_INTERNAL_STDOUT_FD}<&-; if [[ "$TRY_INTERNAL_E" == 0 ]]; then set -e; fi; if [[ "$ERR" != 0 ]]; then '
alias catchvars=' }; [[ $- = *e* ]]; TRY_INTERNAL_E="$?"; set +e; exec {TRY_INTERNAL_STDOUT_FD}>&1; TRY_INTERNAL_VARS="$(set -e -o pipefail; TRY_INTERNAL_TRAP() { declare -p "" $(compgen -v | grep -v "^ERR\$\\|^TRY_INTERNAL_" | while IFS= read -r TRY_INTERNAL_VAR; do if unset "$TRY_INTERNAL_VAR" 2>/dev/null; then printf "%s\\n" "$TRY_INTERNAL_VAR"; fi; done) 2>/dev/null || true; }; trap TRY_INTERNAL_TRAP EXIT; TRY_INTERNAL_F >&${TRY_INTERNAL_STDOUT_FD}-)"; ERR="$?"; exec {TRY_INTERNAL_STDOUT_FD}<&-; eval "$TRY_INTERNAL_VARS"; unset TRY_INTERNAL_V
// entrypoint: /bin/sh -c 'cat /etc/grafana/grafana-full-height-panel.js | tee -a /usr/share/grafana/public/build/app.*.js >/dev/null; exec su -s /bin/sh -c "exec /run.sh" grafana'
(() => {
let isMouseDown = false;
document.addEventListener('mousedown', (event) => {
if (event.which === 1) isMouseDown = true;
});
document.addEventListener('mouseup', (event) => {
# Use Generic Template
# Set D1 to Counter
SetOption65 1
timezone 0
TelePeriod 10
Rule1 ON System#Init DO Counter1 0 ENDON ON System#Save DO Counter1 0 ENDON
Rule1 1
CounterDebounce 500
// ==UserScript==
// @name HN Favicons
// @version 0.3
// @license MIT
// @description Favicons for Hacker News
// @match https://*.ycombinator.com/*
// @grant GM.addElement
// ==/UserScript==
for(let link of document.links) {
// ==UserScript==
// @name GitLab: Open with GitHub Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @match http://gitlab.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com
// @grant none
// ==/UserScript==
runParallel() {
local batchSize=1
if [ "$1" == "--batch" ]; then
batchSize="$2"
shift 2
fi
local concurrency="$1"
shift
local tasks=()
local exitCode=0
// ==UserScript==
// @name GitLab: Open with GitHub Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @match https://gitlab.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com
// @grant none
// ==/UserScript==