Skip to content

Instantly share code, notes, and snippets.

View hhessel's full-sized avatar

Henrik P. Hessel hhessel

View GitHub Profile
import logging
import os
import struct
import sys
from erlport import Port, Protocol, String
from django.core.management.base import BaseCommand
from models.ExtendedUser import ExtendedUser as User
from Logic.tasks import sendToUser, sendToUserDev
from django.contrib.auth.models import check_password
@hhessel
hhessel / gist:978174
Created May 18, 2011 08:05
Checkin World Map
library(maptools)
library(ggplot2)
gpclibPermit()
theme_set(theme_bw())
setwd("C:\\R")
# Data: http://thematicmapping.org/downloads/world_borders.php
world.shp <- readShapeSpatial("TM_WORLD_BORDERS-0.3.shp")
# check for region-id - Use "FIPS"
@hhessel
hhessel / gist:975172
Created May 16, 2011 19:39
SHA-256 Static Salted Hash Module ejabberd_auth_odbc.erl
%%%----------------------------------------------------------------------
%%% File : ejabberd_auth_odbc.erl
%%% Author : Alexey Shchepin <alexey@process-one.net>
%%% Purpose : Authentification via ODBC
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2010 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
class FriendshipHandlerCreate(BaseHandler):
allowed_methods = ('POST', 'GET', )
resp = rc.BAD_REQUEST
@classmethod
def createFriendShip(self, user_id, request):
friendship.set_friendship(request.user.id, user_id)
def entryMethod(self, request):
if hasattr(request, "content_type"):
@hhessel
hhessel / gist:780247
Created January 14, 2011 21:10
Django BaseCommand to receive Erlang Port Message https://gist.github.com/780231
import logging
import os
import struct
import sys
from erlport import Port, Protocol, String
from django.core.management.base import BaseCommand
from models.ExtendedUser import ExtendedUser as User
from Notifications import Push
from django.contrib.auth.models import check_password
@hhessel
hhessel / gist:780231
Created January 14, 2011 20:59
ejabbered Custom Module to send Offline Messages to a Django Custom Command
-module(django_offline).
-author("Henrik P. Hessel").
-behaviour(gen_mod).
-export([start/2, stop/1, django_message/3, send_to_django/3]).
-include("ejabberd.hrl").
-include("jlib.hrl").
@hhessel
hhessel / gist:762210
Created January 2, 2011 02:11
Detect Movie File Rotation Meta Data - return number in degrees
#!/usr/bin/python
# Detect Movie File Rotation Meta Data - return number in degrees
# Copyright 2010 Henrik P. Hessel
# requires MediaInfo Commandline Tools http://mediainfo.sourceforge.net/en/Download
# i.e. Video Rotation for video recordings on Apples iPhone
from subprocess import Popen, PIPE
from xml.etree import ElementTree
#!/usr/bin/perl
#
# This script parses a crashdump file and attempts to resolve addresses into function names.
#
# It finds symbol-rich binaries by:
# a) searching in Spotlight to find .dSYM files by UUID, then finding the executable from there.
# That finds the symbols for binaries that a developer has built with "DWARF with dSYM File".
# b) searching in various SDK directories.
#
# Copyright (c) 2008 Apple Inc. All Rights Reserved.