Skip to content

Instantly share code, notes, and snippets.

View mattdodge's full-sized avatar
😺
Oh look! A status that I'll never change again!

Matt Dodge mattdodge

😺
Oh look! A status that I'll never change again!
View GitHub Profile
@mattdodge
mattdodge / liars.pl
Last active February 23, 2019 07:02
A Prolog solution to the FiveThirtyEight island liars Riddler (2/22/19)
% import our CLP library for constraint declarations
:- use_module(library(clpfd)).
% A Claimant is a liar if their age is over the threshold. We also
% explicitly declare the "not liar" condition here since `not` seems
% to behave weirdly with constraints
liar(Claimant, LieThreshold) :- Claimant #>= LieThreshold.
not_liar(Claimant, LieThreshold) :- Claimant #< LieThreshold.
% A Person is older than an Age if the Claimaint is not a liar, otherwise
@mattdodge
mattdodge / duplicate_blocks.py
Created January 31, 2019 17:56
Find duplicate blocks in a nio project
# Usage: From your nio project root run:
#
# python duplicate_blocks.py
from copy import copy
import json
import os
from os.path import join
blocks = {}
@mattdodge
mattdodge / unused_blocks.py
Created January 31, 2019 00:14
Clean up unused blocks in your nio projects
# Usage:
# From your nio project directory:
# >>> python unused_blocks.py
#
# Or, to delete the unused blocks:
# >>> python unused_blocks.py --delete
import json
import os
from os.path import join
import sys
@mattdodge
mattdodge / status_block.py
Last active January 28, 2019 22:42
nio Block for setting status
from nio.block.base import Block
from nio.command import command
@command('set_warning')
@command('set_error')
@command('set_ok')
class StatusBlock(Block):
def set_warning(self):
@mattdodge
mattdodge / block_decorator.py
Created October 24, 2018 14:59
A proposed syntax for defining blocks
from nio.block import blockify
@blockify
def my_custom_block(signals):
for signal in signals:
setattr(signal, 'matt', 'dodge')
return signals
@mattdodge
mattdodge / add_ids.py
Last active May 8, 2018 19:36
Add IDs to nio blocks and services - migrate from nio 2.x to 3.0
# A script to add IDs to block and service resources.
# Useful for migrating a project from nio 2.x to 3.0
#
# Usage:
# Run this script from inside the etc/blocks or etc/services folders of your
# project
#
# Example:
# cd etc/blocks
# python add_ids.py
@mattdodge
mattdodge / headless.sh
Created January 10, 2018 21:45
Make existing kubernetes services headless
kubectl get svc -o json | jq -r '.items[] | select (.spec.clusterIP!="None")' | jq '.spec.clusterIP = "None"' | kubectl replace --force -f -
@mattdodge
mattdodge / kiper_mcshay.md
Created May 19, 2017 01:07
Mel Kiper vs Todd McShay 2013 Draft
Pick Team McShay Kiper Actual
1 Kansas City Eric Fisher (OT - Central Michigan) Eric Fisher (OT - Central Michigan) Eric Fisher (OT - Central Michigan)
2 Jacksonville Dion Jordan (DE - Oregon) Luke Joeckel (OT - Texas A&M) Luke Joeckel (OT - Texas A&M)
3 Oakland Sharrif Floyd (DT - Florida) Sharrif Floyd (DT - Florida) Dion Jordan (DE - Oregon)
4 Philadelphia Lane Johnson (OT - Oklahoma) Lane Johnson (OT - Oklahoma) Lane Johnson (OT - Oklahoma)
5 Detroit Ezekiel Ansah (DE - BYU) Ezekiel Ansah (DE - BYU) Ezekiel Ansah (DE - BYU)
6 Cleveland Geno Smith (QB - WVU) Dee Milliner (CB - Alabama) Barkevious Mingo (DE - LSU)
7 Arizona Jonathan Cooper (G - UNC) Dion Jordan (DE - Oregon) Jonathan Cooper (G - UNC)
8 Buffalo Ryan Nassib (QB - Syracuse) Jonathan Cooper (G - UNC) Tavon Austin (WR - WVU)
@mattdodge
mattdodge / solutions.md
Last active May 12, 2023 12:30
Solutions to the game 24
Target (originally 24) Number of Solutions
2 479
3 469
6 462
1 462
5 459
4 457
7 454
9 448

Keybase proof

I hereby claim:

  • I am mattdodge on github.
  • I am mattdodge (https://keybase.io/mattdodge) on keybase.
  • I have a public key whose fingerprint is 4E10 1C96 3077 8865 8293 3F28 9947 BDF9 6192 D7D9

To claim this, I am signing this object: