Skip to content

Instantly share code, notes, and snippets.

View rocket-pig's full-sized avatar

rocket-pig

  • low orbit
View GitHub Profile
curl -s http://127.0.0.1:8080/requests/status.xml -u :password > /tmp/vlcstatus
cat /tmp/vlcstatus | sed '/^<state/!d' | sed 's/<state>//g' | sed 's/<\/state>//g'
#!/usr/bin/python2
import snowboydecoder,os
import sys
import signal
from commands import getoutput as cgo
from time import sleep
interrupted = False
#if you want to change the trigger message,
#record a new model with make_model.py modelname
#!/usr/bin/python2
import os
import sys
import base64
import requests
def get_wave(fname):
with open(fname) as infile:
return base64.b64encode(infile.read())
@rocket-pig
rocket-pig / cache_gtts.py
Last active March 25, 2018 23:32
Added some amount of control over logging verbosity. Can now see a nice count of new/cached words. Also kludged in some copypasta to remove trailing/leading silence, which helps it be less gappy playing back.
#!/usr/bin/python3
#### Google TTS multithreaded cacher. Download the word once, never again!
#### There's a fair amount of 'anonymization' too, as it would be impossible
#### to determine what the un-cached sentence structure was, or whether
#### words were already cached and played locally.
#sets crossfade between words, for some amount of 'smoothing'
crossfade_amount = 40
#sets fade_in/out amount, for less abruptness also
@rocket-pig
rocket-pig / wrapper.py
Created March 26, 2018 07:56
A wrapper around Kyubyong's mindblowing TTS Tensorflow project https://github.com/Kyubyong/dc_tts
#!/usr/bin/python
import os,sys,shutil
from playsound import playsound
phrase = sys.argv[1]
with open('harvard_sentences.txt','w') as f:
f.write("some horseshit it never reads this line\n1. "+str(phrase)+"\n")
os.system('python synthesize.py')
phrase=phrase.replace(" ","")
shutil.move('samples/1.wav','backup/'+phrase+'.wav')
@rocket-pig
rocket-pig / amiforked.py
Last active November 8, 2019 06:41
Check if your navcoind's best block hash matches chainz and navexplorer sites. Output some stats about recent staking.
#!/usr/bin/python3
import requests
import subprocess
import json
# Check local best block hash against api.navexplorer.com's best hash.
# 'navcoin-cli' needs to be in your PATH, and obvs navexplorer.com has to be up.
def api_get(endpoint):
@rocket-pig
rocket-pig / rebootstrap.sh
Created November 8, 2019 06:54
navcoin forked? you on wrong chain? dont want to spend ten mins trying to remember where everything is and what to type, well here ya go
#!/usr/bin/bash
# might need to change instances of 'user' to your username.
# add following line to your crontab to have a fresh (ish) bootstrap on hand.
# @weekly tar -czf /home/user/projects/bootstrap/bootstrap.tar /home/user/.navcoin4/chainstate /home/user/.navcoin4/blocks
navcoin-cli stop
echo "Waiting a bit so navcoind has completed..."
sleep 10
cd /home/user
mkdir tmp_bootstrap
@rocket-pig
rocket-pig / binanceSimplestAPIInPurePython.py
Last active November 10, 2019 08:48
The absolute least required to make binance api requests in one function. everything is in this file and only pure python is needed. You can just scroll to bottom and create an apiGet('api/v1/etcetc') call and start parsing results without spending ten hours learning syntax and workarounds for some new python module (ccxt)
#!/usr/bin/python3
# the absolute least required to make binance api requests in one function.
# everything is in this file and only pure python is needed.
# can just scroll to bottom and create an apiGet('api/v1/etcetc') call and start
# parsing results without spending ten hours learning syntax and workarounds
# for some new python module (ccxt)
#API Secrets go here:
@rocket-pig
rocket-pig / gnunet from source on Ubuntu 19.04.txt
Last active November 24, 2019 14:42
gnunet from source on Ubuntu 19.04
# this got me start to finish on ubuntu 19.04
# after some 12 odd hours of hair pulling
# it was so tedious i recorded each step once i found
# the step, and got it to complete successfully.
# no promises it will work 'out of the box' for you.
# feel free to steal/revise/comment/gfy
sudo apt install git libtool libtool-bin autoconf autopoint \
build-essential libgcrypt-dev libidn11-dev zlib1g-dev \
libunistring-dev libglpk-dev miniupnpc libextractor-dev \
@rocket-pig
rocket-pig / stats.py
Created December 4, 2019 15:16
a lil stats explorer in pure python for GNUNet.
#!/usr/bin/python3
import re
import subprocess
stats=subprocess.getoutput('gnunet-statistics').split('\n')
while True:
lines,j=[],[]
c=0
for i in stats: