Skip to content

Instantly share code, notes, and snippets.

View frytoli's full-sized avatar

Olivia frytoli

View GitHub Profile

Keybase proof

I hereby claim:

  • I am frytoli on github.
  • I am frytoli (https://keybase.io/frytoli) on keybase.
  • I have a public key whose fingerprint is 5CB7 87AF DB52 7109 08C4 6AEE 0436 1037 07B0 9A33

To claim this, I am signing this object:

#!/usr/bin/env python3
'''
Download all videos in a playlist from YouTube, record metadata in a CSV file, and split all videos into frame images.
'''
from pytube import Playlist
import random
import time
import csv
@frytoli
frytoli / mysql_explorer.py
Last active March 17, 2021 20:10
Class that connects to MySQL server and provides ability to list databases, list tables, dump tables as json, serialize JSON data, and write table rows as individual JSON objects to a file (requires PyMySQL)
#!/usr/bin/env python
import pymysql.cursors
import datetime
import decimal
import json
import os
class mysql_explorer():
def __init__(self, user, password, host='127.0.0.1'):
@frytoli
frytoli / gee_img_download.py
Last active March 13, 2021 08:01
A nifty class that downloads thumbnail images from my favorite collections in Google Earth Engine's public dataset and base64-encodes them. It also has the capability to decode base64-encoded strings back into their original bytes (in this case, most likely images).
#!/usr/bin/env python
'''
Requirements:
google-api-python-client==1.12.8 (https://github.com/google/earthengine-api/issues/160)
earthengine-api==0.1.255
requests
'''
import requests
/*
Quick Java class to compare files within the same directory.
* Public method "compare" takes in a String path to a directory and String path to an output csv file (i.e. obj.compare(String "./files", String "out.csv");)
* Files (excluding . files) are retrieved from the given directory, evaluated/compared in parallel, and the results are written to a csv file
* Results for each file include: file name, file MIME type, sha256 checksum of file, and similarity comparison (between 0.0 and 1.0) to all other files in the directory
* CSV header rows include: file_name, mime_type, sha256_checksum, and names of all files in the directory...
One Warning: When testing comparing original text files to copies created via Mac's Finder application (i.e. right click, duplicate) and edited slightly (at the end of the
file) in a text editor, the copied file was observed to be missing the very first byte. This means that every byte at index i in the copied file is equal to

Example Using Cypher with Neo4j

https://neo4j.com/docs/getting-started/current/cypher-intro/

  1. Create nodes and relationships for example graph (Note that Neo4j does not support bidirectional relationships. Therefore, it's Arlo's world and we're all living in it.):
CREATE (olivia:Person { name:"Olivia", age:26 })
CREATE (arlo:Dog { name:"Arlo", age:4 } )
CREATE (carly:Person {name:"Carly", age:27 } )
CREATE (leroy:Dog { name:"Leroy", age:3 })
CREATE (madeline:Person { name:"Madeline", age:24 })
@frytoli
frytoli / osx_pyicu.md
Last active September 3, 2021 05:25

Installing Pyicu on Mac

Install icu4c and get the version

$ brew install icu4c

Do what homebrew tells you to do: set necessary env variables

@frytoli
frytoli / TPS.py
Last active November 12, 2018 15:52
#!/usr/bin/env python3
from selenium.webdriver.firefox.options import Options
from pyvirtualdisplay import Display
from configparser import ConfigParser
from stem.control import Controller
from selenium import webdriver
from datetime import datetime
from bs4 import BeautifulSoup
from stem import Signal