Skip to content

Instantly share code, notes, and snippets.

@pezon
pezon / __main__.py
Created May 15, 2019 16:45
Download song lyrics (en-masse)
"""
Fetch song lyrics
Fetches song lyrics from Genius API based on a CSV with a list of songs.
Outputs song lyrics in a separate CSV.
CSVs are set through command line parameters.
Uses asynchronous routines to fetch song lyrics to fetch many lyrics at a time.
Requires Python 3.6+
Install:
@pezon
pezon / create_us_counties_network.py
Last active March 1, 2020 02:32
Creates graph network of neighboring U.S. counties
import json
import networkx as nx
import requests
from shapely.geometry import shape
def fetch_geojson():
"""Fetches GeoJSON for U.S. Counties.
Example feature: {'GEO_ID': '0400000US23', 'STATE': '23', 'NAME': 'Maine',
@pezon
pezon / transformer.py
Created November 24, 2020 22:37
FFX1 tokenizer PySpark transformer
"""
PySpark tokenizer transformer
PySpark transformer that supports format-preserving encryption using the FFX1 algorithm (from pyffx library)
requirements:
pyffx
pyspark
"""
from string import digits, ascii_uppercase, ascii_lowercase