Skip to content

Instantly share code, notes, and snippets.


Darien DHager

  • Seattle, WA
View GitHub Profile
from datetime import datetime
from os import path
import sys
import shutil
from PIL import Image
__author__ = 'Darien Hager'
class SteamScreenImport:
DHager /
Created August 4, 2016 00:56
An experiment to try to reproduce part of the "openssl" command line tool's behavior through Python. See blog post:
import sys
import itertools
import binascii
import StringIO
from Crypto.Hash import SHA, MD5
from Crypto.Cipher import AES, ARC4
from Crypto import Random
DHager /
Created December 3, 2015 21:19
Advent of Code Day 3
from collections import Counter
class Santa:
def __init__(self):
self.position = [0,0]
self.path = [tuple(self.position)]
def move(self, char):
DHager / coredump.php
Created December 3, 2015 20:42
Tries to cause a core-dump so that you can test your PHP/Apache/OS configuration to make sure they are being saved
View coredump.php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$pid = getmypid();
$secs = 10;
$cmd = "kill -3 $pid";
DHager /
Created December 2, 2015 07:41
Advent of Code Day 2
from itertools import combinations
import operator
def wrapNeeded(dims):
sides = combinations(dims,2)
halfAreas = map(lambda (a,b): a*b, sides)
return sum(halfAreas)*2 + min(halfAreas)
View lockfile_check.php
#!/usr/bin/env php
* If composer.json references a project that has a git directory in the vendor
* folder, and that depdencency is set to track the "latest" of a branch, then
* try to validate that the lockfile-version hasn't been outpaced.
class GitUtils{
DHager / transcribed_html5_video.html
Last active April 30, 2019 21:28
Something I whipped up for a Seattle Startup Weekend event, provides a "transcript" of a video based on its closed-captioning data, and allows you to use the text to seek in the video.
View transcribed_html5_video.html
<script type="text/javascript" src="jquery-1.11.0.js"></script>
#transcript {
View prepare-commit-msg
branchPath=$(git symbolic-ref -q HEAD) #Somthing like refs/heads/myBranchName
branchName=${branchPath##*/} #Get text behind the last / of the branch path
if [[ $branchName =~ tickety([[:digit:]]+) ]]; then
heading="TICKETY-$bnum \/\/";
heading="($branchName) ";
DHager / reddit_bc2_tags.user.js
Created June 18, 2011 08:10
User-tagger for Bad Company 2 on Reddit
View reddit_bc2_tags.user.js
// ==UserScript==
// @name BC2 Subreddit user info
// @author Darien Hager
// @namespace
// @version 1.0.0
// @description Provides extra information inside the Bad Company 2 subreddit
// @include*
// @include*
// ==/UserScript==
DHager /
Created June 17, 2011 01:59
Overrides behavior on Apache commons-configuration so that the property-file include mechanism "overwrites" older values
package com.technofovea.springtest;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;