Skip to content

Instantly share code, notes, and snippets.

Dan Bader dbader

Block or report user

Report or block dbader

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
View keybase.md

Keybase proof

I hereby claim:

  • I am dbader on github.
  • I am dbader (https://keybase.io/dbader) on keybase.
  • I have a public key whose fingerprint is 12AC D215 8A24 4231 3896 2DC4 9620 F0F0 BD62 F215

To claim this, I am signing this object:

View python_parallel_map_reduce_wordcount.py
import concurrent.futures
import functools
import operator
import time
from pprint import pprint
TEXT = """Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis.
Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.
Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris
View roger-before-after.py
# LetterStart python script
import uno, datetime
#from datetime import date
# a UNO struct later needed to create a document
###############################################################################
def createDoc():
"""creates a new writer document and prints my name and address at the top right """
View py-abc-vars-props.py
from abc import ABCMeta, abstractmethod
class Base(metaclass=ABCMeta):
def __init__(self):
self.my_attrib = 42
@abstractmethod
def foo(self):
pass
View gist:3f9adca03e655b90c2b8
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width = 16;
canvas.height = 16;
ctx.fillStyle = '#F00'; // <- Pick a colour.
ctx.fillRect(0, 0, canvas.width, canvas.height);
var favicon = document.getElementsByTagName('link')[0];
@dbader
dbader / chrome-ios-minimal-testcase.html
Last active Aug 29, 2015
Broken on Chrome iOS: 32.0.1700.20, latest known good is Chrome iOS: 21.0.1180.82
View chrome-ios-minimal-testcase.html
<!DOCTYPE html>
<html>
<head>
<script>document.write('<plaintext>');</script>
</head>
<body>
<!--
@dbader
dbader / fontdemo.py
Last active Nov 1, 2019
For my Raspberry Pi internet radio project I needed a way to render text suitable for a low resolution monochrome LCD. This article describes how to render 1-bit text using FreeType and Python. See http://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python
View fontdemo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Needs freetype-py>=1.0
# For more info see:
# http://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python
# The MIT License (MIT)
#
# Copyright (c) 2013 Daniel Bader (http://dbader.org)
You can’t perform that action at this time.