Skip to content

Instantly share code, notes, and snippets.

View hdznrrd's full-sized avatar
🙄

Gregor Jehle hdznrrd

🙄
  • Wartenberg, Germany
View GitHub Profile
#!/bin/bash
# hadez@infuanfu.de
# fix jscut.org gcode comment format so it works with uccnc
if [ ! -e "$1" ]; then
echo "no file given, exiting"
exit 1
fi
@hdznrrd
hdznrrd / pre-push.sh
Created June 20, 2016 11:37
git pre-push hook running build & tests using maven and only pushing if tests succeeded
#!/bin/sh
# git pre-push hook running build & tests using maven and only pushing if tests succeeded
#
# will do a local check-out of your currentl commit state and see if that one builds.
# this will spare you nasty surprises from missing to add files or having broken partially commited files
#
PWD=$(pwd)
ROOT="file://$(git rev-parse --show-toplevel)"
TMP=$(mktemp -d)
$ echo "++HEADER";cat test.h; echo "++IMPL"; cat test.cpp;(CXXFLAGS=--std=c++11 make test && ./test)
++HEADER
#ifndef _TEST_H_
#define _TEST_H_
class foo {
public: foo(int a=1);
};
#endif
++IMPL
#include "test.h"
@hdznrrd
hdznrrd / bp_scan_uart_baud.sh
Created April 12, 2015 16:10
use buspirate v2.go to figure out at which baud rate a UART device talking AT commands communicates
#!/bin/sh
# use buspirate v2.go to figure out at which baud rate a UART device talking AT commands communicates
# 2015 hadez@infuanfu.de
# device is powercycled for each try
DEV=/dev/ttyUSB0
echo "#" >$DEV #reset
sleep 1
for baud in 1 2 3 4 5 6 7 8 9; do
@hdznrrd
hdznrrd / gist:3e1b1626508fe488a826
Created June 4, 2014 10:22
linux crypto links
https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption#With_suspend-to-disk_support
https://wiki.archlinux.org/index.php/Encrypted_LVM
https://wiki.archlinux.org/index.php/GRUB2#LVM
http://askubuntu.com/questions/59487/how-to-configure-lvm-luks-to-autodecrypt-partition
http://www.freedesktop.org/software/systemd/man/crypttab.html
http://nwrickert2.wordpress.com/2014/04/19/installing-ubuntu-14-04-in-an-encrypted-lvm/
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1003309
http://ubuntuforums.org/showthread.php?t=1138779
// bytearray.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//
#include "stdafx.h"
#include <vector>
#include <iostream>
using namespace std;
@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 = $_;
@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 / 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 / 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?