Skip to content

Instantly share code, notes, and snippets.

@Rostepher
Rostepher / damerau_levenshtein.c
Last active October 5, 2018 22:05
A working implementation of the Damerau-Levenshtein distance in C.
// based on the implementation found at:
// https://stackoverflow.com/questions/10727174/damerau-levenshtein-distance-edit-distance-with-transposition-c-implementation
//
// still deciphering the alogrithm from the cryptic vairable names, hopefully thie implementation below
// is easier to read and understand.
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@caged
caged / create-psql-database.sh
Last active March 1, 2023 06:15
Shell script to import data into Postgres from https://www.nhgis.org. If you use this, you'll need to edit line 14 to include the census data you're importing.
#!/bin/sh
# usage ./create-psql-database DATABASE
#
DB_NAME=$1
FOLDER_NAME="nhgis0004"
# Drop and recreate database
dropdb --interactive "${DB_NAME}"
createdb --encoding UTF8 $DB_NAME