Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Kalli
Kalli / download-frinkiac-images.sh
Created March 25, 2021 15:52
Download random stills from Frinkiac
for number in {1..10}
do
echo $number
img=$(curl -s https://frinkiac.com/api/random | jq -r '"https://frinkiac.com/img/"+.Episode.Key+"/"+(.Frame.Timestamp|tostring)+".jpg"')
curl -s $img > ./$number.jpg
done
@Kalli
Kalli / requirements.txt
Created October 9, 2017 13:59
Code for calculating distances between all shops on Vinylhub.com
scikit-learn==0.19.0
geopy==1.11.0
numpy==1.13.1
scipy==0.19.1
@Kalli
Kalli / getfbdata
Last active August 29, 2015 14:07
Find Facebook newsfeed posts related to the 10-influential-records meme and parse the record and artist titles from them
# -*- coding: utf-8 -*-
import facebook
import datetime
import urlparse
import json
import traceback
import time
import re
# get an auth token with feed reading permissions from https://developers.facebook.com/tools/explorer/
@Kalli
Kalli / discogs-release-bookmarklet
Created September 20, 2013 12:52
Javascript bookmarklet for getting release information of a Discogs (http://www.discogs.com) release page, for easy copy/pasting to a spreadsheet or the like. Use a bookmarklet maker like the Bookmarlet Crunchinator (http://ted.mielczarek.org/code/mozilla/bookmarklet.html) to create a bookmarklet version
var artist = $('.profile h1 span').first().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var release = $('.profile h1 span').last().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var label = $('.profile .content').first().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var releasedate= $('.profile .content:eq(3)').text().replace(/\n/g,"").replace(/\s\s+/g,"");
var style = $('.profile .content:eq(5)').text().replace(/\n/g,"").replace(/\s\s+/g,"");
// if releasedate has full date, get just the year;
if(releasedate.length>4){;
releasedate = releasedate.slice(-4);
};
var url = document.location.toString();
import csv
import time
sample=csv.reader(open("/vedurmaelingar-a-islandi.csv","r"))
# gögnin eru á forminu:
# ["YYYY-mm-dd H:M:S", hámarkshitastig, lágmarkshitastig, úrkoma] dæmi:
# ["2002-04-25 18:00:00", "3.9", "1.8", "0.5"]
frost=[]
notfrost=[]
for row in sample:
aday=time.strptime(row[0],"%Y-%m-%d %H:%M:%S")
@Kalli
Kalli / gist:5323701
Last active December 15, 2015 21:09
Mildly amusing Facebook javascript prank. Run this code in the javascript console off someone who has Facebook running in their browser all the time. Sit back and watch the headscratching and frustration commence.
function FBNotificationsPrank(){
document.getElementById('fbNotificationsJewel').className = document.getElementById('fbNotificationsJewel').className + " hasNew";
document.getElementById('notificationsCountValue').innerHTML = 1;
document.title = "(1) Facebook";
setTimeout(FBNotificationsPrank, 10000);
}
FBNotificationsPrank();
@Kalli
Kalli / ra_review_parser.py
Created February 6, 2013 19:47
A python crawler/parser to get review ratings from the Resident Advisor website (http://www.residentadvisor.net/).
import urllib2
import re
import json
def find_review_links(html):
re.VERBOSE
# some reviews are listed with the rating in a span tag: <span class="grey">4</span>
span_re = re.compile(r'''span\sclass=\"?grey\"?\>(\d\.?\d?)''', re.UNICODE | re.IGNORECASE | re.VERBOSE)
review_ratings = span_re.findall(html)
@Kalli
Kalli / setItunesBpm.scpt
Created December 7, 2012 17:23
iTunes Set BPM
(*
Set the bpm value of the current iTunes track to the bpm value of the counter http://www.all8.com/tools/bpm.htm or a selected number
written by Karl Tryggvason www.karltryggvason.com / @karltryggvason
*)
if appIsRunning("Google Chrome") then
tell application "Google Chrome"
if (get URL of active tab of first window) is equal to "http://www.all8.com/tools/bpm.htm" then
@Kalli
Kalli / LineNumbersToFile.py
Created July 22, 2012 23:14
Insert Line Numbers Sublime Text 2 Plugin
'''Sublime Text 2 plugin for inserting the line numbers of a text document or a selection within it '''
import sublime
import sublime_plugin
class InsertLineNumbersCommand(sublime_plugin.TextCommand):
def run(self, edit):
selected_region = self.view.sel()[0]
if selected_region.size() == 0: