Skip to content

Instantly share code, notes, and snippets.

View akhenakh's full-sized avatar
🏠
Working from home

Fabrice Aneche akhenakh

🏠
Working from home
View GitHub Profile
@akhenakh
akhenakh / PKGBUILD
Created September 14, 2017 20:28
Arch aruco needed for opentracker
pkgname=aruco-git
pkgver=2.0.19.5675
pkgrel=1
pkgdesc="Augmented reality library based on OpenCV"
arch=('i686' 'x86_64')
url="https://www.uco.es/investiga/grupos/ava/node/26"
license=('BSD')
depends=(opencv)
makedepends=(cmake)
source=("git+https://github.com/opentrack/aruco.git#commit=567503cf3a1feed334b6eaf95dbcbcdc39952feb")
@akhenakh
akhenakh / gist:929f07d697ce60ba75871b5ae0b3bb35
Last active July 4, 2017 20:52
filter OSM road network
"highway" = 'primary' OR "highway" = 'primary_link' OR
"highway" = 'trunk' OR "highway" = 'trunk_link' OR
"highway" = 'motorway' OR "highway" = 'motorway_link' OR
"highway" = 'secondary' OR "highway" = 'secondary_link' OR
"highway" = 'tertiary' OR "highway" = 'tertiary_link' OR
"highway" = 'residential' OR "highway" = 'unclassified'
https://wiki.openstreetmap.org/wiki/Routing#Routing_considerations
@akhenakh
akhenakh / motion.py
Created May 4, 2017 22:01
Motion detection via GPIO film in h264 then upload to google drive in rpi
from gpiozero import MotionSensor
from picamera import PiCamera
from datetime import datetime
from phue import Bridge
import subprocess
b = Bridge('192.168.xxx.xxx')
b.connect()
camera = PiCamera()
camera.rotation = 180
@akhenakh
akhenakh / nodrone.geojson
Last active April 24, 2017 20:50
Quebec, restricted or controlled airspace + 9km around airports or helipads, aka drones restrictions. this is an experiment do not use as reference
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/*
The MIT License (MIT)
Copyright (c) 2016 Fabrice Aneche
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@akhenakh
akhenakh / pt.sh
Created May 20, 2016 19:06
pt tricks
# Go files ignoring vendor lookup
pt --color -G "go$" --ignore "vendor/*" mylookup | less -r
@akhenakh
akhenakh / xbee.c
Created October 26, 2015 22:27
Calculate checksum for an xbee frame on iOS
void checksum(uint8_t *buf, int length, uint8_t *dstbuf, int *retlength) {
uint16_t sum = 0;
// then calculate checksum
for (int i=3;i<length-1;i++) {
sum+= buf[i];
}
sum = CFSwapInt16HostToBig(sum);
uint8_t right = (sum >> 8) & 0xff;
uint8_t checksum = 0xFF - right;
@akhenakh
akhenakh / dev.sh
Last active August 29, 2015 14:19
Compile LedisDB with leveldb and rocksdb support on OSX using Macports
#!/bin/bash
# using macports install:
# port install gcc5 rocksdb leveldb
export CC=/opt/local/bin/gcc-mp-5
export CXX=/opt/local/bin/g++-mp-5
export LEDISTOP=$(pwd)
export LEDISROOT="${LEDISROOT:-${LEDISTOP/\/src\/github.com\/siddontang\/ledisdb/}}"
# LEDISTOP sanity check
if [[ "$LEDISTOP" == "${LEDISTOP/\/src\/github.com\/siddontang\/ledisdb/}" ]]; then
echo "WARNING: LEDISTOP($LEDISTOP) does not contain src/github.com/siddontang/ledisdb"
@akhenakh
akhenakh / NBUnitsNumberFormatter.m
Last active August 29, 2015 14:18
Round numbers to Units 102.000 to 102K 9.900 to 9.9K 1.000.200 to 1M
#import "NBUnitsNumberFormatter.h"
@implementation NBUnitsNumberFormatter
- (NSString *)stringForObjectValue:(id)value; {
if (![value isKindOfClass:[NSNumber class]]) {
return nil;
}
return [self stringForFloat:[value floatValue]];
}
@akhenakh
akhenakh / DMBordelLabel.h
Last active March 10, 2017 05:24
Use this Label to have a padding. Place a UILabel in Interface Builder, just change the class to DMBorderLabel then you can set all paddings from Interface Builder https://drive.google.com/uc?id=0B4clDbhSrtODdG9nOF9tTGNRYWs
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface DMBorderLabel : UILabel
@property (nonatomic) IBInspectable CGFloat topInset;
@property (nonatomic) IBInspectable CGFloat bottomInset;
@property (nonatomic) IBInspectable CGFloat leftInset;
@property (nonatomic) IBInspectable CGFloat rightInset;