Skip to content

Instantly share code, notes, and snippets.

@dave-shawley
dave-shawley / scrape
Created May 11, 2020 11:15
Quick & dirty scraper for recipes from Milk Street
#!/usr/bin/env python
#
# Requirements: requests, beautifulsoup4
#
import argparse
import dataclasses
import typing
import bs4
import requests
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Schema for Read the Docs configuration file",
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"type": "string",
"enum": [
"2"

Keybase proof

I hereby claim:

  • I am dave-shawley on github.
  • I am daveshawley (https://keybase.io/daveshawley) on keybase.
  • I have a public key whose fingerprint is E1B6 B144 A6D1 51F9 DD04 EFDA 2748 E69F 7CB1 DB19

To claim this, I am signing this object:

@dave-shawley
dave-shawley / service_functionality.bats
Created November 17, 2013 22:57
BATS integration tests for nginx proxy
@test "nginx proxies to devpi-server" {
HOST=$(hostname --fqdn)
TMPFILE=$BATS_TMPDIR/root-pypi
wget -q -O$TMPFILE http://$HOST/root/pypi
grep 'type.*"indexconfig"' $TMPFILE
grep 'type.*"mirror"' $TMPFILE
}
@dave-shawley
dave-shawley / devpi-server
Last active December 28, 2015 14:48
nginx configuration for devpi-server
#
# nginx proxy for devpi-server
#
upstream devpi {
server 127.0.0.1:3141;
}
server {
server_name <%= node.fqdn %>;
@dave-shawley
dave-shawley / service_configuration.bats
Created November 17, 2013 19:08
BATS integration tests for nginx
@test "devpi-server is enabled" {
test -e /etc/nginx/sites-available/devpi-server
test -L /etc/nginx/sites-enabled/devpi-server
}
@dave-shawley
dave-shawley / service_installation.bats
Last active December 28, 2015 14:29
BATS integration tests for an nginx recipe
@test "nginx is installed" {
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
test -n "$(which nginx)"
}
@test "default site is disabled" {
test ! -e /etc/nginx/sites-enabled/default
}
@dave-shawley
dave-shawley / gist:5013968
Created February 22, 2013 14:52
Little helper function that runs a bunch of named tests back-to-back calling setUp() and tearDown() methods. Very useful for spot checking unit test coverage in Eclipse but not nearly general purpose.
private void runTestsNamed(String... testNames) throws Exception {
for (int i=0; i<testNames.length; ++i) {
Method testCase = this.getClass().getMethod(testNames[i]);
testCase.invoke(this);
if ((i + 1) < testNames.length) {
tearDown();
setUp();
}
}
}