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
// paste directly into browser console | |
var aa = $$('section [data-testid="hrd-sbui-payment-details-section"] > div > div > div') | |
.map(e => e.innerText.split('\n')) | |
.map(([a, b]) => [ | |
a.replace(/[^a-zA-Z]/gi, ''), | |
b && parseFloat(b.replace('$', '').replace(',', '').replace('−', '-')), | |
], | |
) | |
.reduce((last, e) => { last[e.shift()] = e.shift(); return last; }, {}); |
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
#!/usr/bin/env bash | |
# @author CJ <[email protected]> | |
removeRedudantModules() { | |
jq < package.json '.'$1' | to_entries | map(.key)[]' -r | | |
while read i | |
do git grep -l $i | | |
wc -l | | |
xargs test 2 -ge && echo $i |
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
#!/usr/bin/env bash | |
cache_get() { | |
local cache="./data/$1.json" | |
test -f "$cache" && find "$cache" -type f -mtime +$((1/24)) -exec rm -v {} + >&2 # clear cache >1 hr | |
test -f "$cache" || curl --silent "$2" --create-dirs --output "$cache" | |
cat "$cache" | |
} |
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
$$('figure img') | |
.map(el => el.src) | |
.reverse() | |
.reduce((last, next) => { | |
return () => { | |
setTimeout(() => { | |
console.log('<img src="'+ next +'" />') | |
last() | |
}, 1000) | |
} |
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
#!/usr/bin/env bash | |
STATEFILE=${STATEFILE:-retry.log} | |
# dependencies | |
for i in sort gsed grep echo | |
do command -v $i > /dev/null || (echo $i not found >&2 && exit 1) | |
done | |
prime() { |
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
#!/usr/bin/env bash | |
# Like `npm`, but executes the command in nested sub-directories within | |
# your current git repository | |
# | |
# @author CJ <[email protected]> | |
# Example: | |
# | |
# $ npmr ls lodash # List installed packages in nested node packages |
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/sh | |
rundir=/var/run/parallelLimit | |
pause_file="$rundir/paused" | |
harakiri_file="$rundir/good-day-to-die" | |
is-paused() { | |
[ -f "$pause_file" ] | |
} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from optparse import OptionParser | |
from passlib.hash import sha512_crypt; | |
import getpass; | |
parser = OptionParser(usage="%prog --method=sha-512") | |
parser.add_option( | |
'--method', |
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
#!/usr/bin/env bash | |
json2markdowntable () { | |
local headers=$@ | |
echo $headers | sed "s, , | ,g" | |
seq $# | while read i; do echo " --- "; done | xargs | sed "s, , | ,g" | |
json -a $headers -d" | " | |
} |
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
#!/usr/bin/env node | |
// time csvtojson data/order-interval-20180102.csv | node mockup/order-interval.js | |
var stdin = require('../../ppdg/ppdg-elk/src/stdinjson.js'); | |
var lodash = require('lodash'); | |
stdin(_process); | |
function _process (err, data) { | |
return lodash(data) |
NewerOlder