Skip to content

Instantly share code, notes, and snippets.

View CptSpaceToaster's full-sized avatar

CptSpaceToaster

View GitHub Profile
@CptSpaceToaster
CptSpaceToaster / basic_pokmon_card_crawler.py
Last active March 30, 2022 18:12
Crawls the v2 pokemontcg.io API and prints card prices to console
import os
import requests # pip install requests
# Getting a POKEMONTCG_IO_API_KEY is optional.
# Read more about the API's use of keys here: https://docs.pokemontcg.io/getting-started/authentication
# https://able.bio/rhett/how-to-set-and-get-environment-variables-in-python--274rgt5
POKEMONTCG_IO_API_KEY = os.environ.get('POKEMONTCG_IO_API_KEY')
POKEMONIO_API_URL = 'https://api.pokemontcg.io'
#!/usr/bin/env python3
import argparse
import sys
def digest(infile):
for line in infile.readlines():
mock(line)
@CptSpaceToaster
CptSpaceToaster / simple_tcgplayer.py
Last active December 10, 2020 16:34
A very simple demonstration of TCGPlayer's API.
import os
import requests # pip install requests
TCGPLAYER_API_URL = 'https://api.tcgplayer.com'
TCGPLAYER_API_VERSION = 'v1.39.0'
# https://able.bio/rhett/how-to-set-and-get-environment-variables-in-python--274rgt5
TCGPLAYER_PUBLIC_KEY = os.environ.get('TCGPLAYER_PUBLIC_KEY')
TCGPLAYER_PRIVATE_KEY = os.environ.get('TCGPLAYER_PRIVATE_KEY')
import datetime
import pytest
from freezegun import freeze_time
@pytest.fixture()
def timeboat():
"""Grab the helm of the timeboat, we're going on an adventure!
Allows the test writer to freeze time so that time.time() returns a controlled value
https://stackoverflow.com/a/28073449/4717806"""
PERIOD=300
AMPLITUDE=6000
O1=$((PERIOD/3))
O2=$((O1*2))
UUID=$(osascript -e "tell application \"iTerm2\"
get current session of current window
end tell" | cut -d' ' -f3 -f6 -f10)
set-background() {
#!/usr/bin/env python3
import argparse
import sys
def digest(infile):
for line in infile.readlines():
mock(line)
#!/usr/bin/env python3
import argparse
import sys
def digest(infile):
for line in infile.readlines():
makeRegionalChars(line)
@CptSpaceToaster
CptSpaceToaster / something_fishy.py
Last active November 13, 2018 20:23
Generate a silly fishy-pants themed company name
#!/usr/bin/env python
import random
import argparse
fish = [
'Angle',
'Bait',
'Bob',
#!/usr/bin/env python3
import argparse
import sys
def digest(infile):
for line in infile.readlines():
makeRegionalChars(line)
function wrap_tree()
{
if [[ -f /tmp/tree ]]; then
$(which tree) $*
else
touch /tmp/tree
cat <<EOF
* *
* * *