Skip to content

Instantly share code, notes, and snippets.

Avatar
🤤
🤌

Sean Beck ThaWeatherman

🤤
🤌
View GitHub Profile
@ThaWeatherman
ThaWeatherman / sqlite_to_json.py
Created Dec 8, 2020
Converts a sqlite database table to a JSON file
View sqlite_to_json.py
import json
import os
import sqlite3
import sys
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
View usps_verify.py
"""
PoC for address verification via USPS API
Docs: https://www.usps.com/business/web-tools-apis/address-information-api.htm#_Toc487629493
"""
import argparse
from bs4 import BeautifulSoup
import requests
@ThaWeatherman
ThaWeatherman / bot.py
Last active Jun 3, 2017
Monitors /r/learnpython/new and posts comments when code is improperly formatted, etc
View bot.py
'''
A bot to offer suggestions to posters on /r/learnpython
on how to better ask their questions or fix their code.
'''
import argparse
import ast
import logging
import re
import sys
import time
View preev.py
'''
A small module for getting the prices of bitcoin and litecoin from https://preev.com
Works for both Python 2 and 3. Easily importable and requires only a simple call.
'''
try:
from urllib import urlopen
except ImportError:
# py 3
from urllib.request import urlopen
import json
View mailgun.py
'''
Copyright 2016 Sean Beck
MIT license
A simple script that provides a function to send an email via Mailgun.
This requires obtaining an API key from Mailgun.
You must also supply the function with the domain name associated with your account.
Mailgun will generate one for you, so just use that if you do not have your own domain.
'''
import requests
View selenium_example.py
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
url = 'http://www.supremenewyork.com/shop/jackets/silk-bomber/navy'
driver = webdriver.Firefox()
driver.get(url)
add = driver.find_element_by_name('commit')
@ThaWeatherman
ThaWeatherman / remote_servo.ino
Last active Jun 7, 2018
Remote control servo with Particle Photon. Apache License, copyright 2015 Sean Beck
View remote_servo.ino
Servo serv;
int pos = 0;
void setup() {
serv.attach(D0);
Spark.function("setpos", setPos);
Spark.variable("getpos", &pos, INT);
}
void loop() {
View burn_cd.sh
#!/bin/bash
# Author: Sean Beck
# Copyright Sean Beck 2015
type lame >/dev/null 2>&1 || { echo >&2 "$(tput setaf 1)[-] lame required but it is not installed$(tput sgr0)"; exit 1; }
type wodim >/dev/null 2>&1 || { echo >&2 "$(tput setaf 1)[-] wodim required but it is not installed$(tput sgr0)"; exit 1; }
if ! [[ -a /dev/sr0 ]]
then
echo "$(tput setaf 1)[-] /dev/sr0 does not exist. Please plug in a CD drive$(tput sgr0)"
exit 1
View easy_mac.py
'''
Easy Mac
Copyright (2015) Sean Beck
Licensed under Creative Commons Attribution-ShareAlike 4.0 International
See: https://creativecommons.org/licenses/by-sa/4.0/
Easily change your MAC address on Linux using `ifconfig`
'''
#!/usr/bin/python2.7
@ThaWeatherman
ThaWeatherman / make_creature.lua
Last active Aug 29, 2015
Code taken from https://gist.github.com/warmist/8563110. Stripped out anything not important for creating a simple wild creature
View make_creature.lua
args={...}
function gen_attribute(array)
local a=math.random(0,#array-2)
return math.random(array[a],array[a+1])
end
function get_body_size(caste,time)