Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | |
# Converts JSON into a flat, line-by-line format | |
# Equivalent to https://github.com/soheilpro/catj | |
# Borrowed from this HN comment: https://news.ycombinator.com/item?id=20246957 | |
exec jq -r ' | |
tostream | |
| select(length > 1) | |
| ( |
This file contains hidden or 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 | |
ncso.date AS month, | |
vmpp.bnf_code AS bnf_code, | |
vmpp.nm AS product_name, | |
rx.quantity AS quantity, | |
rx.pct AS pct, | |
rx.practice AS practice, | |
dt.price_pence | |
* rx.quantity | |
* CASE WHEN |
This file contains hidden or 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 time | |
import sys | |
import lmdb | |
import numpy | |
import pyarrow | |
import scipy.sparse | |
#import zstandard |
This file contains hidden or 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 csv | |
import itertools | |
import sys | |
import lmdb | |
import numpy | |
import pyarrow | |
import scipy.sparse |
This file contains hidden or 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 | |
# https://stackoverflow.com/a/8574392/79992 | |
contains_element () { | |
local e match="$1" | |
shift | |
for e; do [[ "$e" == "$match" ]] && return 0; done | |
return 1 | |
} |
This file contains hidden or 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 django.conf import settings | |
from django.core.exceptions import MiddlewareNotUsed | |
from django.http import HttpResponse | |
class BasicAuthMiddleware(object): | |
""" | |
Adds HTTP Basic Authentication site-wide | |
Useful for protecting staging/demo environments. Additionally, sets auth details |
This file contains hidden or 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 collections | |
import json | |
import sys | |
MISSING = object() | |
class ConflictError(Exception): pass |
This file contains hidden or 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
sudo add-apt-repository ppa:morgwai/tpbat | |
sudo apt update | |
sudo apt install tpacpi-bat | |
# Start charging at 40%, stop charging at 80% | |
echo '[Unit] | |
Description=sets battery thresholds | |
[Service] | |
Type=oneshot |