Skip to content

Instantly share code, notes, and snippets.

Making an impact

Mark McDonnell Integralist

Making an impact
View GitHub Profile
Integralist / Laptop Configuration.
Last active Oct 14, 2020
[Laptop Configuration: Summary] #new #laptop #configuration #macos
View Laptop Configuration.
  • Settings
    • Dock (Automatically hide and show the Dock)
    • Keyboard (Key Repeat = Fast, Delay Until Repeat = Short)
    • Accessibility > Zoom (Use keyboard shortcuts to zoom)
    • Date & Time > Clock (Show date + Display the time with seconds)
    • Mission Control (disable "Automatically rearrange Spaces based on most recent use")
    • Preferences
      • General > Startup (Restore previous session + Warn you when quitting the browser)
Integralist / CRDT. conflict-free replicated data
Created Oct 2, 2020
[CRDT: conflict-free replicated data type] #crdt #distributed
View CRDT. conflict-free replicated data

Operations on CRDTs need to adhere to the following rules:

  • Associativity (a+(b+c)=(a+b)+c), so that grouping doesn't matter.
  • Commutativity (a+b=b+a), so that order of application doesn't matter.
  • Idempotence (a+a=a), so that duplication doesn't matter.

Data types as well as operations have to be specifically crafted to meet these rules. CRDTs have known implementations for counters, registers, sets, graphs, and others.

Integralist / Install Python package directly for the interpreter Vim is
Created Oct 2, 2020
[Install Python package directly for the interpreter Vim is using] #vim #python
View Install Python package directly for the interpreter Vim is

Sometimes Vim's Python binary can't find a package you've installed.

  • in vim
    :py3 import sys; print(sys.path)

  • navigate to that location and find the python binary, in my case:
    cd /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/bin

  • install isort using this binary
    ./python3.8 -m pip install isort

Integralist / curl to json.bash
Created Oct 2, 2020
[Curl to JSON] #curl #bash #shell #json
View curl to json.bash
curl --write-out '%{json}' -svo /dev/null | jq
"url_effective": "",
"method": "GET",
"http_code": 200,
"response_code": 200,
"http_connect": 0,
Integralist / tornado logging when request has
Last active Sep 28, 2020
[Python tornado logging when request has completed] #python #python3 #tornado #logging #logs #server #http
View tornado logging when request has
That Application.log_request approach uses very explicit naming,
and yet the tornado docs for RequestHandler.on_finish says...
> Override this method to perform cleanup, logging, etc.
So theres two ways to essentially do the same thing 🤔
My understanding for the difference would be log_request is useful for
generic logging behaviour, while on_finish could be customized per
Integralist / Asyncio built-in Socket
Created Sep 25, 2020
[Asyncio built-in Socket Server] #python #python3 #asyncio #server #socket #web #http
View Asyncio built-in Socket
import asyncio
async def handle_request(reader, writer):
writer.write("hello world".encode()) # needs to be bytes not string
async def main():
srv = await asyncio.start_server(handle_request, '', 8081)
Integralist / 0.
Last active Sep 25, 2020
[Python Context and ContextVars] #python #python3 #context #contextvars
View 0.

Context variables are variables that can have different values depending on their context. They are similar to Thread-Local Storage in which each execution thread may have a different value for a variable. However, with context variables, there may be several contexts in one execution thread. The main use case for context variables is keeping track of variables in concurrent asynchronous tasks. --

"""Example copied verbatim from Real Python."""

import contextvars

name = contextvars.ContextVar("name")
contexts = list()
Integralist / Golang Named Return Zero Value.go
Created Sep 23, 2020
[Golang Named Return Zero Value] #go #golang #zero #named #return
View Golang Named Return Zero Value.go
package main
import (
func GetString(key string) (val string) {
// 'named' return value are initialized to their zero value
// meaning we can proxy the zero value through to a nested function
Integralist / YouTube 'Watch'
Created Sep 21, 2020
[YouTube 'Watch' Channels] #youtube #watches
View YouTube 'Watch'
  • Bark and Jack: great down to earth personality, cool watches, very easy to listen to.
  • WatchFinder: awesome/expensive unique watches and their backgrounds (exquisite close-up footage)
  • Theo and Harris: high end quality pieces reviewed/discussed
  • The Urban Gentry: can waffle on, but he does great historical deep dives
  • Watch Advisor: I just enjoy listening to him talk because of his accent lol
  • Long Island Watches: cheaper end watches, interesting selections come up
  • Jenni: female watch reviewer (great quality footage)
  • WatchBox Reviews: short reviews
  • [WatchBox Studi
Integralist / Go Module
Last active Sep 22, 2020
[Go Module Versioning] #go #golang #modules #versioning #semver
View Go Module


You have a dependency you want to use, like

// delete-just-testing/foo/foo.go 
package foo

import "fmt"
You can’t perform that action at this time.