This file contains 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 | |
webhook_url="URL HERE" | |
role=Firedrill | |
icon=bust_in_silhouette | |
channel="#lotto-support-3p" | |
roles=( | |
"marketing,Marketing:female-technologist::skin-tone-2" | |
"crm,CRM:male-singer::skin-tone-3" | |
"core,Core on-call:bearded_person::skin-tone-2" |
This file contains 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 | |
check_session() { | |
[ -f $HOME/.op/token ] && export OP_SESSION_my="$(cat $HOME/.op/token)" | |
# attempt sign in if session is not active | |
if ! op get account &> /dev/null; then | |
signin | |
check_session | |
fi | |
} |
This file contains 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
# Add 5px transparent border | |
convert file.png -bordercolor transparent -border 5 file-border.png | |
# Add a 3px blur based on the alpha channel | |
convert file-border.png \( +clone -background '#777777' -shadow 100x1+0+0 -channel A -level 0,100% -blur 0x3 \) -compose DstOver -gravity center -composite file-glow.png | |
# TODO combine the above |
This file contains 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
<?php | |
$char = 'イ'; | |
// What's the UTF-8 encoding of this character? (This file is saved in UTF-8) | |
var_dump(bin2hex($char)); // e382a4 | |
// What does another encoding look like? | |
// See http://www.fileformat.info/info/unicode/char/30a4/charset_support.htm | |
var_dump(bin2hex(mb_convert_encoding($char, "EUC-JP", "UTF-8"))); // a5a4 |
This file contains 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
function nestingLolz(count) { | |
return [...Array(count)].reduce(function (a, c, i) { | |
return a + ' or my ' + Array(i + 1).fill('son').join('’s '); | |
}, 'Don’t talk to me') + ' ever again'; | |
} | |
// haven't decided which I prefer :-) | |
function nestingLolzAlternate(count) { | |
return ['Don’t talk to me'] | |
.concat([...Array(count)].map((e, i) => Array(i + 1).fill('son').join('’s '))) |
This file contains 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
// Use to detect calls to document.cookie="xxx" | |
(function (){ | |
var s = document.__lookupSetter__('cookie').bind(document), | |
g = document.__lookupGetter__('cookie').bind(document); | |
Object.defineProperty(document, 'cookie', { | |
get() { | |
return g(); | |
}, | |
set(n) { |
This file contains 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 | |
# usage: rounded.sh INFILE RADIUS [OUTFILE] | |
# if OUTFILE is omitted, outputs to STDOUT | |
size=$2 | |
convert $1 \( +clone -alpha extract -draw "fill black polygon 0,0 0,$size $size,0 fill white circle $size,$size $size,0" \( +clone -flip \) -compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) -alpha off -compose CopyOpacity -composite ${3:-png:-} |
This file contains 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 | |
# Usage: ./air-cert-dates.sh /path/to/app.air | |
signatures="$(unzip -p "$1" META-INF/signatures.xml)" | |
xpath '//Signature[@Id="PackageSignature"]//X509Certificate[1]/text()' <<< "$signatures" 2>/dev/null \ | |
| sed -e $'1s/^/-----BEGIN CERTIFICATE-----\\\n/;$s/$/\\\n-----END CERTIFICATE-----/' \ | |
| openssl x509 -dates -noout \ | |
| sed -e $'1s/^/metric,date\\\n/;s/=/,/' |
This file contains 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
<?php | |
$file = $argv[1]; | |
$header = null; | |
$spec = array( | |
'_id' => function ($data) { | |
return intval($data['comment_ID']); | |
}, | |
'name' => 'comment_author', |
This file contains 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
let maxConsumption = 0; | |
process.nextTick(() => { | |
let memUsage = process.memoryUsage(); | |
if (memUsage.rss > maxConsumption) { | |
maxConsumption = memUsage.rss; | |
} | |
}); | |
process.on('exit', () => { |