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
| // A queue of integer values, implemented as a linked-list. | |
| // Careful, don't pop the queue if it's empty! | |
| // Copyright (c) James Davidson 2015. | |
| // Publicly released under the terms of the MIT License. | |
| // For educational purposes only, obviously; no warranty implied. | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdbool.h> | |
| #include <assert.h> |
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
| -- Euclid's algorithm for calculating the greatest-common-divisor. | |
| gcd :: Integer -> Integer -> Integer | |
| gcd x y = | |
| if r == 0 then y else (gcd y r) | |
| where r = (mod x y) |
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
| /* | |
| Software serial multple serial test | |
| Receives from the hardware serial, sends to software serial. | |
| Receives from software serial, sends to hardware serial. | |
| The circuit: | |
| * RX is digital pin 2 (connect to TX of other device) | |
| * TX is digital pin 3 (connect to RX of other device) | |
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
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>example.lambda</groupId> | |
| <artifactId>jisho-b36491</artifactId> | |
| <packaging>jar</packaging> | |
| <version>1.0-SNAPSHOT</version> | |
| <name>jisho-b36491</name> | |
| <url>http://maven.apache.org</url> | |
| <dependencies> |
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
| So, what did I try? | |
| Well, first I tried to find a CMS that didn't need MySQL. Painful. | |
| Then, I tried installing MySQL. They have made this very hard to | |
| automate. | |
| Then, I tried running MySQL in a Docker container. The first annoying | |
| thing here was that I needed a specific version of Docker's API but that | |
| also meant a specific version of the Python library and adding |
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
| # install and configure Wowza Streaming Engine | |
| class profile::wowza { | |
| # Placeholder to install Wowza Streaming Engine (WowzaStreamingEngine-4.7.1-linux-x64-installer.run) | |
| $config = hiera('wowza') | |
| $audio_upstream = 'http://localhost:1935' | |
| $wowza_upstream = 'http://localhost:8088' | |
| $shoutcast_upstream = 'http://localhost:8000' | |
| # The following URLs are for management: |
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
| variable jobnumber { | |
| default = "201802061831" | |
| } | |
| provider aws { | |
| region = "ap-southeast-2" | |
| } | |
| resource aws_sqs_queue asdf { | |
| receive_wait_time_seconds = 20 # enable long polling by default |
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 | |
| # This program requires two filename arguments. Each file should contain a list | |
| # of address ranges (CIDR blocks). The output will be a list of address which | |
| # are in the first list but not the second expressed as /32 ranges. | |
| from __future__ import unicode_literals | |
| import sys | |
| import ipaddress |
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
| /* Open a TLS connection to a remote host and verify its cert. | |
| * Usage: node tls_connect.js -connect thewest.com.au:443 | |
| */ | |
| var tls = require('tls'); | |
| var i = process.argv.indexOf('-connect'); | |
| var connect = process.argv[1+i].split(':'); | |
| var servername = connect[0]; | |
| var port = Number(connect[1]); | |
| if (0 < i && connect && servername && port) { |
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
| // ## Goal | |
| // | |
| // A convenient and secure way to get temporary credentials for AWS which I can use | |
| // with Terraform or the Python CLI. Sort of like `saml2aws` but in the browser. | |
| // | |
| // ## Implementation | |
| // | |
| // A client-side JS app which uses Cognito and IAM resources as the backend. | |
| // | |
| // 1) Open the app |