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
<?php | |
class RedisLockFailException extends Exception {} | |
class RedisLock | |
{ | |
const DEFAULT_TIMEOUT = 20; | |
// what to do if we cannot get lock | |
const FAIL_EXCEPT = 'fail_except'; // throw exception |
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 -euo pipefail | |
EDITOR="vi" | |
DIR="$HOME/.journal" | |
mkdir -p "$DIR" | |
ARG=${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
Verifying that +alexgrin is my blockchain ID. https://onename.com/alexgrin |
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
<?php | |
class Curl | |
{ | |
const GET = 'GET'; | |
const POST = 'POST'; | |
const PUT = 'PUT'; | |
public static function get($url, $params = [], $options = []) | |
{ |
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
while IFS= read -r -d '' file; do | |
if [ "$(head -n 1 "$file")" != '<?php' ]; then | |
echo "$file"; | |
fi; | |
done < <(find . -name '*.php' -print0) |
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 | |
head -n100 /dev/urandom | strings | egrep -o '([a-zA-Z0-9#%&^])' | awk '{ORS=""; print $1}' | head -c 35; echo |
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 -euo pipefail | |
### CONFIG | |
EMAIL_ADDR="" # email this address if errors detected | |
MAX_SECONDS_BEHIND=5 # max seconds that slave can be behind master |
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
var autoCurry = (function () { | |
var toArray = function toArray(arr, from) { | |
return Array.prototype.slice.call(arr, from || 0); | |
}, | |
curry = function curry(fn /* variadic number of args */) { | |
var args = toArray(arguments, 1); | |
return function curried() { | |
return fn.apply(this, args.concat(toArray(arguments))); |
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 | |
# sample usage: | |
# cat *.csv | cut -d',' -f3 | ./stat.sh | |
set -euo pipefail | |
[ -n "${1:-}" -a -f "${1:-}" ] && INPUT="$1" || INPUT="-" | |
cat $INPUT | sort -n | awk ' |
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 -euo pipefail | |
#set -x # for debugging | |
if [ -z "${2:-}" ]; then | |
echo "Usage: $0 PASSWORD DB [reload] [NOTIFY-EMAIL]" | |
echo "Check your bash history?" | |
exit 1 | |
fi |