Skip to content

Instantly share code, notes, and snippets.

David Blume dblume

Block or report user

Report or block dblume

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
dblume /
Created Jul 3, 2018
A Python solution to the "How to Lose an IT Job in 10 Minutes" puzzle
#!/usr/bin/env python
# From
# Find cities whose names are rotated versions of other cities.
# Given: ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
# Return:
#[[ 'Tokyo', 'Kyoto' ],
dblume /
Created Jun 30, 2018
Father's Day puzzle #2: Smallest number with persistence five.
#!/usr/bin/env python
# Father's Day Card Puzzle #2
# A number's persistence is the number of steps to reduce it to a single
# digit by multiplying all its digits to obain a second number, then
# multiplying all the digits of that number to obtain a third number, and so
# on until a one-digit number is obtained.
# For example 77 has a persistence of four because it requires four steps to
# reduce it to one digit: 77 -> 49 -> 36 -> 18 -> 8. The smallest number of
# persistence one is 10. The smallest number of persistence two is 25. The
dblume /
Last active Jul 5, 2018
Father's Day Puzzle #3, sort of like a magic square, but not a square.
#!/usr/bin/env python
# Father's Day card puzzle #3:
# In the figure below, fill in each of the sixteen numbers from 1 to 16 such
# that the four rows and three columns add up to 29.
# ( )---( )---( )
# | |
# ( )---( )---( )---( ) ( )
# | | |
dblume / confluence_markup.lua
Last active Apr 5, 2017
Script for converting to Atlassian Confluence's markup with Pandoc.
View confluence_markup.lua
-- confluence_markup.lua
-- A Pandoc Atlassian Confluence Markup Writer
-- Invoke with: pandoc -to confluence_markup.lua
-- Based on pandoc/data/sampsdfsle.lua and zhzhxtrrk's "pandoc confluence markup writer"
-- Fixes tables and lists of lists
local image_index = 0
dblume /
Last active Aug 29, 2015
Ways to Break a Dollar into Change
def ways_to_break(amount, coins):
:param amount: the monetary value to break into some number of coins
:param coins: a container of descending coin denominations
:return: the number of different ways to break amount into coins
this_coin = coins[0]
# If this is the only coin, there's one way to break it.
if len(coins) == 1:
dblume / gist:f1356788354e4fe684d0
Created May 13, 2015
Username squatting at
View gist:f1356788354e4fe684d0
Verifying I am +dblume on my passcard.
dblume /
Last active Sep 25, 2015
Cross-platform nearly ACID file updates
import platform
import tempfile
import ntpath
import filelock #
# It's interesting to see what's different between Windows and Linux.
# On Windows, you can't rename to an existing file, and you can't
# use os.fdatasync().
# Also see:
dblume / menus.plugin.php
Created Jan 23, 2014
The version of system/plugins/menus/menus.plugin.php that I got today from Habari
View menus.plugin.php
* Menus
* @property Vocabulary $vocabulary The Vocabulary object used to hold the menu
* @todo allow renaming/editing of menu items
* @todo style everything so it looks good
* @todo show description with name on post publish checkboxes
* @todo PHPDoc
You can’t perform that action at this time.