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
""" | |
Utility (Linux only) to ensure subprocesses exit when their parents do by sending | |
a specified signal when the parent dies. | |
Usage: | |
subprocess.Popen(['some-executable'], preexec_fn=on_parent_exit('SIGHUP')) | |
""" | |
import signal |
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 pickle | |
import platform | |
import struct | |
import timeit | |
import warnings | |
import numpy | |
import pyarrow | |
from scipy.sparse import csc_matrix |
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
#!/usr/bin/env python | |
import fileinput | |
import datetime | |
THRESHOLD = 50000 | |
MARKER = "==> " | |
SPACER = " " * len(MARKER) | |
last_ts = None |
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
#!/bin/bash | |
set -euo pipefail | |
help_text=" | |
Usage: bin/development-services [-h|--help] [-n|--no-attach] | |
Executes the commands listed in the 'Procfile.development' file, each in its | |
own pane of a new tmux session, and then attaches to that session. | |
If an appropriate tmux session already exists then we attach to it without |
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
""" | |
Simple proof-of-concept for zero-copy unpickling | |
""" | |
import pickle | |
import struct | |
def serialize(obj): | |
buffers = [] | |
pickled = pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL, buffer_callback=buffers.append) |
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
SELECT * INTO OPENCoronaTempTables..test_bmi_codes FROM ( | |
SELECT Patient_ID, CTV3Code, NumericValue, ConsultationDate | |
FROM CodedEvent | |
WHERE CTV3Code IN ('X76C7','22A..', 'XM01E','229..', '22K..') | |
) t |
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
#!/bin/bash | |
set -euo pipefail | |
help_text=" | |
Usage: bin/development-services [-h|--help] [-n|--no-attach] | |
Executes the commands listed in the 'Procfile.development' file, each in its | |
own pane of a new tmux session, and then attaches to that session. | |
If an appropriate tmux session already exists then we attach to it without |
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
# Apt-install various things necessary for Ruby, guest additions, | |
# etc., and remove optional things to trim down the machine. | |
apt-get -y update | |
apt-get -y remove apparmor | |
apt-get -y install linux-headers-$(uname -r) build-essential | |
apt-get -y install zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline5-dev | |
apt-get clean | |
# Remove this file to avoid dhclient issues with networking | |
rm -f /etc/udev/rules.d/70-persistent-net.rules |
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
#!/bin/bash | |
set -eo pipefail | |
this_dir="$( unset CDPATH && cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
: ${GIT_DIR="$this_dir/shared-git-repo"} | |
remote="$1" | |
sha="$2" | |
local_path="$3" |
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
# The MIT License (MIT) | |
# | |
# Copyright (c) 2013 David Evans | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of | |
# this software and associated documentation files (the "Software"), to deal in | |
# the Software without restriction, including without limitation the rights to | |
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is furnished to do so, | |
# subject to the following conditions: |
NewerOlder