Skip to content

Instantly share code, notes, and snippets.

@phrohdoh
phrohdoh / empires-helper.jq
Last active December 2, 2022 06:51
Querying the Age of Empires 1997 database (`empires.dat`) with jq and a custom `empires2json` tool
# 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 / slp.txt
Created July 13, 2016 00:25
Age of Empires 1997 SLP format
What follows is a description of the SLP format.
The actual author wishes to remain unknown, please email bryce@lanset.com with
your questions. However, I did not write this document.
Header
This structure totals 32 bytes and is packed to 1-byte boundaries.
typedef struct Shape_File_Header
{
@phrohdoh
phrohdoh / snippets.clj
Last active May 26, 2021 11:39
assorted clojure snippets
;; -----------------------------------------------------------------------------
(require '[clojure.spec.alpha :as spec]
#_'[clojure.string :as str]
#_'[clojure.edn :as edn]
#_'[clojure.java.io :as io]
;; non-stdlib deps
'[clojure.spec.gen.alpha :as spec-gen] ;; org.clojure/test.check 1.1.0
'[clojure.data.json :as json] ;; org.clojure/data.json 2.3.1
#_'[datascript.core :as ds] ;; datascript 1.1.0
#_'[datascript.transit :as dsts]) ;; datascript-transit 0.3.0
@phrohdoh
phrohdoh / CSharpClass.cs
Created October 15, 2014 06:10
IronPython scripting for C#
using System;
namespace CSharpLib
{
public class CSharpClass
{
public int Add(int a, int b)
{
return a + b;
}
@phrohdoh
phrohdoh / _.md
Last active August 4, 2020 15:22
AutoPets Whisker mobile app snippets

fake activities for lib/litter/status/litter_status_tab.dart's _buildRecentActivitySection

    final fakeActivities = List<LitterRobotActivity>.from(
      LitterRobotUnitStatus.values.map(
        (unitStatus) => LitterRobotActivity(
          litterRobotId: 'x',
          unitStatus: unitStatus,
          timestamp: DateTime.now()
              .subtract(Duration(seconds: Random().nextInt(60 * 60 * 8))),
" vim-plug {{{
call plug#begin('~/.nvim/plugged')
Plug 'git@github.com:kien/ctrlp.vim.git'
Plug 'git@github.com:scrooloose/syntastic.git'
Plug 'git@github.com:itchyny/vim-cursorword.git'
Plug 'git@github.com:itchyny/lightline.vim.git'
Plug 'git@github.com:vim-scripts/Align.git'
Plug 'git@github.com:terryma/vim-multiple-cursors.git'
Plug 'git@github.com:mhinz/vim-startify.git'
@phrohdoh
phrohdoh / ynab-cli.py
Created April 30, 2019 17:20
A highly-specific Python 3 script operating on YNAB API JSON
#!/usr/bin/env python3
####
#
# Invoke like this:
#
# $ ./ynab.py ./data.json
#
# -or-
#
@phrohdoh
phrohdoh / ynab_v1.openapi_v3.yaml
Created April 30, 2019 15:22
YNAB API v1 OpenAPI v3 YAML
openapi: 3.0.0
info:
description: Our API uses a REST based design, leverages the JSON data format, and relies
upon HTTPS for transport. We respond with meaningful HTTP response codes and
if an error occurs, we include error details in the response body. API
Documentation is at https://api.youneedabudget.com
version: 1.0.0
title: YNAB API Endpoints
tags:
- name: User
@phrohdoh
phrohdoh / ynab.openapi.yaml
Last active April 30, 2019 15:21
YNAB API v1 OpenAPIv2 YAML
swagger: '2.0'
info:
description: 'Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com'
version: 1.0.0
title: YNAB API Endpoints
schemes:
- https
host: api.youneedabudget.com
basePath: /v1
tags:
@phrohdoh
phrohdoh / interceptor.bash
Last active April 8, 2019 15:34
Intercept process I/O via `tee` and write to customizable log file locations
#!/usr/bin/env bash
##### What / Why / How #####
#
# - What
#
# This script makes it simple to intercept, typically for viewing by a human,
# the stdin and stdout of a process, such as a language server binary.
#
#