Skip to content

Instantly share code, notes, and snippets.

View Technifocal's full-sized avatar

Nicholas Technifocal

View GitHub Profile
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
#!/usr/bin/env bash
address=1BitcoinEaterAddressDontSendf59kuE
curl -s "https://api.nicehash.com/api?method=stats.provider&addr=${address}" | jq -r ".result.stats[] | \"nicehash,address=${address},algo=\(.algo) balance=\(.balance)\""
@Technifocal
Technifocal / parallelizeAwsPollyPerSentence.sh
Created October 5, 2017 13:40
Parallelizes 'text.txt' to AWS Polly, splitting per sentence.
#!/usr/bin/env bash
cat text.txt | \
tr '\n' ' ' | \
sed -e 's/\(\s*[.\?]\)\s\?/\1\x00/g' | \
parallel -j64 --null 'aws polly synthesize-speech --output-format mp3 --text {1} --voice-id Amy Amy.$(printf "%010d" {#}).mp3' && \
ffmpeg -i 'concat:'$(for i in *.mp3; do echo -n "${i}|"; done) out.mp3
@Technifocal
Technifocal / listAwsSpotPrice.sh
Created October 2, 2017 16:07
List AWS spot instance prices and sort by price
#!/usr/bin/env bash
curl -s 'http://spot-price.s3.amazonaws.com/spot.js' | sed 's/callback(//g;s/)\;//g' | jq -r '[.config.regions[] | {region:.region, size:(.instanceTypes[].sizes[])}] | map("Price: \(.size.valueColumns[0].prices.USD). Size: \(.size.size). Region: \(.region).")|.[]' | grep -v 'N/A*' | sort -nrk2
@Technifocal
Technifocal / ring_doorbell.py
Created February 16, 2017 16:25
Ring doorbell telegraf input.exec script
#!/usr/bin/python2
import json, urllib, urllib2, base64, os
USERNAME = "email@example.com"
PASSWORD = "C0rrectH0rseBatteryStaple"
GUID = "GENERATE_A_GUID_AND_PUT_IT_HERE_FORMAT_IS_34f0a43b-5091-4592-9b66-e69b0e1f1b24"
def login(username, password):
postData = urllib.urlencode({'device[os]': 'android',