Skip to content

Instantly share code, notes, and snippets.

View bajcmartinez's full-sized avatar

Juan Cruz Martinez bajcmartinez

View GitHub Profile
@bajcmartinez
bajcmartinez / create_transaction.py
Created May 18, 2020 19:07
From Zero to Blockchain in Python - Part 1 - Create Transaction
def create_transaction(self, sender, recipient, amount):
"""
Creates a new transaction to go into the next block
:param sender: <str> sender address
:param recipient: <str> recipient address
:param amount: <float> amount
:return: <Transaction> generated transaction
"""
transaction = Transaction(sender, recipient, amount)
@bajcmartinez
bajcmartinez / block.py
Created May 18, 2020 18:55
From Zero to Blockchain in Python - Part 1 - Block
import hashlib
from api.schema.block import BlockSchema
from time import time
class Block:
def __init__(self, index, transactions, nonce, previous_hash):
"""
Constructs a new block
@bajcmartinez
bajcmartinez / transaction.py
Created May 18, 2020 18:49
From Zero to Blockchain in Python - Part 1 - Transaction
import time
class Transaction:
def __init__(self, sender, recipient, amount):
"""
Creates a new transaction
:param sender: <str> sender account
:param recipient: <str> recipient account
@bajcmartinez
bajcmartinez / Configuration for development with a corporate proxy
Last active July 2, 2019 19:40
Configuration for development with a corporate proxy
Just for title
@bajcmartinez
bajcmartinez / slack-dark-theme.sh
Created June 4, 2019 19:23
Enable Slack Dark Mode for MAC OS
#!/bin/bash
# Updates your slack installation on MAC to use dark mode
# adjust this URL for your chosen darkmode.
theme_url="https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css"
ssbj_dir="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/"
# ensure we are root
if [[ "$EUID" -ne 0 ]]; then