Skip to content

Instantly share code, notes, and snippets.

Making an impact

Mark McDonnell Integralist

Making an impact
View GitHub Profile
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"
Integralist / macOS System Information.bash
Last active Sep 18, 2020
[macOS System Information] #macos #system #information #shell #bash
View macOS System Information.bash
# Documentation:
# - man sw_vers
# - man system_profiler
# Product Name:
# Neither of the above solutions provide the OS 'product name' (e.g. Catalina, Mojave, High Sierra etc.)
# So I curl Wikipedia's macOS version history page and parse out the name.
# The problem in doing so is that I need a version number (e.g. 10.15)
Integralist / git revision
Created Sep 16, 2020
[Git Revision Range] #git #revision #range
View git revision


Log commits in feature branch that aren't in master:

git log master..feature

If you git pull your master branch you might find there are additional commits from your colleagues. So you might want to check what commits were recently merged into master that aren't in your feature branch:

You can’t perform that action at this time.