Skip to content

Instantly share code, notes, and snippets.

Brad Beattie bradbeattie

Block or report user

Report or block bradbeattie

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
View dwarf-fortress-mockup
#dig start(34;40; ) - - DwarfMockup(95;89;4;1)
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,#
~,~,~,~,~,~,~,~,~,~,~,~,
@bradbeattie
bradbeattie / netflix.js
Last active Jan 25, 2018
Adds IMDB ratings to netflix
View netflix.js
var OMDB_APIKEY = "..."
var omdb_searched = new Set()
var omdb_netflix_id_regex = new RegExp("/watch/([0-9]+)")
function omdb_get_key(link) {
return "omdb" + omdb_netflix_id_regex.exec(link.prop("href"))[1]
}
function omdb_find_cards() {
jQuery(".meta > .year").each(function() {
View prep-python-env.sh
#!/bin/bash
DIR=$(pwd)
# Download Python
PYTHON_VERSION="3.6.4"
PYTHON_VERSION_SHORT="3.6"
PYTHON_DOWNLOAD_URL="https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz"
PYTHON_DOWNLOAD_FILE="Python-$PYTHON_VERSION.tgz"
curl $PYTHON_DOWNLOAD_URL > $PYTHON_DOWNLOAD_FILE
PYTHON_MD5SUM_EXPECTED="9de6494314ea199e3633211696735f65"
@bradbeattie
bradbeattie / pycon-preference-displayer.js
Last active Apr 20, 2017
PyCon Preference Displayer
View pycon-preference-displayer.js
// To be used on https://us.pycon.org/2017/schedule/talks/
// after using https://gist.github.com/bradbeattie/8d346acda2d737ef23ccf9cc78fd80d7
// Display the recorded preference for each talk
// To be used in tandem with
$(".slot-talk .title a").each(function() {
var element = $(this)
var href = element.attr("href")
if (localStorage[href] !== undefined) {
element.parents(".slot-talk").css("background", "hsl(" + ((parseInt(localStorage[href]) + 5) * 10) + ", 50%, 50%)")
@bradbeattie
bradbeattie / pycon-preference-recorder.js
Last active Apr 20, 2017
PyCon Preference Recorder
View pycon-preference-recorder.js
// To be used on https://us.pycon.org/2017/schedule/talks/list/
// Hide who's giving the talk and when
$("h2 + p").remove()
// On left and right click, increase or decrease the recorded preference for the talk
function process(event, element, left) {
event.preventDefault()
event.stopPropagation()
var href = element.prev().find("a").attr("href")
View pgen.py
#!/usr/bin/env python3
from getpass import getpass
import argparse
import base64
import hashlib
import json
import logging
import os
import secrets
@bradbeattie
bradbeattie / queryset_filters.py
Created Jul 19, 2016
Django queryset understanding confirmation
View queryset_filters.py
#$ cat myapp/models.py
#from django.db import models
#
#class Foo(models.Model):
# pass
#
#class Bar(models.Model):
# foos = models.ManyToManyField(Foo, related_name="bars")
# val_a = models.BooleanField()
# val_b = models.BooleanField()
View ast_parser.py
import ast
import operator as op
# Supported tokens and their operators
operators = {
ast.Add: op.add,
ast.Sub: op.sub,
ast.Mult: op.mul,
ast.Div: op.truediv,
}
@bradbeattie
bradbeattie / throttle.py
Last active Jun 24, 2016
Demonstration of cache-based action throttling
View throttle.py
import memcache
from hashlib import sha1
from datetime import datetime
cache = memcache.Client(["127.0.0.1:11211"])
class ActionThrottled(Exception):
pass
@bradbeattie
bradbeattie / They Come Unseen.md
Last active Mar 8, 2017
Rules Confirmation Scenario for They Come Unseen
View They Come Unseen.md

They Come Unseen: Rules Confirmation Scenario

This is not meant to be a comprehensive list of rules, but instead to help players validate their understanding of the rules through a scenario. The turns below are not in order.

Note: This document has yet to be fully verified. Pending requests for clarifications have been added after the document at the bottom.

Scenario Setup

Location Battery Mines Damage
You can’t perform that action at this time.