Skip to content

Instantly share code, notes, and snippets.

View Bachmann1234's full-sized avatar

Matt Bachmann Bachmann1234

View GitHub Profile
@Bachmann1234
Bachmann1234 / Events.py
Last active August 29, 2015 14:23
Historical Events
import json
from dateutil import parser
class HistoricalEvent(object):
def __init__(self, event_id, name, description, event_time):
"""
:type id: int
:type name: str
:type description: str
:type event_time: datetime.datetime
@Bachmann1234
Bachmann1234 / test_event.py
Last active August 29, 2015 14:23
Historical Event Unit Test
class TestEvent(unittest.TestCase):
name = "Invention of the telegraph"
event_id = 1
description = "Samuel Morse patents his telegraph"
event_time = datetime(1840, month=6, day=20)
event_object = HistoricalEvent(
event_id,
name,
@Bachmann1234
Bachmann1234 / call.py
Last active October 22, 2015 14:12
Example client call
def test_end_to_end(ccs_host):
content = "I am the batman and I fight the joker"
content_id = "contentOne"
sub_content_id = "subcontent"
near_matcher_id = "nearMatcher"
batman_id = "batmanId"
joker_id = "jokerId"
batman_name = "batmanMatcher"
joker_name = "jokerMatcher"
field = "document"
#!/usr/bin/env python3
import sys
import json
import re
import os
def find_date(doc_text):
"""
This may be fragile. Though im not sure what part of this wont be fragile...
Basically look for the key phrase that suggests when the meeting will be and extract the date
@Bachmann1234
Bachmann1234 / playlist.json
Created September 18, 2016 21:57
538 Ultimate Workout Playlist
{
"name": "Ultimate Workout Playlist",
"description": "From 538's Reporting http://fivethirtyeight.com/features/the-ultimate-workout-playlist/",
"tracks": [
{
"name": "Panda",
"artist": "Desiigner"
},
{
"name": "'Till I Collapse",
@Bachmann1234
Bachmann1234 / montyhall.py
Last active October 5, 2017 20:19
Monty Hall Simulator
#!/usr/bin/env python3
import random
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
NUM_ROUNDS = 100000
def _get_doors():
doors = [False, False, False]
@Bachmann1234
Bachmann1234 / i589.json
Created December 15, 2018 21:17
I589 2018 fields
[ {
"description" : "Part. A. 1. Information About You. 1. Enter Alien Registration Number (A. Number), if any.",
"absolutePath" : "form1[0].#subform[0].PtAILine1_ANumber[0]",
"relativePath" : "PtAILine1_ANumber[0]",
"fieldType" : "TEXT",
"value" : ""
}, {
"description" : "Part. A. 1. Information About You. 2. Enter U. S. Social Security Number, if any.",
"absolutePath" : "form1[0].#subform[0].TextField1[0]",
"relativePath" : "TextField1[0]",
@Bachmann1234
Bachmann1234 / keybase.md
Created May 28, 2019 17:35
Keybase Verification

Keybase proof

I hereby claim:

  • I am bachmann1234 on github.
  • I am bachmann (https://keybase.io/bachmann) on keybase.
  • I have a public key ASBxcuyyEdg9vOylvD7rIbiE4uwajE4gR5vZZNb8Y7kkQwo

To claim this, I am signing this object:

@Bachmann1234
Bachmann1234 / server.py
Created April 25, 2020 20:37
Example graphql server
import uvicorn
from graphene import (
ObjectType,
String,
Schema,
AbstractType,
Field,
Int,
List,
Mutation,
@Bachmann1234
Bachmann1234 / hook.py
Created July 26, 2022 14:43
Webhook dumper
from flask import Flask, request
import json
from pygments import highlight
from pygments.formatters.terminal256 import Terminal256Formatter
from pygments.lexers import get_lexer_by_name
app = Flask(__name__)
@app.route("/")