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
name: 'Shell with Post Hook' | |
description: 'Run shell script with guaranteed post hook' | |
inputs: | |
main: | |
description: 'Main script to run (aborts job if exit code>10)' | |
required: true | |
post: | |
description: 'Post script to run (if $MAIN_EXIT_CODE<11)' | |
required: true | |
shell: |
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 | |
yesno() { | |
while true ; do | |
echo "--> $1" | |
read | |
case "$REPLY" in | |
y*) return 0 ;; | |
n*) return 1 ;; | |
*) echo "Please answer y or 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
{ | |
"openapi": "3.0.3", | |
"info": { | |
"version": "1.1.4", | |
"title": "GitHub v3 REST API", | |
"description": "GitHub's v3 REST API.", | |
"license": { | |
"name": "MIT", | |
"url": "https://spdx.org/licenses/MIT" | |
}, |
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
{ | |
"$schema": "https://vega.github.io/schema/vega/v4.json", | |
"title": "Recursive Doughnut Chart by Most Common Keyword", | |
"autosize": "pad", | |
"signals": [ | |
{ "name": "width", "init": "containerSize()[0]", "on": [] }, | |
{ "name": "height", "init": "containerSize()[1]", "on": [] }, | |
{ "name": "size", "init": "width > height ? height : width"} | |
], | |
"data": [ |
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 | |
set +m # No noisy background report | |
( | |
set -m # New process group, please - It should survive teamcity finishing its step | |
( | |
PIDS=$HOME/lockpids | |
state=looking | |
while true ; do | |
t=$(mktemp -tpid); bash -c "while [[ -f $t ]] ; do sleep 1 ; done" & p=$(ps -p $! -o 'ppid=') ; rm $t |
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
<html> | |
<head> | |
<script> | |
var next_tick = null; | |
var ease = 0.05; | |
var body = [ | |
{ l: 's', x: 0, y: 0, vx: 0, vy: 0, m: 10000 }, | |
{ l: 'o', x: 0, y: 120+5, vx: 50+2, vy: 0, m: 20 }, | |
{ l: 'm', x: 0, y: 120-5, vx: 50-2, vy: 0, m: 1 }, | |
]; |
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 | |
# Poll command and display diffs. e.g. diffpoller.sh lsusb | |
BASE=/tmp/$(whoami)-$(basename $0) | |
trap "rm -f $BASE-A $BASE-B ; exit" SIGINT | |
echo -n > $BASE-B | |
while true ; do | |
"$@" > $BASE-A 2>&1 | |
diff -wu $BASE-B $BASE-A || date | |
mv $BASE-A $BASE-B |
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 | |
if ! [[ -f "$1" ]] ; then echo "Usage: $0 file-to-edit" ; exit 42 ; fi | |
FILE=$1 | |
if [[ -f "$FILE~" ]] && ! diff -u $FILE $FILE~ ; then | |
echo Resolve or ignore above diffs. Quitting. ; echo rm $FILE~ ; exit 42 | |
fi | |
cp $FILE $FILE~ | |
help() { echo "Try" ; grep -E ') *#' $0 ; echo "And ^d to abort" ; } | |
help | |
while echo -n ": " ; read ; do |
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
perl -ple 'while (/>(<.*?>)/) { | |
s{>(<.*?>)([^<]*)}{ | |
$i++; | |
$i-=1 if substr($1,0,2) eq "</"; | |
$s=">\n".(" "x$i).$1.$2; | |
$i-=1 if substr($1,0,2) eq "</" or $2 ne ""; | |
$i-=2 if substr($1,0,2) eq "</" and $2 ne ""; | |
$i-=1 if substr($1,-2) eq "/>"; | |
$s | |
}e |
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 | |
uidump=/tmp/${0##*/}.$$ | |
unsyncd_uidump_matching_lines() { | |
adb shell 'rm -f /sdcard/dump.* && uiautomator dump /sdcard/dump.xml 2>/sdcard/dump.err && cat /sdcard/dump.xml' | | |
tr '<' "\n" | | |
tee $uidump.full | | |
grep -Ei "$1" | | |
xargs -rn1 | |
NewerOlder