Skip to content

Instantly share code, notes, and snippets.

View confluencepoint's full-sized avatar
🏳️
Focusing

confluencepoint confluencepoint

🏳️
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; pythonista://foo.py&action=run&argv=bar"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script language="JavaScript">
setTimeout("self.close()", 500);
</script>
</head>

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

/*
* Taken from http://stackoverflow.com/questions/5867534/how-to-save-canvas-data-to-file/5971674#5971674
*/
var fs = require('fs');
// string generated by canvas.toDataURL()
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0"
+ "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO"
+ "3gAAAABJRU5ErkJggg==";
// strip off the data: url prefix to get just the base64-encoded bytes
// original:
javascript:(function()%7Bfunction%20bookmark(url)%20%7Bvar%20location%20%3D%20'spillo%3A%2F%2F%2Fbookmark%3F'%3Bvar%20description%20%3D%20getSelText()%3Bif%20(description%20%3D%3D%3D%20%22%22)%20%7Bdescription%20%3D%20getMetaDescription()%3B%7Dlocation%20%2B%3D%20'url'%20%2B%20'%3D'%20%2B%20encodeURIComponent(url)%3Blocation%20%2B%3D%20'%26'%3Blocation%20%2B%3D%20'title'%20%2B%20'%3D'%20%2B%20encodeURIComponent(document.title)%3Blocation%20%2B%3D%20'%26'%3Blocation%20%2B%3D%20'desc'%20%2B%20'%3D'%20%2B%20encodeURIComponent(description)%3Bdocument.location.href%20%3D%20location%3B%7Dfunction%20getSelText()%7Bvar%20txt%20%3D%20%22%22%3Bif%20(window.getSelection)%20%7Btxt%20%3D%20window.getSelection()%3B%7D%20else%20if%20(document.getSelection)%20%7Btxt%20%3D%20document.getSelection()%3B%7D%20else%20if%20(document.selection)%20%7Btxt%20%3D%20document.selection.createRange().text%3B%7D%20else%20return%3Breturn%20txt.toString()%3B%7Dfunction%20getMetaDescription()%20%7Bvar%20meta%20%3D%20document.get
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#!/usr/bin/env python3
# encoding: utf-8
"""
I saw a similar script on the homepage of Miguel Grinberg (the Flask book guy),
but he was using webscraping. Here I use simple API calls instead.
The script takes the presentations of a Python conference and orders the
presentations in descending order by the number of youtube views. It
is an indicator about the popularity of a video.
The regex patterns in this gist are intended to match any URLs,
including "mailto:[email protected]", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
# coding: utf-8
# Starting point for emailing a group of people via Dispatch...
# The people in the group are identified by a unique string in the Notes field.
# TODO: Support setting the group identifier with an argument when launching the script via URL scheme (LCP...) - subject, body etc. could also be passed as arguments.
# Change this:
group_note = 'Group1'
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}