Skip to content

Instantly share code, notes, and snippets.

View linville's full-sized avatar

Aaron Linville linville

View GitHub Profile
@linville
linville / pf_to_web.c
Last active April 24, 2016 02:02
Simple program to grab statistics from OpenBSD's PF using C.
/*
A simple program to show how to grab statistics from OpenBSD's pf using C.
gcc pf_to_web.c
sudo ./pf_to_web
Aaron Linville
http://www.linville.org/
*/
@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") = "🇺🇸"