Skip to content

Instantly share code, notes, and snippets.

@emk
emk / rpctest.c
Created April 22, 2011 17:43
XML-RPC for C code snippet (revision 1.10 of xmlrpc_data.c and 1.23 of rpctest.c, from ~10 years ago)
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
@emk
emk / 00_README.md
Last active July 10, 2023 02:33
Anki subs2srs card template, with optional hint and note

To use these templates, you'll need to create a new Anki "note type" with the following fields:

  • Sound
  • Time
  • Source
  • Image
  • Target: line
  • Base: line
  • Target: line before
  • Base: line before
@emk
emk / HieroTeX.py
Created July 22, 2012 16:47
Anki 2 Egyptian Hieroglyph support
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
# Hacked to support HieroTeX by Eric Kidd.
import re, os, sys, shutil, cgi, subprocess
from anki.utils import checksum, call, namedtmp, tmpdir, isMac, stripHTML
from anki.hooks import addHook
from htmlentitydefs import entitydefs
from anki.lang import _
@emk
emk / Larousse.py
Created April 9, 2012 11:09
Anki plugin for looking up words in Larousse's native French dictionary
# Based on the ImageDownloader plugin. Quick, dirty and dodgy.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import urllib
from lxml import etree
from ankiqt.ui.facteditor import FactEditor
from ankiqt.ui.utils import showInfo
@emk
emk / phase.ks
Created February 18, 2018 20:36
Kerbal Space Program satellite orbit phasing using kOS and MechJeb
// Change the phase of your orbit, that is, advance yourself a certain
// amount of time along the same orbit path.
//
// See https://en.wikipedia.org/wiki/Orbit_phasing for the math and lots
// of explanations.
//
// AUTHOR: Eric Kidd.
//
// REQUIREMENTS: To run this, you'll need Kerbel Space Program, the kOS mod,
// and a computer on your craft.
@emk
emk / apache-logs-hive.sql
Created January 3, 2012 18:01
Apache log analysis with Hadoop, Hive and HBase
-- This is a Hive program. Hive is an SQL-like language that compiles
-- into Hadoop Map/Reduce jobs. It's very popular among analysts at
-- Facebook, because it allows them to query enormous Hadoop data
-- stores using a language much like SQL.
-- Our logs are stored on the Hadoop Distributed File System, in the
-- directory /logs/randomhacks.net/access. They're ordinary Apache
-- logs in *.gz format.
--
-- We want to pretend that these gzipped log files are a database table,
@emk
emk / INSTRUCTIONS.txt
Created July 10, 2012 14:03
mkcards: Turn DVD audio or songs into Anki cards
This toolkit will allow you turn TV episodes and transcriptions into
high-quality Anki cards. Quite a lot of assembly is required the first
time through, but after that, 90% of your effort will be (1) either looking
at the text or (2) aligning the start and end of each audio clip using a
halfway civilized tool. In other words, it's still going to take time, but
you'll actually spend that time studying the language, not messing around
with a 19-step process.
There's a good chance you can this working on a Mac or on Linux. Windows
will be a fairly major challenge.
@emk
emk / link_to.rb
Created April 20, 2009 01:21
A link_to helper method for Sinatra
@emk
emk / lexique2-import.sql
Created September 6, 2014 13:19
Import Lexique 3 French vocabulary data into MySQL
-- Using Lexique 3 from http://lexique.org/ with SQLite 3.
--
-- On the command line, to remove header and extract the first 10 columns.
-- iconv -f ISO-8859-15 -t UTF-8 Lexique380/Bases+Scripts/Lexique380.txt | tail -n+2 | cut -f 1-10 > lexique1-10.txt
-- Set up our original data table. This is pretty raw.
PRAGMA encoding = "UTF-8";
CREATE TABLE lexique (
ortho TEXT,
phon TEXT,
@emk
emk / nginx-proxy-taskdef-draft.json
Created May 14, 2017 21:22
nginx-proxy ECS config (untested)
{
"containerDefinitions": [
{
"name": "nginx-proxy",
"image": "771600087445.dkr.ecr.us-east-1.amazonaws.com/nginx-proxy:latest",
"memory": "128",
"essential": true,
"portMappings": [
{
"hostPort": "443",