Skip to content

Instantly share code, notes, and snippets.

@timbennett
timbennett / twittermute.txt
Created May 23, 2023 09:13 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@timbennett
timbennett / text_generator.py
Last active May 29, 2017 06:40
Generate new list items using an existing list and a character-level language model
from collections import *
from random import random
import argparse
parser = argparse.ArgumentParser(description='Generate new list items using an existing \
list and a character-level language model')
parser.add_argument('-filename', action="store", dest="filename",
help='Name of the file containing the sample text.')
parser.add_argument('-order', action="store", dest="order", type=int, default=4,
@timbennett
timbennett / expose.py
Last active June 11, 2023 00:36
Create 'long exposure' images from a video file.
# This script takes a video's individual frames and overlays them to produce a composite "long exposure" image.
#
# Usage: python expose.py video.mp4 width height
#
# IMPORTANT: you'll need to edit this script to set the value of 'alpha' appropriate for your video's length and desired brightness.
from __future__ import division
import subprocess as sp
import numpy
from PIL import Image, ImageDraw
Copy of http://pastebin.com/5HUwk2jA
ABC Radio appears to be using a service from http://newrelic.com. You can get the ten most recently played tracks across their enabled stations here:
http://music.abcradio.net.au/api/v1/plays/search.json
Or you can add these parameters (as their web apps do to generate playlists):
from=yyyy-mm-ddThh:mm:ss.000Z // Date range start in UTC e.g. 2014-04-30T00:00:00.000Z
to=yyyy-mm-ddThh:mm:ss.000Z // Date range end in UTC e.g. 2014-04-30T00:00:00.000Z
@timbennett
timbennett / check.py
Last active August 25, 2016 04:55
IFTTT alert if Twitter username is available
## Check whether a specified Twitter username is available.
## Usage: 'check.py username'
## IFTTT.com instructions:
## You will need an ifttt.com account. Activate the maker channel (https://ifttt.com/maker) and copy your key to this script.
## Create a new recipe with trigger "Receive a web request" from the Maker channel.
## The script will send the username as Value1 and status as Value2. You can use these in your recipe.
## e.g. "Twitter username {{Value1}} {{Value2}}" will come across as "Twitter username jack available"
import requests
@timbennett
timbennett / notebook.ipynb
Last active April 21, 2024 13:55
Realtime Sydney Buses API tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@timbennett
timbennett / check_username_available.py
Created March 7, 2016 00:45
Check whether a specified Twitter username is available for registration.
## Check whether a specified Twitter username is available for registration.
## Usage: 'check_username_available.py username'
## IFTTT.com instructions:
## You will need an ifttt.com account. Activate the maker channel (https://ifttt.com/maker) and copy your key to this script.
## Create a new recipe with trigger "Receive a web request" from the Maker channel.
## The script will send the username as Value1 and status as Value2. You can use these in your recipe.
## e.g. "Twitter username {{Value1}} {{Value2}}" will come across as "Twitter username jack available"
import requests
@timbennett
timbennett / generate.py
Created August 2, 2015 23:29
Generate text with a Character-level Language Model
# based entirely on http://nbviewer.ipython.org/gist/yoavg/d76121dfde2618422139 by Yoav Goldberg
# inputfile.txt (specified on line 42): is the corpus you want to learn & generate from
# nletters=1000 (on line 33): is how many characters you want to generate
# order=10 (line 42): is the history length (higher generally gives better output with diminishing returns above 7ish)
# print generate_text(lm, 10) (line 43): 10 is the order again, but for generation
from collections import *
def train_char_lm(fname, order=4):
data = file(fname).read()
@timbennett
timbennett / index.php
Created December 3, 2014 05:48
Download Roads and Maritime Services traffic report data
<?php
// this gets the data used to power charts at roadsreport.rms.nsw.gov.au
date_default_timezone_set('Australia/Sydney'); // doesn't matter
$date = '2013-09-02'; // earliest date for available data
// Set up the query loop (I should really do this by end date)
for ($i = 1; $i <= 460; $i++) {