Skip to content

Instantly share code, notes, and snippets.

View jokull's full-sized avatar
☺️

Jökull Sólberg Auðunsson jokull

☺️
View GitHub Profile
import boto
schema = conn.create_schema(
hash_key_name='player_id',
hash_key_proto_value='S',
range_key_name='points',
range_key_proto_value='N'
)
table = conn.create_table(
@jokull
jokull / toplink.py
Created July 26, 2012 20:01
Symlink tracks from all albums containing at least one of the top 3000 played tracks
@jokull
jokull / tracks.py
Created July 5, 2012 12:52
Write id3v2 track from `01 - Whatever.mp3`
#!/usr/bin/env python
# encoding=utf-8
import sys
import os
import re
import subprocess
from clint.textui import prompt
from clint.textui.core import puts, puts_err
from clint.textui.colored import blue, yellow, red
from directoryhash import path_checksum
from functools import partial
def static(filename, _external=False):
path = partial(url_for, 'static', filename=filename, _external=_external)
host = app.config.get('CDN_HOSTNAME')
if host:
return u'http://{host}/{fingerprint}{path}'.format(
host=host, fingerprint=g.fingerprint, path=path())
return path(fingerprint=g.fingerprint)
@jokull
jokull / twitter-ify.coffee
Created April 12, 2012 14:44
CoffeScript "ify" view and model for Tweets
class window.Tweet extends Backbone.Model
initialize: (options) ->
if @has "text"
tweet = @ify.hash (@get "text")
tweet = @ify.at tweet
tweet = @ify.link tweet
@set ified: tweet
ify:
@jokull
jokull / app.py
Created March 26, 2012 16:03
Flask base app.py
# encoding=utf-8
import datetime, locale
from functools import partial
from urllib import quote_plus
from raven.contrib.flask import Sentry
from redis import Redis
from flask import (Flask, g, url_for, render_template, request, jsonify, abort,
redirect)
@jokull
jokull / grid.styl
Created December 20, 2011 15:39
Stylus Skeleton responsive grid
// Based on getskeleton.com
@import "nib/clearfix"
@import "nib/reset"
global-reset()
columns = 16
column-width = 57px // Ends up as 1232px layout
gutter-width = 20px
@jokull
jokull / tumblr.py
Created December 10, 2011 16:55
Tumblr CachedResponse for restkit
# encoding=utf-8
"""
Use Tumblr as a backend for a blog. This module
helps interfacing with their APIv2 in a pythonic way. Caching
keeps things responsive and guards against API downtime and
response failures.
Assumptions:
@jokull
jokull / index.html
Created September 7, 2011 11:40
Public Instagram hashtag using Backbone.js and CoffeeScript
<html>
<head>
<script type="text/template" id="tpl-instagram-post">
<a href="<%= link %>"><img src="<%= images.low_resolution.url %>"></a>
<p class="date"><%= created_time %></p>
<p class="user">@<%= user.username %></p>
<% if(caption){ %>
<p class="caption"><%= caption.text %></p>
<% } %>
</script>
@jokull
jokull / index.html
Created September 3, 2011 20:00
CoffeeScript Backbone Tumblr with JSONP
<html>
<head>
<script type="text/template" id="tpl-tumblr-post">
<% if(title){ %>
<h2 class="title">
<a href="<%= post_url %>"><%= title %></a>
</h2>
<% } %>
<%= body %>