Skip to content

Instantly share code, notes, and snippets.

@tofi86
tofi86 / input.xml
Last active June 28, 2018 13:27
In XSLT, get a string that contains every character used in an XML input document exactly one time (no duplicates)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element>This is some sample text string with <bold>inline markup</bold> &amp; some special characters.</element>
<element>Also, named (&lt;), decimal (&#62;) and hexadecimal (&#x00A2;) entities should be respected.</element>
</root>
@tcg
tcg / comfort_sweet.py
Last active December 11, 2015 20:09
Something Sweet to Comfort some folks that are tired of checking the box. Bloated requirements, but it works. Want to skip Requests and use something more native? DO IT! Updated! Now: More bloat! But less rude, and works FASTER! YAY!
import requests # `pip install requests`; DO IT!
import time
import sys
class ComfortSweet:
TIME_THRESHOLD = 30 # seconds
LAST_ATTEMPT = 0
@mushkevych
mushkevych / repeat_timer.py
Created March 19, 2012 01:08
RepeatTimer class
"""
Created on 2011-02-10
@author: Bohdan Mushkevych
@author: Brian Curtin
http://code.activestate.com/lists/python-ideas/8982/
"""
from datetime import datetime
import threading
@chrisvaughn
chrisvaughn / areopress.yaml
Created March 17, 2012 16:08
Coffee Recipes
ingredients:
- coffee:
amount : 17g
grind : fine (10 clicks on Hario MSS-1B)
- water:
amount : 200g
temp : 200° (30 seconds off boil)
prep:
- preheat aeropress with hot water
- rinse filter with hot water
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText