Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
I may be slow to respond.

taryn phrohdoh

🤔
I may be slow to respond.
View GitHub Profile
@phrohdoh
phrohdoh / language.dll.txt
Created Feb 11, 2018
Age of Empires (1997) language.dll
View language.dll.txt
{
101: "1",
102: "Copperplate Gothic Light",
103: "Comic Sans MS",
104: "Arial",
110: "Copperplate Gothic Light",
111: "12",
112: "B",
113: "Copperplate Gothic Light",
114: "21",
@phrohdoh
phrohdoh / empires-helper.jq
Last active Feb 8, 2018
Querying the Age of Empires 1997 database (`empires.dat`) with jq and a custom `empires2json` tool
View empires-helper.jq
# Requires: jq 1.5
##########
# Hello and welcome!
# Quick note: Comments in a jq program file (which this is!) begin with a '#'.
#
# The comments in this file assume you have ran `empires2json` on your AoE's `empires.dat` file
# and stored the result in a `empires-dat.json` file on disk.
#
# To make use of this file you will need `jq` 1.5 (or a later version) installed (see https://stedolan.github.io/jq/).
@phrohdoh
phrohdoh / loaddata-helper.jq
Created Feb 3, 2018
Filter out fixture object via jq for django's `loaddata` command
View loaddata-helper.jq
# Requires: jq 1.5
# Steps to use this filter:
# 1) dump your db via `python manage.py dumpdata -o mydata.json`
# 2) delete your db entirely via `rm db.sqlite3`
# 3) create a new db via `python manage.py migrate`
# 4) modify the `blacklist` below to include any `model`s you don't want to re-import (ones that `migrate` added, for example)
# 5) run your `mydata.json` file through this filter file like so `cat mydata.json | jq -f loaddata-helper.jq`, verify the output
# 6) run the above again this time redirecting stdout to a file (possibly overwriting your original json) `cat mydata.json | jq -f loaddata-helper.jq > myfixture.json`
# 7) create a django 'fixture' (which app you put it in doesn't matter, afaik) `mkdir -p apps/someapp/fixtures/ && mv myfixture.json $_`
@phrohdoh
phrohdoh / snake_to_pascal.bash
Created Jan 22, 2018
Convert snake-case string to pascal-case and print as C# properties
View snake_to_pascal.bash
function snake_to_pascal() {
# NOTE: Only use `gsed` if you are running macOS (install `gsed` via `brew install gnu-sed`),
# else change to `sed`.
echo "$1" | gsed 's/_\([a-z]\)/\U\1/g;s/^\([a-z]\)/\U\1/g' | xargs printf "[JsonProperty(\"$1\")]\npublic object %s { get; set; }\n"
}
snake_to_pascal 'id'
snake_to_pascal 'first_name'
snake_to_pascal 'last_name'
snake_to_pascal 'age'
@phrohdoh
phrohdoh / CLA.md
Last active Oct 19, 2017 — forked from CLAassistant/SAP_CLA
Individual Contributor License Agreement
View CLA.md

Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by Taryn Hill (“Taryn”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Taryn in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact taryn@phrohdoh.com.

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.

Copyright License. You hereby grant, and agree to grant, to Taryn a non-exclusive, perpetual, irrevocable, worldwide, fully-pa

@phrohdoh
phrohdoh / work_queue.rs
Created Aug 30, 2017 — forked from NoraCodes/work_queue.rs
An example of a parallel work scheduling system using only the Rust standard library
View work_queue.rs
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@phrohdoh
phrohdoh / Cargo.toml
Last active Aug 28, 2017
Run a Mono/CIL executable via Rust
View Cargo.toml
[package]
authors = ["Taryn Hill <taryn@phrohdoh.com>"]
name = "libdotnet"
version = "0.1.0"
[dependencies]
libc = "0.2.29"
libloading = "0.4.0"
View example.xml
<root>
<Trait FullName="OpenRA.Mods.Common.Traits.EjectOnDeath"
Description="Eject a ground soldier or a paratrooper while in the air.">
<Field Name="PilotActor"
Kind="System.String"
Description="Name of the unit to eject. This actor type needs to have the Parachutable trait defined."
DefaultValue="E1"></Field>
<Field Name="SuccessRate"
Kind="System.Int32"
Description="Probability that the aircraft's pilot gets ejected once the aircraft is destroyed."
@phrohdoh
phrohdoh / Guardian GI (GGI)
Created Feb 17, 2017
Red Alert 2: Yuri's Revenge voice sets
View Guardian GI (GGI)
iggiat2a: <missle launcher sounds>
iggiat2b: <missle launcher sounds>
iggidia: <death sounds>
iggidib: <death sounds>
iggidic: <death sounds>
iggidid: <death sounds>
iggidie: <death sounds>
iggiata: "He's mine!"
@phrohdoh
phrohdoh / uninstall-pkg.bash
Last active Mar 28, 2017
Bash script to uninstall macOS 'pkg's
View uninstall-pkg.bash
#!/bin/bash
# I highly suggest you run this with `--dry-run` and read the output before
# you actually uninstall any packages with this script.
# Example usage:
# ./uninstall-pkg.bash powershell --verbose --dry-run
# LICENSE: MIT
# Copyright 2017 Taryn Hill <taryn@phrohdoh.com>