Skip to content

Instantly share code, notes, and snippets.

# This is an implementation using python-oembed with api.embed.ly
# python-oembed http://code.google.com/p/python-oembed/
import oembed
# Embed.ly Multi Provider API Endpoint
OEMBED_ENDPOINT = 'http://api.embed.ly/oembed/api/v1'
# URL Schemes Supported --- complete list maintained
# http://api.embed.ly/static/data/embedly_regex.json
@octaflop
octaflop / notify.py
Created December 3, 2010 00:04
A quick-and-dirty python script to send a message using lib-notify to multiple machines.
# -*- encoding:utf-8 -*-
# notify.py
# a simple wrapper to notify a user
import subprocess, os
user = 'guest'
# I named the computers after south park characters :D
clients = ['cartman', 'kyle', 'stan', 'kenny']
title = raw_input("title?\n")
text = raw_input("text?\n")
# Image comes with default ubuntu 10.10 installs.
/*
* This work is licensed under the Creative Commons Attribution-NonCommercial
* 3.0 Unported License. To view a copy of this license, visit
* http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative
* Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*/
var interval = 10;
var layer1Sloppiness = [1, 2];
var layer2Sloppiness = [1, 2];
@octaflop
octaflop / admin.py
Created March 29, 2011 23:53
part of the models file for verebena
# the admin views
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from verbena.models import Student, Faculty, NewsRelease, Location, Project,\
VolunteerOpportunity, Organization, Workshop, ActionGroup, Grant
class StudentAdmin(UserAdmin):
list_display = ('studying','comp_year',)
faris@cortex:~/workspace/src$ git clone https://github.com/joyent/node.git
Initialized empty Git repository in /home/faris/workspace/src/node/.git/
remote: Counting objects: 36420, done.
remote: Compressing objects: 100% (9171/9171), done.
remote: Total 36420 (delta 29036), reused 33711 (delta 26768)
Receiving objects: 100% (36420/36420), 21.35 MiB | 2.00 MiB/s, done.
Resolving deltas: 100% (29036/29036), done.
faris@cortex:~/workspace/src$ cd node
faris@cortex:~/workspace/src/node$ ./configure --prefix=~/.node
bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
@octaflop
octaflop / forms.py
Created August 3, 2011 22:11
satchless model example
from satchless.forms.widgets import DecimalInput
from satchless.product.forms import BaseVariantForm
from . import models
class ProductPriceForm(forms.ModelForm):
class Meta:
widgets = {
'price': DecimalInput(min_decimal_places=2),
}
@octaflop
octaflop / forms.py
Created August 3, 2011 22:47 — forked from patrys/forms.py
satchless model example
from django import forms
from satchless.forms.widgets import DecimalInput
from satchless.product.forms import BaseVariantForm
from . import models
class ProductPriceForm(forms.ModelForm):
class Meta:
widgets = {
'price': DecimalInput(min_decimal_places=2),
@octaflop
octaflop / models.py
Created August 11, 2011 22:58
Excel Model Migration with PostgreSQL error
# models.py
from django.db import models
from django.db.utils import IntegrityError
from tinymce.models import HTMLField
import datetime
from django.contrib.auth.models import User, UserManager, Permission
import re
from django.utils.translation import ugettext as _
@octaflop
octaflop / find_expires.py
Created September 8, 2011 17:42
A set of django management commands to find expired Members and send them a notification.
from memdir.models import Member
import datetime
from pprint import pprint
class Command(BaseCommand):
args = '<None>'
help = """Finds all the Members in the database with an expired entry and
tags them as expired. This command should be run right before the
send_notices command.
"""
@octaflop
octaflop / mdblock.sh
Created October 21, 2011 23:14
md0 block
ls -l /sys/block/md0/holders /sys/block/md0/*/holders
/sys/block/md0/holders:
total 0
/sys/block/md0/md0p1/holders:
total 0
lrwxrwxrwx 1 root root 0 2011-10-21 15:51 dm-1 -> ../../../dm-1
/dev/mapper/vhost-hostvol on / type ext4 (rw,errors=remount-ro)