Skip to content

Instantly share code, notes, and snippets.

View pgrandin's full-sized avatar

Pierre Grandin pgrandin

View GitHub Profile
@pgrandin
pgrandin / time_api
Created January 14, 2014 23:10
time_api
#!/bin/bash
[ -f /usr/bin/nc.openbsd ] || ACCEPT_KEYWORDS=~amd64 emerge -q openbsd-netcat
url="http://169.254.169.254/2008-02-01/meta-data/public-ipv4"
if [[ "$1" == "-n" ]]; then
url="http://169.254.169.254/openstack/latest/meta_data.json"
fi
PORT=2003
#!/bin/bash
PORT=2003
SERVER=172.16.128.252
source /etc/keystone/keystone.credentials
while true; do
START_TIME=$SECONDS
c=`cinder list --all-tenants`
#!/bin/sh
echo "$1" >> ~/.navit/speech.log
md5=`echo "$1" | md5sum -|awk '{print $1}'`
[ -d speech ] || mkdir speech
use_fallback=1
if [ -f "speech/${md5}.mp3" ]; then
echo "[cache] Saying $1"
use_fallback=0
#include <glib.h>
#include "debug.h"
#include "navit.h"
#include "metrics.h"
struct metriclist;
GHashTable *
metriclist_init(void)
{
@pgrandin
pgrandin / if_list.py
Created March 2, 2015 22:29
List interfaces and associated IPs in python
import netifaces
for interface in netifaces.interfaces():
print interface
if netifaces.AF_INET in netifaces.ifaddresses(interface):
for link in netifaces.ifaddresses(interface)[netifaces.AF_INET]:
if 'addr' in link:
print " --> ", link['addr']
cd $mountpoint
tar xjpf /var/${STAGEFILE}
mount ${device} $mountpoint/boot
cp /usr/bin/qemu-arm usr/bin/qemu-arm
/etc/init.d/qemu-binfmt start
mkdir -p usr/portage
mount --bind /usr/portage usr/portage
import serial
serial = serial.Serial("/dev/ttyAMA0",
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=0.8)
while True:
rfid = serial.readline().strip()
cd $HOME/git/navit-build
xcodebuild -configuration RelWithDebInfo

Keybase proof

I hereby claim:

  • I am pgrandin on github.
  • I am pgrandin (https://keybase.io/pgrandin) on keybase.
  • I have a public key whose fingerprint is 0F00 1540 9331 B117 81CC 1E78 02B2 93D1 B54E 9F4F

To claim this, I am signing this object:

if( ( (this->strict_mode && this->speed_exceed_limit_offset_strict+routespeed<tracking_speed ) ||
(this->speed_exceed_limit_offset+routespeed<tracking_speed ) ) &&