Skip to content

Instantly share code, notes, and snippets.

View garfieldnate's full-sized avatar

Nathan Glenn garfieldnate

View GitHub Profile
garfieldnate / TRG Projects NathanG Knows About
Last active August 29, 2015 13:56
These are all of the projects I can remember having worked on with TRG. I'll update it if I think of more, or you can fork it and add more if you'd like.
The following are hosted on GitHub:
read/edit/write TBX-Min data
convert between UTX, TBX-Min and TBX-Basic.
convert MRC to TBX-Basic
read XCS files
garfieldnate / knowledge.txt
Last active August 29, 2015 13:56
WICS Knowledge Transfer
First, you can go and watch an intro video on ITS here:
Here's the ITS 2.0 specification: I recommend reading sections 1 and 2 straightaway.
The ITS Interest Group mailing archive:
You can join and ask good questions. You'll find lots from me. But do make sure they are good questions about ITS.
You can go and watch an intro video on WICS here:
Here are the GitHub repositories. The first two are managed by Logrus, and I have a commit bit to the converter one. The third repo is managed by us and is a fork of the converter repo managed by Logrus (please use it and not the Logrus one). It has the added functionality of a WICS "project", as well as some bug fixes:
garfieldnate /
Last active August 29, 2015 14:07
List non-ascii characters in input file
# This will look through an input utf8 file and print a list
# of all of the non-ascii characters found there. Not good for
# big files, since it stores and sorts all occurrences.
use strict;
use warnings;
use charnames ':full';
binmode STDOUT, 'utf8';
open my $fh, '<:utf8', $ARGV[0];
garfieldnate /
Last active October 9, 2020 09:16
Python 2/3 version of imgcat tool, which displays images inline in iTerm2
from __future__ import print_function
import base64
import os
import select
import sys
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
garfieldnate / build.gradle
Created July 8, 2018 14:27
Example gradle build that uploads to Bintray and Maven Central
// Useful tasks:
// (default) jar: creates library jar
// fatJar: creates executable jar
// bintrayUpload: performs full publishingTasks/publication
apply plugin: 'java'
wrapper {
gradleVersion = '4.8.1'
garfieldnate /
Last active January 12, 2020 09:17
Parse CSV vocab output from ThaiDict app
# Parse CSV vocab output from ThaiDict app
import csv
import sys
# from tango.tango import model
def row_to_vocab(row):
v = {
'headword': row['th'],
'pronunciation': row['pron'],
garfieldnate /
Created May 11, 2021 14:07
check that your handling of global variables in a Jupyter notebook is clean
import inspect
from IPython.display import display, HTML
def html(s):
return display(HTML(s))
def ok(message="OK"):
html(f"<div class=\"alert alert-block alert-success\">{message}</div>")
def _acceptable_global(name, value):
garfieldnate /
Created January 12, 2022 17:00
assert command output in Bash
pass() {
# bold green
echo -e "$(tput setaf 2)$(tput bold)$message$(tput sgr 0)"
fail() {
garfieldnate /
Created July 14, 2022 09:42
Create custom user dictionary for use in MeCab through Fugashi
# Generate custom MeCab dictionary to be used with unidic-lite
import sys
from fugashi.fugashi import build_dictionary
import unidic_lite
args = (
Dynamic Linker Bug