Skip to content

Instantly share code, notes, and snippets.

@seanmckaybeck
seanmckaybeck / sqlite_to_json.py
Created December 8, 2020 22:05
Converts a sqlite database table to a JSON file
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]
"""
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
'''
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
'''
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
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')
@seanmckaybeck
seanmckaybeck / remote_servo.ino
Last active June 7, 2018 07:45
Remote control servo with Particle Photon. Apache License, copyright 2015 Sean Beck
Servo serv;
int pos = 0;
void setup() {
serv.attach(D0);
Spark.function("setpos", setPos);
Spark.variable("getpos", &pos, INT);
}
void loop() {
'''
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
@seanmckaybeck
seanmckaybeck / make_creature.lua
Last active August 29, 2015 14:20
Code taken from https://gist.github.com/warmist/8563110. Stripped out anything not important for creating a simple wild creature
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)
'''
something something docstring
'''
from Crypto.Hash import SHA
BLOCK_SIZE = SHA.digest_size
O_CONST = 0x5c
I_CONST = 0x36
import time
from subprocess import Popen
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import requests
from bs4 import BeautifulSoup
URL = 'http://www.silverpriceoz.com/silver-price-per-ounce/'