Skip to content

Instantly share code, notes, and snippets.

View brett-lempereur's full-sized avatar

Brett Lempereur brett-lempereur

View GitHub Profile
//
// keymap.json
//
// Reasonable spatial configuration.
//
[
{
"context": "ProjectPanel && not_editing",
"bindings": {
"""
A pithy noop context manager.
"""
import contextlib
@contextlib.contextmanager
def fakelock():
"""
Empty context manager that does nothing.
@brett-lempereur
brett-lempereur / media.rb
Created February 5, 2016 16:34
Using Twitter::REST::Client#status with Twitter::REST::Client#search to retrieve all media objects
###
### media.rb
###
### Demonstration of using Twitter::REST::Client#search alongside
### Twitter::REST::Client#status to retrieve all media objects for
### a tweet.
###
require 'twitter'
@brett-lempereur
brett-lempereur / cleanup.py
Created December 11, 2015 14:07
Cleanup a JSON history file and encode is as close to ICRA as possible
"""Cleanup a JSON history file and encode is as close to ICRA as possible."""
import argparse
import csv
import datetime
import operator
import sys
import itertools
import json
import urlparse
@brett-lempereur
brett-lempereur / get_history.js
Last active January 18, 2023 14:03
Script to extract browsing history metadata from Google Chrome and, where possible, associate it with a device when syncing is enabled.
/**
* get_history.js
*
* Script to extract browsing history metadata from Google Chrome and, where
* possible, associate it with a device when syncing is enabled.
*
* Usage:
* 1. Open Google Chrome
* 2. Navigate to the history page
* 3. Open the developer tools (Ctrl+Shift+i)
@brett-lempereur
brett-lempereur / pollingvis.py
Last active February 16, 2016 19:53
Visualise five-day average voting intention polling #GE2015 with a UnicornHat
"""
Display aggregated General Election 2015 polling data on a Pimoroni Unicorn
Hat.
"""
import operator
import re
import time
import requests