This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find top artists/tracks you've listened to within the past year but not the past 90 days | |
# Before starting, download your Last.fm history from here: https://benjaminbenben.com/lastfm-to-csv/ | |
import datetime | |
import pandas as pd | |
# add column names (at time of publishing, the site above didn't do this) | |
df = pd.read_csv("username.csv",header=0,names=["artist","album","title","timestamp"]) | |
df.timestamp = pd.to_datetime(df.timestamp) | |
df['trackid'] = df['artist']+df['title'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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++) { |