Skip to content

Instantly share code, notes, and snippets.

View jamespacileo's full-sized avatar
🎯
Focusing

James Pacileo jamespacileo

🎯
Focusing
View GitHub Profile
// countryNames.ts
import countryNames from './country-names.json';
export function getCommonCountryName(inputName: string): string | undefined {
const normalizedInput = inputName.replace(/\s*\(the\)\s*/i, '').trim();
return countryNames[normalizedInput] || undefined;
}
// countryNames.test.ts
import json
import urllib.request
import re
def main():
url = 'https://raw.githubusercontent.com/mledoze/countries/refs/heads/master/countries.json'
response = urllib.request.urlopen(url)
data = json.loads(response.read().decode())
mapping = {}
@jamespacileo
jamespacileo / hm_adapted_codes.csv
Created October 29, 2021 14:37
UN Commodity codes
We can't make this file beautiful and searchable because it's too large.
Commodity code,Suffix,HS Level,Indent,Description,SID,Parent SID
01,,,,Animals; live,01,TOTAL
0101,,,,"Horses, asses, mules and hinnies; live",0101,01
010121,80,,,"Horses; live, pure-bred breeding animals",010121,0101
010129,80,,,"Horses; live, other than pure-bred breeding animals",010129,0101
010130,80,,,Asses; live,010130,0101
010190,80,,,Mules and hinnies; live,010190,0101
0102,,,,Bovine animals; live,0102,01
010221,80,,,"Cattle; live, pure-bred breeding animals",010221,0102
010229,80,,,"Cattle; live, other than pure-bred breeding animals",010229,0102
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@jamespacileo
jamespacileo / gist:1437825
Created December 6, 2011 11:16
Awesome Python libs