Skip to content

Instantly share code, notes, and snippets.

Making impact

Mark McDonnell Integralist

Making impact
Block or report user

Report or block Integralist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Integralist / 1. things
Last active Nov 14, 2019
[Python Tornado Graceful Shutdown] #python #python3 #tornado #graceful #shutdown #signals #sigterm #sigint
View 1. things

Working code (Python 3.7+)...

def sig_handler(server, sig, frame):
    io_loop = IOLoop.current()
    def stop_loop(deadline):
        now = time.time()
        if now < deadline and len(asyncio.all_tasks()) > 0:
  'waiting for next event loop tick')
Integralist / Golang Fastly Purge by URL and by Key.go
Created Nov 6, 2019
[Golang Fastly Purge by URL and by Key] #fastly #go #golang #purge #cdn #cache
View Golang Fastly Purge by URL and by Key.go
// purgeByKey purges the Fastly edge cache by Surrogate-Key
func purgeByKey(key, testCase string, config *settings.Config) {
serviceID := config.FastlyIDProd
if config.Environment == "stage" {
serviceID = config.FastlyIDStage
host := ""
path := fmt.Sprintf("/service/%s/purge/%s", serviceID, key)
purgeURL := fmt.Sprintf("%s%s", host, path)
Integralist / Golang convert code into Assembly.bash
Created Nov 6, 2019
[Golang convert code into Assembly] #assembly #go #golang
Integralist / Security. Zero Trust
Created Nov 6, 2019
[Security: Zero Trust Platform] #security #zerotrust #zero #trust #platform
View Security. Zero Trust

A zero trust platform means that (in theory), we'd be able to run malicious code inside our platform with no risk – the code wouldn't be able to interact with anything dangerous without being granted special access by the platform's own security/infrastructure team.

The idea is that we don't want to trust just anything simply because it's inside our platform. Instead, we want individual services to be trusted based on a short and deliberate list of which other services they're allowed to interact with. This makes an attack substantially more difficult.

Integralist / Golang HTTP Web Server Parallel Tee Goroutine per Request.go
Created Nov 4, 2019
[Golang HTTP Web Server Parallel Tee Goroutine per Request] #go #golang #tee #parallel #http #web #server #request #pool #concurrency
View Golang HTTP Web Server Parallel Tee Goroutine per Request.go
package main
import (
var largePool chan func()
var smallPool chan func()
Integralist / Fakes vs Stubs vs
Created Oct 24, 2019
[Fakes vs Stubs vs Mocks] #fakes #stubs #mocks #testing
View Fakes vs Stubs vs


Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (e.g. a working version of a datastore that has a get and set method but writes to local disk rather than actually writing to a database).


Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.


Integralist / bash string wildcard glob contains
Last active Oct 16, 2019
[Bash string wildcard glob conains example] #bash #wildcard #glob #contains
View bash string wildcard glob contains
# our CDN was serving stale content for a request that shouldn't be
# so we wrote a quick script to verify the behaviour wasn't happening
# more often than it should.
function get {
local id=$1
local url="$id"
Integralist / Bash Hash
Last active Oct 16, 2019
[Bash Hash Bang] #bash #hash #bang
View Bash Hash

A typical bash script will identify where its interpreter can be found...


But this doesn't always work because bash might be installed in a different location.

For example, macOS has an old version of bash (or in more modern releases it has swapped bash completely for zsh) and so a user might manually install an updated version of bash which will go into a different directory...

Integralist / Fastly Clustering and Shielding
Created Oct 15, 2019
[Fastly Clustering and Shielding Example] #fastly #varnish #vcl #clustering #shielding #cluster #shield
View Fastly Clustering and Shielding
Integralist / Develop Streamlink Locally.bash
Last active Oct 8, 2019
[Develop Streamlink Locally] #streamlink #video #download #stream
View Develop Streamlink Locally.bash
You can’t perform that action at this time.