Skip to content

Instantly share code, notes, and snippets.

Tom Moertel tmoertel

Block or report user

Report or block tmoertel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:7991030
Tom Moertel <tom@moertel.com>
2013-12-16
We are given the following problem:
Given a text file with 999,999 lines, one number per line,
numbers in random order from 1 to 1,000,000 but a single number is
missing, figure out what number is missing.
Source: http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html#comment-1165807320
@tmoertel
tmoertel / gist:7968466
Last active Dec 31, 2015
The following proof is a solution to the exercise I offered to readers in the blog post [A Great Old-Timey Game-Programming Hack](http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html).
View gist:7968466
Tom Moertel <tom@moertel.com>
2013-12-14
The following proof is a solution to the exercise I offered to readers
in the following blog post:
"A Great Old-Timey Game-Programming Hack"
http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html
@tmoertel
tmoertel / gist:7586779
Last active Dec 29, 2015
Summary of crashes in Android apps that use Chromecast device discovery
View gist:7586779
Summary: A few days ago, some Chromecast-supporting Android apps
started crashing upon launch. Other Android apps, notably YouTube,
remain unaffected, as do iOS apps and Chromecast support in Chrome
(see table below). Today, I discovered that these crashes go away
when I remove the SONOS BRIDGE device that connects my SONOS audio
system to the same network.
My hypothesis: There is some interaction between the Chromecast
device-discovery logic and the SONOS bridge's presence on the network
that causes the problem. The most likely explanation for why these
@tmoertel
tmoertel / gist:5798134
Last active Jun 25, 2019
How to transform the vanilla recursive fib function into the iterative DP version through a series of mechanical steps.
View gist:5798134
# Transforming the vanilla recursive fib into the iterative DP version
# through a series of mechanical steps.
#
# For more on converting recursive algorithms into iterative ones, see:
# http://blog.moertel.com/posts/2013-05-11-recursive-to-iterative.html
# original function
def fib(n):
@tmoertel
tmoertel / diskdiffs.R
Created Apr 29, 2012
Small R script to visualize bit differences between two disk images
View diskdiffs.R
library(ggplot2)
library(scales)
library(plyr)
library(reshape2)
disk_errors <- read.csv("disk_errors.csv", header=F)
names(disk_errors) <- c("byte_offset", "bit", "a", "b")
disk_errors <- mutate(disk_errors,
bit = factor(bit),
@tmoertel
tmoertel / cmpdisks.py
Created Apr 29, 2012
Compare two disk images and emit CSV file listing bit-position differences
View cmpdisks.py
#!/usr/bin/env python
#
# Compare two disk images for bit differences.
# Usage: ./cmpdisks.py diskA.dsk diskB.dsk
#
# Tom Moertel <tmoertel@gmail.com>
# 2012-04-29
import sys
@tmoertel
tmoertel / gist:177024
Created Aug 28, 2009
Puppet can't find class
View gist:177024
class x {
notify { xn: message => "x" }
}
define y() {
notify { yn: message => "y", require => Class["x"] }
}
y { "test": }
View gist:175795
# The Puppet definition below produces following error when called as
# set_up_service_with_ssh_key("X"):
#
# err: Could not create ssh key Y for X: user X doesn't exist
#
# But the ssh_authorized_key resource requires User["X"].
# Am I missing something?
define set_up_service_with_ssh_key($service_name) {
View gist:94874
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<base href="http://yapc10.org/yn2009/" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="alternate" type="application/atom+xml" title="YAPC|10"
View gist:91328
From: Tom Moertel <tom@moertel.com>
To: Perl trainers and instructors:;
Reply-To: organizers@yapc10.org
Subject: YAPC|10: CALL FOR COURSES
At YAPC|10, we're handling courses and training a bit differently than
at previous YAPCs. We are making the official Call For Courses soon,
but because you have led Perl training at past YAPCs or have indicated
interest in offering courses at YAPC|10, we wanted to let you know
directly. If you know of anybody else who would want to know, please
You can’t perform that action at this time.