Skip to content

Instantly share code, notes, and snippets.

View richardkiss's full-sized avatar

Richard Kiss richardkiss

View GitHub Profile
@richardkiss
richardkiss / venv
Created March 18, 2021 22:10
A nice shell script to put all your venvs in the same place
#!/bin/sh
VENV_PATH=${@:-${VENV_BASE_PATH:-~/tmp/virtualenvs}}/`pwd | sed "s|/|_|g"`/venv
if [ -e $VENV_PATH ]
then
echo rm -rf $VENV_PATH
echo and try again
else
mkdir -p $VENV_PATH

Idempotent clarifications

Here are a bunch of changes you can make for humans only. None of these changes should change how it compiles, so you should be able to change anything in this section and compare the resultant compile. It should be identical.

reformat

I've really love an automated pretty-printer akin to "black" for python or "cargo fmt" for rust so you can write whatever mess you want and have a computer indent it so it looks nice, but I haven't been able to find one yet.

@richardkiss
richardkiss / pycoin_custom_sign.py
Last active March 4, 2020 19:50 — forked from darklow/pycoin_custom_sign.py
pycoin_custom_sign.py
from pycoin.encoding.hexbytes import b2h
from pycoin.intbytes import int2byte
from pycoin.key import Key
from pycoin.networks.registry import network_for_netcode
from pycoin.satoshi.der import sigencode_der
network = network_for_netcode('XTN')
Tx = network.tx
TxIn = network.tx.TxIn
@richardkiss
richardkiss / sl
Created March 30, 2018 17:54
A "mirror-image" ls in python, as discussed at https://news.ycombinator.com/item?id=16716150
#!/usr/bin/env python
import subprocess
import sys
output = subprocess.check_output(["ls"] + sys.argv[1:])
lines = output.split("\n")
@richardkiss
richardkiss / faq.md
Last active November 28, 2017 01:56
faq.md

Chia FAQ

Q: Where does the name "Chia" come from?

A: See Wikipedia.

PROCESS
- install Raspian
- expand filesystem
- get on wifi
(zfec dependencies)
$ sudo apt-get install python-dev
$ curl http://python-distribute.org/distribute_setup.py | sudo python
#!/usr/bin/env python
"""
The obvious way is to do it with complex numbers.
"""
def f(x):
# remember, in Python 1j means sqrt(-1)
return 1j * x
#!/usr/bin/env python
"""
The obvious way is to do it with complex numbers.
"""
def f(x):
# remember, in Python 1j means sqrt(-1)
return 1j * x
@richardkiss
richardkiss / time_picker.js
Created February 16, 2013 23:55
jQuery extension for a time picker that has a small <select> menu with a small number of times that should handle 90% of cases, plus an "other time" option that allows any time to be entered.
/*global $ */
(function( $ ){
$.fn.time_picker = function( method ) {
if ( methods[method] ) {
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
#!/usr/bin/env python
import sys
import time
import csv
import sqlite3
from google.appengine.datastore import entity_pb
from google.appengine.api import datastore