Skip to content

Instantly share code, notes, and snippets.

View metachris's full-sized avatar

Chris Hager metachris

View GitHub Profile
@metachris
metachris / neo-python-api-server-setup.md
Last active July 26, 2018 16:17
Setting up a neo-python based api-server
# Systemd service config file for pyapi, to run as user 'node', group 'node' and in `/server/neo-python`
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
#
# Instructions:
# 1. Adapt this file if and as needed (directories, user, group)
# 2. Save this file in /etc/systemd/system/pyapi.service
# 3. Enable the service with `systemctl enable pyapi`
#
# Now you can use systemctl to check status, start stop and restart the service:
# `systemctl status|start|stop|restart pyapi`

Keybase proof

I hereby claim:

  • I am metachris on github.
  • I am metachris (https://keybase.io/metachris) on keybase.
  • I have a public key ASDM7ANNrSx7BlIQA7WVFgKwuTliVPq6H1Mx161bSnWSbAo

To claim this, I am signing this object:

# Create a keypair and export wif and address
def gen_keypair():
private_key = bytes(Random.get_random_bytes(32))
key = KeyPair(priv_key=private_key)
wif = key.Export()
contract = Contract.CreateSignatureContract(key.PublicKey)
address = contract.Address
return wif, address
{
"ProtocolConfiguration": {
"Magic": 56753,
"AddressVersion": 23,
"StandbyValidators": [
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62"
],
from gpiozero import Button, RGBLED
from signal import pause
button = Button(22, pull_up=True)
led = RGBLED(17, 18, 27)
colors = (
(1, 0, 0),
(0, 1, 0),
(0, 0, 1),
"""
Detect encoding of bytes/str and return unicode object.
Compatible with Python 2 and 3
Dependencies:
- chardet (https://pypi.python.org/pypi/chardet)
Author: Chris Hager <[email protected]> https://www.metachris.com
License: Public Domain (The Unlicense)
"""
@metachris
metachris / hashgen-function
Last active October 11, 2015 20:36
bash hash generator function
# Simple Bash Hash Generator
#
# Author: Chris Hager <[email protected]>
#
# Put the `hashgen` method in your `.functions` file and source it from your `.bash_profile`
#
# Usage: hashgen [type] [#chars]
#
# Optional argument `type`:
#

Keybase proof

I hereby claim:

  • I am metachris on github.
  • I am metachris (https://keybase.io/metachris) on keybase.
  • I have a public key whose fingerprint is F243 D24D BA02 97F7 CC6A CBCC 0B14 7F87 AE91 9662

To claim this, I am signing this object:

@metachris
metachris / tcpclient.py
Last active July 2, 2020 07:46
Tornado TCP Client (Simple)
import errno
import socket
from threading import Thread
from tornado import ioloop
class IOLoopThread(Thread):
def __init__(self):
Thread.__init__(self)
self.running = True