Skip to content

Instantly share code, notes, and snippets.

View rocket-pig's full-sized avatar

rocket-pig

  • low orbit
View GitHub Profile
@rocket-pig
rocket-pig / chatgpt-cli.js
Created May 1, 2023 16:34
chatGPT node.js CLI chat interface - as simple as posible. npm install openai langchain, then node chatgpt-cli.js and youre there.
//npm install openai langchain
async function loadModules() {
const openaiModule = await import("langchain/chat_models/openai");
const schemaModule = await import("langchain/schema");
const { ChatOpenAI } = openaiModule;
const { HumanChatMessage, SystemChatMessage } = schemaModule;
const chat = new ChatOpenAI({ openAIApiKey: 'sk-YOURKEY', temperature: 0 });
// Now you can use the chat object to interact with the model:
@rocket-pig
rocket-pig / wordtoint.py
Created November 17, 2022 02:58
Convert written numbers to integer equivalent, python2. Intended for use with macrodroid/termux to handle voice input conversion
#!/usr/bin/python2
import sys
ournum = sys.argv[1]
#print("got "+ournum)
def is_number(x):
if type(x) == str:
x = x.replace(',', '')
try:
Q='RGB'
P=True
O='rb'
N=chr
L=bytes
K=float
G=range
I=open
C=print
F=int
@rocket-pig
rocket-pig / pnger.py
Created March 26, 2022 07:24
Quickly convert arbitrary data into/out of .png format. Example: https://i.ibb.co/qgSsgmp/out.png (is an MP3)
#!/usr/bin/python3
# Updated and stripped ver of https://github.com/ESultanik/bin2png Evan Sultanik
#Quickly convert arbitrary data into/out of .png format. Example: https://i.ibb.co/qgSsgmp/out.png (is an MP3)
import math
from PIL import Image
import sys
# print usage, if no arguments are given
if len(sys.argv) < 2:
print("Usage: %s <input file> <output file>" % sys.argv[0])
@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:
@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 / 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 / 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 / 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 / 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')