Skip to content

Instantly share code, notes, and snippets.

View paul-english's full-sized avatar

Paul English paul-english

View GitHub Profile
import os
import sqlite3
from xml.etree.ElementTree import iterparse
from tqdm import tqdm
import json
def create_database(dbname: str):
# Create a connection to the SQLite database
conn = sqlite3.connect(dbname)
### version information
```
pre-commit version: 2.18.1
git --version: git version 2.32.0 (Apple Git-132)
sys.version:
3.9.7 (default, Sep 16 2021, 08:50:36)
[Clang 10.0.0 ]
sys.executable: /Users//opt/anaconda3/bin/python
os.name: posix
@paul-english
paul-english / keybase.md
Created March 17, 2022 17:48
keybase.md

Keybase proof

I hereby claim:

  • I am paul-english on github.
  • I am log0ymxm (https://keybase.io/log0ymxm) on keybase.
  • I have a public key whose fingerprint is 09EA 4D46 DD08 D8E3 CEC3 AA7C A967 2C1A 03D1 840A

To claim this, I am signing this object:

<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
@paul-english
paul-english / unisplat.py
Created August 16, 2021 19:25
Convert uniprot_trembl to massive csv
from tqdm import tqdm
import csv
order = [
"",
"ID",
"AC",
"DT",
"DE",
"GN",
@paul-english
paul-english / redis_disjoint_set.py
Created December 27, 2019 19:17
Redis Disjoint Set
import random
class RedisDisjointSet(object):
"""
https://en.wikipedia.org/wiki/Disjoint-set_data_structure
UTF-8 based persistent disjoint set structure that just assumes there's a local redis
"""
def __init__(self, seed=None):
@paul-english
paul-english / gist:f1f9527fdeed923ce11c70e4713d3c62
Created September 4, 2019 22:09
unlocked screen one liner
echo "echo 'sleep 1' >> ~/.profile" >> ~/.profile
create table penglish_scratch.naics_desc_lookup (
code varchar(6) sortkey distkey,
description varchar(255)
);
insert into penglish_scratch.naics_desc_lookup values
('11', 'Agriculture, Forestry, Fishing and Hunting'),
('111', 'Crop Production'),
('1111', 'Oilseed and Grain Farming'),
@paul-english
paul-english / parse_elixir_dump_column.py
Created April 19, 2019 20:48
We have some database columns that are a dumping ground for Elixir maps, elixir keyword lists, elixir structs, html, xml, & JSON. This parses them all.
from lark import Lark
l = Lark('''
?start: elixir_item | json_value | xml | node
///////////////////////
// JSON
?json_value: json_object
| json_array
import requests
from slackclient import SlackClient
DAYS = 1
FTL_URL = "https://backend.thefoodtruckleague.com/events/?days=%s&name=" % DAYS
SLACK_TOKEN = ""
def post_food_trucks_for_the_day():
sc = SlackClient(SLACK_TOKEN)