Skip to content

Instantly share code, notes, and snippets.


Torstein Hegge hegge

View GitHub Profile
hegge / gist:70204bead964de3985dc
Last active Aug 29, 2015
Mutt LDAP DavMail lookup
View gist:70204bead964de3985dc
# Based on
use strict;
use Net::INET6Glue::INET_is_INET6;
use Net::LDAP;
use constant HOST => 'ip6-localhost:1389';
use constant BASE => 'ou=people';
View gist:9663373
$ git --version
git version 1.8.5.rc2.7.g8167612 # same behavour with
$ git init
Initialized empty Git repository in /home/torstein/tmp/git-empty/.git/
$ echo "f" >file
$ git add file
hegge / gist:5133826
Created Mar 11, 2013
Corda Daccord lsusb -v
View gist:5133826
Bus 002 Device 009: ID 0d8c:0309 C-Media Electronics, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0d8c C-Media Electronics, Inc.
hegge / avg_cyclic()
Created Jul 15, 2010
Mean of circular quantities in SQL
View avg_cyclic()
-- MySQL
SELECT UNIX_TIMESTAMP(date), avg_cyclic, frequency_start , frequency_stop, intensity, source
FROM (SELECT MAX(id) AS max_id, CONCAT(echo.frequency_start , '-', echo.frequency_stop) AS frequency
FROM echo
WHERE channel = {0}
GROUP BY frequency) AS id,
IF (avg(sin(direction*PI()/180))>0 AND avg(cos(direction*PI()/180))>0,
View simple makefile
all: program run plot
.PHONY: run plot
program: file.c
gcc -o program file.c
View file_filter
use strict;
use warnings;
# Use: cat file | ./ > new_file
while(<>) {
if (/^(\w+(\\\w+)*)\\(\w+)\t(\w+)$/) {
print "$1;$3;$4\n";
View koordinatsystemkrøll.c
/* Read acc and gyro */
body_linear_acc /* contains: u_dot, v_dot, w_dot */
body_rotation_acc /* contains: p_dot, q_dot, r_dot */
/* Calculate angle TODO: compensate for turning */
local_angle = find_angles_atan2(body_linear_acc)
/* Read GPS position and speed */
gps_speed /*contains x, y, z */
gps_position /* contains x_dot, y_dot, z_dot */