Skip to content

Instantly share code, notes, and snippets.

View sunsided's full-sized avatar
🇺🇦
#StandWithUkraine

Markus Mayer sunsided

🇺🇦
#StandWithUkraine
View GitHub Profile
@timtrueman
timtrueman / heading.py
Created March 5, 2010 08:13
Tilt-compensated heading from magnetometer readings, roll and pitch
def wrap(angle):
if angle > pi:
angle -= (2*pi)
if angle < -pi:
angle += (2*pi)
if angle < 0:
angle += 2*pi
return angle
def magnetometer_readings_to_tilt_compensated_heading(bx, by, bz, phi, theta):
@BonsaiDen
BonsaiDen / bezierCurve.js
Created November 10, 2010 02:24
Bezier Curve in JS, includes arc-length parameterization stuff
function Bezier(a, b, c, d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.len = 100;
this.arcLengths = new Array(this.len + 1);
this.arcLengths[0] = 0;
@naufraghi
naufraghi / arima.c
Created April 9, 2011 10:20
R stats/arima.c
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2002-2006 The R Development Core Team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@zrxq
zrxq / DetectFaces.cs
Created July 30, 2011 13:22
Face detection in C# using OpenCV with P/Invoke
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace OpenCVFaceDetector
{
class DllPaths
@simon-engledew
simon-engledew / BubbleBabble.cs
Created September 2, 2011 09:01
C-Sharp implemention of the Bubble Babble algorithm
public static class BubbleBabble
{
private static readonly string vowels = "aeiouy";
private static readonly string consonants = "bcdfghklmnprstvzx";
public static string Convert(byte[] bytes)
{
int seed = 1;
int rounds = 1 + bytes.Length / 2;
StringBuilder result = new StringBuilder();
@mapedd
mapedd / .gitignore
Created March 15, 2012 16:24
.gitignore file for files generated by Xilinx ISE IDE
#Gitignore for files generated by Xilinx ISE
*.log
*.svf
*.scr
*.cmd
*.bak
*.lso
*.elf
*.ace
@ArnoldZokas
ArnoldZokas / InMemoryRazorEngine.cs
Created March 26, 2012 10:31
In-memory Razor engine with @model and @ViewBag support
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web.Razor;
using Microsoft.CSharp;
namespace SpecUtils
@jjlin18
jjlin18 / numpy_Capi
Created June 1, 2012 06:50
sample code for get and return numpy in C++
// From http://stackoverflow.com/questions/9128519/reading-many-values-from-numpy-c-api
/*
Make
g++ -o matrix_multiply.o -c matrix_multiply.cpp -I{python include file for numpy/noprefix.h} -I{python include} -fPIC -O2 -Wno-deprecated -Wno-write-strings
g++ -o matrix_multiply.so -shared matrix_multiply.o -L{boost lib path} -lz -lm -ldl -lpthread -boost_python
Python code:
import numpy
import matrix_multiply
@PhirePhly
PhirePhly / memdjpeg.c
Created July 10, 2012 02:33
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@bwhite
bwhite / rank_metrics.py
Created September 15, 2012 03:23
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np