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
@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 / 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 / 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:
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 / 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
@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
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 / gist:3303572
Created August 9, 2012 11:52
PVG Graphite Server Configuration

Users

graphite is the user that runs all graphite related services.

Graphite

Web Interface

NGiNX listens on TCP port 80

@jokull
jokull / context_processors.py
Created November 22, 2012 11:45
Much better URL reversal in Django
# encoding=utf-8
from django.core.urlresolvers import reverse
def burl_context(request):
def burl(name, *args, **kwargs):
external = kwargs.pop('_external')
path = reverse(name, args=args, kwargs=kwargs)
@jokull
jokull / .osx.sh
Created March 12, 2013 13:52
My Mountain Lion settings
# Disable opening and closing window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# Increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Save to disk (not to iCloud) by default