Skip to content

Instantly share code, notes, and snippets.

View hdznrrd's full-sized avatar
🙄

Gregor Jehle hdznrrd

🙄
  • Wartenberg, Germany
View GitHub Profile
@hdznrrd
hdznrrd / mkthumbs.sh
Created October 26, 2010 07:55
create thumbnails
mkdir thumb && ls *jpg | xargs -I{} -n1 convert -resize 10% "{}" "thumb/{}"
@hdznrrd
hdznrrd / gist:656996
Created October 31, 2010 19:03
HSV to RGB (Arduino)
void HSV_to_RGB(float h, float s, float v, byte *r, byte *g, byte *b)
{
int i,f,p,q,t;
h = max(0.0, min(360.0, h));
s = max(0.0, min(100.0, s));
v = max(0.0, min(100.0, v));
s /= 100;
v /= 100;
@hdznrrd
hdznrrd / make_awesome.sh
Created July 12, 2011 08:24
pounding ubuntu into working with awesome and some gnome features like panel
#!/bin/sh
# pounding ubuntu into working with awesome and some gnome features like panel
gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager awesome
cd ~
rm -f ~/.xsession ~/.xinitrc
echo '#!/bin/sh' > .xinitrc
echo -e "gnome-settings-daemon &\ngnome-panel &\nnm-applet &\npidgin &\ngnome-volume-manager &\nexec awesome" >> .xinitrc
ln -s .xinitrc .xsession
echo -e "[Desktop Entry]\nVersion=1.0\nType=Application\nName=Awesome\nComment=The awesome launcher!\nTryExec=awesome\nExec=awesome" > ~/.local/share/applications/awesome.desktop
sudo echo -e "[Desktop Entry]\nName=Xsession\nComment=Xsession for awesome\nExec=/etc/X11/Xsession\nX-Ubuntu-Gettext-Domain=gdm" > /usr/share/xsessions/xsession.desktop
@hdznrrd
hdznrrd / sort.sh
Created August 7, 2011 15:21
sort .NEF files into dated folders
#!/bin/bash
# for all Nikon raw files in thhe folder
for file in *.NEF; do
# get create date of file
date=$(stat -c %y "$file" | awk '{print $1}')
# if there's no folder with this date yet, create one
if [[ ! -d "$date" ]]; then
mkdir "$date"
@hdznrrd
hdznrrd / gist:1151189
Created August 17, 2011 09:31
disable localized exception error message
CultureInfo c = new CultureInfo("en-US");
// make formatting of output adhere to culture (eg. number format)
Thread.CurrentThread.CurrentCulture = cult;
// force exceptions to be displayed localized to selected culture
Thread.CurrentThread.CurrentUICulture = cult;
@hdznrrd
hdznrrd / A9.c
Created January 27, 2012 12:54 — forked from lumaxis/A9.c
Mittelwert beliebig vieler Zahlen
#include "stdio.h"
#include "stdlib.h"
void inputNumbers(int *size, double **numbers)
{
// Abfrage nach Anzahl der Zahlen
printf("Anzahl der zu speichernden Zahlen:\n");
scanf("%d", size);
// Entsprechende Menge Speicher reservieren
@hdznrrd
hdznrrd / jobinterviewquestions.txt
Created January 31, 2012 12:42
Job Interview Questions you Should Ask
Software development
- Which platforms (Linux, Windows, Mac, Embedded) will I develop for?
- What programming languages are you using for which kind of projects / applications?
- What Development Environment are you using?
- Are you using any coding style guidelines? If yes, can I take a look at the document?
- Are you actively supporting / allowing time for keeping your code base maintainable and up to date?
- How do you handle documentation? Is there time reserved specifically for documenting projects?
@hdznrrd
hdznrrd / arm_cortex_m3_mutex.c
Created November 7, 2012 14:42
basic implementation of a no-block / no-wait mutex for ARM Cortex M3 and compatible models
// this is a very basic mutex implementation
// its aim is to try to acquire access to a critical section or fail.
// there is no spinlock or event-waiting going on.
// in case it fails to acquire the lock, it simply returns false.
//
//
// relevant read:
//
// Synchronization primitives
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCIHB.html
@hdznrrd
hdznrrd / condense.pl
Last active December 16, 2015 09:28
condense duplicate rows of XVI32 hexeditor text printouts
#/usr/bin/perl
#
# condense duplicate rows of XVI32 hexeditor text printouts
#
# usage:
# cat file.txt | perl condense.pl
#
# sample output:
# 000000704: 53 0A 70 0D 08 00 A8 34 00 20 00 00 00 00 00 00
# 000000720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@hdznrrd
hdznrrd / mktestrepo
Created May 3, 2013 13:06
A quick hack to generate a test repository
#!/usr/bin/perl
system("rm -rf sandbox");
mkdir("sandbox");
chdir("sandbox");
system("git init");
sub addFilesWCommits()
{
map { $file = $_;