Skip to content

Instantly share code, notes, and snippets.

View gbin's full-sized avatar

Guillaume Binet gbin

View GitHub Profile
@gbin
gbin / main.rs
Last active August 16, 2023 16:31
Mav router example based on rust-mavlink mods made by Skyways
mod clock;
mod ego;
mod keepalive;
mod mavrouter;
use clap::Parser;
use file_rotate::compression::Compression;
use file_rotate::suffix::AppendTimestamp;
use file_rotate::suffix::FileLimit;
use file_rotate::ContentLimit;
#!/usr/bin/env python3
#
# This script is a tool that helps you calculate the potential benefits
# in occupied size on disk using the ext4 inlinedata new feature on
# Linux kernels 3.8.0+:
# "The new Inline Data Support feature allows Ext4 to store files that only consist of a few bytes together with the inode to save storage space and accelerate access"
# see http://www.h-online.com/open/features/What-s-new-in-Linux-3-8-1804240.html for details.
#
# Just run it on your ext4 mountpoints and it will tell give you the trade off
@gbin
gbin / convert.py
Created May 27, 2015 17:54
Converting a Python 2 berkeley db shelve to a python 3 one.
## py3
import shelve
import dbm
import pickle
with dbm.open('source', 'r') as source: # no .db here on purpose.
with shelve.open('destination.db') as destination:
for key in source.keys():
key = key.decode('utf-8')
value = pickle.loads(source[key])
print(key, value)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gbin
gbin / gist:41dbc2b87a985b4539982b5556e7f8c0
Created January 2, 2020 16:36
makepkg with parallelism
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
@gbin
gbin / PluginMaker.py
Last active July 24, 2019 21:16
This is an example plugin for errbot generating plugins and commands dynamically
from errbot import BotPlugin, botcmd
class PluginMaker(BotPlugin):
""" Example demonstrating how to create an errbot plugin out of thin air.
This basically generates a plugin from scratch and registers it at activation.
"""
def activate(self):
super().activate()
@gbin
gbin / test-myhdl.py
Last active December 10, 2015 17:16
from myhdl import always, always_comb, always_seq, Signal, ResetSignal, toVerilog, toVHDL, delay, traceSignals, Simulation, now, intbv, concat
def chenillar(clk, reset, leds, direction):
@always(clk.posedge)
def scroll():
if bool(direction):
leds.next = leds >> 1
if leds == 0b1:
direction.next = 0
else:
@gbin
gbin / err-map.py
Created September 11, 2012 10:56
How I quickly plotted the Err usage on a map
#! /usr/bin/python
import matplotlib
matplotlib.use('Qt4Agg')
from datetime import datetime
import os
DIR = 'data/'
dirList=os.listdir(DIR)
unzip = lambda l:tuple(zip(*l))
@gbin
gbin / remindme.py
Created October 4, 2015 22:46
Errbot recipes: how to persist data
from errbot import BotPlugin, botcmd
class RemindMe(BotPlugin):
@botcmd
def store(self, msg, args):
self['key'] = args
@botcmd
def recall(self, msg, args):
return self['key']