Skip to content

Instantly share code, notes, and snippets.

@biinari
biinari / extract-123-reg-zonefile.js
Last active February 8, 2023 14:23
Script to extract the DNS entries from 123-reg advanced dns page
// Moved to a new home at https://github.com/biinari/zonefile-extract/tree/master/123-reg
@linville
linville / country_code_to_emoji_extras.py
Last active April 15, 2017 02:42
A Django template filter to convert a country code to its corresponding Emoji flag.
from django import template
register = template.Library()
OFFSET = ord('🇦') - ord('A')
@register.filter
def flag(code):
return chr(ord(code[0]) + OFFSET) + chr(ord(code[1]) + OFFSET)
# Example:
# flag("US") = "🇺🇸"
@walkermatt
walkermatt / debounce.py
Created June 4, 2012 21:44
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():