Skip to content

Instantly share code, notes, and snippets.

@reimund
reimund / dict2xml.py
Last active May 30, 2024 10:58
Simple dictionary to xml serializer.
"""
Simple xml serializer.
@author Reimund Trost 2013
Example:
mydict = {
'name': 'The Andersson\'s',
'size': 4,
# sudoku.py
from __future__ import print_function
import random, itertools, string, operator, copy
import constraint, networkx, sympy, glpk
####################################################################
# Basic parameters
@tolnem
tolnem / kontrol.py
Last active February 12, 2024 13:46
Reading midi input from nanoKontrol 2 in python, using python-rtmidi and jack-audio
#!/usr/bin/python
import rtmidi, time
buttons = {
58: 'track_left',
59: 'track_right',
46: 'cycle',
60: 'marker_set',
61: 'marker_left',
@FelixWeis
FelixWeis / scriptPubKey-templates-0-400000.json
Created March 5, 2016 07:11
Bitcoin output script types by frequency (P2PK, P2PKH, MULTISIG, P2SH, OP_RETURN, ...)
{
"OP_DUP OP_HASH160 20 OP_EQUALVERIFY OP_CHECKSIG": 319721182,
"OP_HASH160 20 OP_EQUAL": 10083919,
"65 OP_CHECKSIG": 887766,
"OP_RETURN": 288521,
"OP_1 33 33 33 OP_3 OP_CHECKMULTISIG": 224438,
"": 219175,
"OP_1 33 33 OP_2 OP_CHECKMULTISIG": 206415,
"33 OP_CHECKSIG": 101306,
"OP_RETURN 40": 65287,
@monikkinom
monikkinom / rnn-lstm.py
Last active September 3, 2019 04:44
Tensorflow RNN-LSTM implementation to count number of set bits in a binary string
#Source code with the blog post at http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/
import numpy as np
import random
from random import shuffle
import tensorflow as tf
# from tensorflow.models.rnn import rnn_cell
# from tensorflow.models.rnn import rnn
NUM_EXAMPLES = 10000