openpgp4fpr:1CBD499C61C7A3A7DED3935F5E21C0D40ED9EB54
View qrcodes.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Spoiler: | |
# $ ./qrcodes.sh | sort | head | |
# 416 http://7c.dblu.me | |
# 416 https://j.dblu.me | |
# 416 http://wc.dblu.me | |
# 420 http://2E.dblu.me | |
# 420 http://73.dblu.me | |
# |
View playlists_from_itunes_xml.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import libpytunes # https://github.com/liamks/libpytunes | |
if __name__ == '__main__': | |
l = libpytunes.Library('iTunes Music Library.xml') | |
with open('playlists.txt', 'w', encoding='utf-8') as f: | |
for p in l.getPlaylistNames(): | |
if p not in ('Downloaded', 'Audiobooks', 'Voice Memos', 'Not One Star Rating'): | |
f.write(p) |
View city_names.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# From https://hackernoon.com/how-to-lose-an-it-job-in-10-minutes-3d63213c8370 | |
# | |
# Find cities whose names are rotated versions of other cities. | |
# | |
# Given: ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris'] | |
# | |
# Return: | |
# | |
#[[ 'Tokyo', 'Kyoto' ], |
View fathers_day_puzzle2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View fathers_day_puzzle3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. | |
# | |
# ( )---( )---( ) | |
# | | | |
# ( )---( )---( )---( ) ( ) | |
# | | | |
View confluence_markup.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
View first_attempt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
View gist:f1356788354e4fe684d0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying I am +dblume on my passcard. https://onename.com/dblume |
View acid_write_file.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import platform | |
import tempfile | |
import ntpath | |
import filelock # https://github.com/dmfrey/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: http://blog.gocept.com/2013/07/15/reliable-file-updates-with-python/ |
NewerOlder