If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
from django.core.files.storage import default_storage | |
def walk_folder(storage, base="/", error_handler=None): | |
""" | |
Recursively walks a folder, using Django's File Storage. | |
:param storage: <Storage> | |
:param base: <str> The base folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MD5 (input) { | |
var digest = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, input); | |
var output = ""; | |
for (i = 0; i < digest.length; i++) { | |
var h = digest[i]; | |
if (h < 0) { h += 256; } | |
if (h.toString(16).length == 1) { output += '0'; } | |
output += h.toString(16); | |
} | |
return output; |
This is my highly opinionated way of developing with Python locally. Use it, don't use it. But you probably know that it's a PITA to manage different projects with different dependencies targeting different Python versions, and there are different ways of installing Python too:
- Using the interpreters preinstalled in the OS 😵
- Using
brew
(orapt
etc.) 😅 - Using the binaries from www.python.org 😫
- Using pyenv 😎
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blockchain(object): | |
def __init__(self): | |
self.current_transactions = [] | |
self.chain = [] | |
def new_block(self): | |
# Creates a new Block in the Blockchain | |
pass | |
def new_transaction(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/nodes/register', methods=['POST']) | |
def register_nodes(): | |
values = request.get_json() | |
nodes = values.get('nodes') | |
if nodes is None: | |
return "Error: Please supply a valid list of nodes", 400 | |
for node in nodes: | |
blockchain.register_node(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import requests | |
class Blockchain(object) | |
... | |
def valid_chain(self, chain): | |
""" | |
Determine if a given blockchain is valid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
from urllib.parse import urlparse | |
... | |
class Blockchain(object): | |
def __init__(self): | |
... | |
self.nodes = set() | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/chain', methods=['GET']) | |
def full_chain(): | |
response = { | |
'chain': blockchain.chain, | |
'length': len(blockchain.chain), | |
} | |
return jsonify(response), 200 |
NewerOlder