View declarative_migrator.py
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
# coding: utf-8 | |
"""Simple declarative schema migration for SQLite. | |
See <https://david.rothlis.net/declarative-schema-migration-for-sqlite>. | |
Author: William Manley <will@stb-tester.com>. | |
Copyright © 2019-2022 Stb-tester.com Ltd. | |
License: MIT. | |
""" |
View expenses_appscript.js
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
/* | |
* Script to automate sending the monthly debt emails. | |
*/ | |
var EMAIL_RECEPIENT = "example@gmail.com" | |
var COLUMNS = { | |
"date": 0, | |
"paid": 1, | |
"total": 2, |
View compressFolder.go
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
// Original source: https://github.com/mimoo/eureka/blob/master/folders.go | |
package main | |
import ( | |
"archive/tar" | |
"bytes" | |
"compress/gzip" | |
"fmt" | |
"io" | |
"os" |
View smart_connect.go
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
// Small exploration into the ease of implementing an interface (and server) to abstract | |
// away the complexities of dealing with cumbersome and non-standardized network | |
// protocols. | |
// | |
// The resulting server exposes a simple HTTP API to clients, routing and forwarding | |
// their requests behind the scenes to a collection of raw network streams. The goal | |
// is to hide the underlying communication protocol and network multiplexing from | |
// clients, instead exposing a simple request/response API spoken in the lingua franca | |
// of the web. | |
// |
View island_counter.py
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
from collections import namedtuple | |
Node = namedtuple('Node', 'row col') | |
class IslandCounter: | |
def __init__(self, ocean_map): | |
self.map = ocean_map | |
self.max_row = len(ocean_map) | |
self.max_col = len(ocean_map[0]) |
View choose_winner.dart
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 'dart:math'; | |
List<String> contestants = [ | |
'Jason', | |
'Matt', | |
'Gabe', | |
'Ishan', | |
'Luis', | |
'Katie', | |
'Andrew', |
View nest_thermostat_info.py
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 nest # https://pypi.org/project/python-nest/ | |
import configparser | |
config = configparser.ConfigParser() | |
config.read('config.ini') | |
napi = nest.Nest(client_id=config['NEST']['client_id'], client_secret=config['NEST']['client_secret'], access_token_cache_file='token_cache') | |
if napi.authorization_required: | |
print('Go to ' + napi.authorize_url + ' to authorize, then enter PIN below') |
View GroceryLogic.dart
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 basic idea is to make a Grocery List progressive web app in Dartlang, | |
* using Firestore (https://firebase.google.com/docs/firestore/) as the backend. | |
* This pad is a quick sketch of the logic necessary to get the app working. | |
*/ | |
enum Categories { | |
produce, | |
dairy, | |
household, |
View aws-restarter.py
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
''' | |
Helper script to quickly restart all of the instances of a specific app | |
Assumes lots of things about the setup of the app (load balancer, ssh access, supervisor, etc.) | |
''' | |
import boto3 | |
import subprocess | |
import argparse | |
def load_balancer_instances(name): |
View heap.py
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
class Heap: | |
def __init__(self): | |
self.data = [] | |
self.length = 0 | |
def push(self, val): | |
if len(self.data) <= self.length: # need to expand the array | |
self.data.append(val) | |
else: | |
self.data[self.length] = val |
NewerOlder