This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
import unittest | |
from mock import * | |
from datetime import datetime, timedelta | |
import time # so we can override time.time | |
mock_time = Mock() | |
mock_time.return_value = time.mktime(datetime(2011, 6, 21).timetuple()) | |
class TestCrawlerChecksDates(unittest.TestCase): | |
@patch('time.time', mock_time) |
def fill_page_with_image(path, canvas): | |
""" | |
Given the path to an image and a reportlab canvas, fill the current page | |
with the image. | |
This function takes into consideration EXIF orientation information (making | |
it compatible with photos taken from iOS devices). | |
This function makes use of ``canvas.setPageRotation()`` and | |
``canvas.setPageSize()`` which will affect subsequent pages, so be sure to |
import os | |
import fcntl | |
from gevent.core import wait_read, wait_write | |
class GeventFD(object): | |
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent. | |
>>> stdin = GeventFD(sys.stdin.fileno()) | |
>>> stdin.read(5) | |
'hello' |
import base64 | |
import json | |
import matplotlib, matplotlib.pyplot | |
import numpy | |
import types | |
def show_plot(width, height=None): | |
""" | |
A decorator -- show the matplotlib plot after `f` completes. | |
Takes optional parameters (width, height) determining the size of the plot. |
#!/bin/bash | |
echo "Finding and Purging Big Files From Git History" | |
echo "==============================================" | |
echo "" | |
echo "http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history/" | |
echo "" | |
pushd "$(git rev-parse --show-toplevel)" > /dev/null |
#include "FlyCapture2.h" | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <iostream> | |
using namespace FlyCapture2; | |
int main() |
I get asked by people wanting to visit Iceland what they should do while they're there. Rather than re-type (and mostly forget) the whole thing I just give them a link to this.
...as if you didn't know how to use Google.
from UserDict import IterableUserDict | |
import collections | |
__author__ = 'github.com/hangtwenty' | |
def tupperware(mapping): | |
""" Convert mappings to 'tupperwares' recursively. |
""" | |
required packages: | |
numpy | |
matplotlib | |
basemap: http://matplotlib.org/basemap/users/installing.html | |
shapely: https://pypi.python.org/pypi/Shapely | |
descartes: https://pypi.python.org/pypi/descartes | |
random | |