Skip to content

Instantly share code, notes, and snippets.

😺
Oh look! A status that I'll never change again!

Matt Dodge mattdodge

😺
Oh look! A status that I'll never change again!
Block or report user

Report or block mattdodge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattdodge
mattdodge / liars.pl
Last active Feb 23, 2019
A Prolog solution to the FiveThirtyEight island liars Riddler (2/22/19)
View liars.pl
% 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 Jan 31, 2019
Find duplicate blocks in a nio project
View duplicate_blocks.py
# 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 Jan 31, 2019
Clean up unused blocks in your nio projects
View unused_blocks.py
# 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 Jan 28, 2019
nio Block for setting status
View status_block.py
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 Oct 24, 2018
A proposed syntax for defining blocks
View block_decorator.py
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
Add IDs to nio blocks and services - migrate from nio 2.x to 3.0
View add_ids.py
# 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 Jan 10, 2018
Make existing kubernetes services headless
View headless.sh
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
Mel Kiper vs Todd McShay 2013 Draft
View kiper_mcshay.md
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 19, 2017
Solutions to the game 24
View solutions.md
Target (originally 24) Number of Solutions
2 479
3 469
6 462
1 462
5 459
4 457
7 454
9 448
View keybase.md

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:

You can’t perform that action at this time.