Skip to content

Instantly share code, notes, and snippets.

View uggedal's full-sized avatar

eju uggedal

  • Oslo, Norway
View GitHub Profile
Oppgave
=======
Når et innlegg stemmes på:
1. oppdater "hot scoren" i tittel attributtet
2. sorter listen på ny
Dette skal gjøres på klientsiden, ingen kommunikasjon over HTTP er lov.
Steg:
from calendar import LocaleHTMLCalendar
from datetime import date
from itertools import groupby
from django.utils.html import conditional_escape as esc
class WorkoutCalendar(LocaleHTMLCalendar):
def __init__(self, workouts, locale):
super(WorkoutCalendar, self).__init__(locale=locale)
###########################################################
# sysinfo
###########################################################
# uname -nrmo
stormondemand.test 2.6.18-128.1.14.el5 x86_64 GNU/Linux
# grep "MemTotal" /proc/meminfo
MemTotal: 1758232 kB
-- Return keys with a given prefix for a particular node where there are a
-- known total of nodes. Uses the reamainder of the keys' hash values to
-- segment the keys.
function slice(prefix, index_and_total)
local args = _split(index_and_total, "\t")
if #args ~= 2 then
return nil
end
local index = tonumber(args[1])
-- Should return "it works!" for all inputs
function is_it_working(key, value)
return "it works!"
end
/*
* matchMedia() polyfill - test whether a CSS media type or media query applies
* primary author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* adapted by Paul Irish to use the matchMedia API
* http://dev.w3.org/csswg/cssom-view/#dom-window-matchmedia
* which webkit now supports: http://trac.webkit.org/changeset/72552
*
* Doesn't implement media.type as there's no way for crossbrowser property
#!/bin/sh
#
# <udf name="fqdn" label="Fully qualified domain name" />
PUBLIC_IP_ADDRESS=`ifconfig eth0 | awk -F':' '/inet addr/{split($2,_," ");print _[1]}'`
echo $FQDN > /etc/hostname && hostname -F /etc/hostname
echo $PUBLIC_IP_ADDRESS `hostname` `hostname -s` >> /etc/hosts
node "helium.uggedal.com" inherits servernode {
include europe
hostname { "helium.uggedal.com":
aliases => ["helium", "he"],
}
include sshserver::web
include webserver
include sqlserver
include postgresql::python
@uggedal
uggedal / top.yaml
Created February 3, 2012 09:42
Parameters in top state
base:
'web1':
- nginx:
- hostname: www.uggedal.com
'web1':
- nginx:
- hostname: blog.uggedal.com
var page = require('webpage').create();
if (phantom.args.length !== 5) {
console.log('Usage: rasterize.js URL filename width height delay');
phantom.exit();
} else {
var address = phantom.args[0],
output = phantom.args[1],
width = parseInt(phantom.args[2]),
height = parseInt(phantom.args[3]),