Skip to content

Instantly share code, notes, and snippets.

Danilo Bargen dbrgn

Block or report user

Report or block dbrgn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dbrgn /
Created Apr 18, 2019
WASM aware python testserver
from http import server
PORT = 8000
class WasmAwareRequestHandler(server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.extensions_map['.wasm'] = 'application/wasm'
extern crate hyper;
extern crate reqwest;
extern crate rustysafe;
use std::thread;
use hyper::Server;
use hyper::rt::Future;
use hyper::service::service_fn;
dbrgn /
Created Jun 29, 2018
Example: Shutdown script for iC880A backplane
#!/usr/bin/env python3
import os
import sys
import time
import RPi.GPIO as g
# Pins
dbrgn /
Last active Mar 23, 2018
RPLCD numbering mode notes

In RPLCD version 1.0, some APIs were slightly changed. Previously the CharLCD instance would provide default values for the pin numbers and the numbering mode. But that was changed, since it may be dangerous if these pins are connected to other hardware.

So if you have installed version 1.0 of RPLCD, you need to provide the pin numbering mode yourself. If your code previously looked like this:

from RPLCD import CharLCD
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[40, 38, 36, 32, 33, 31, 29, 23])

...and if you use the BOARD numbering scheme, then change the code like this:

dbrgn /
Last active Apr 5, 2018
iC880A Backplane: LED and button example script
import sys
import time
from RPi import GPIO
LED_R = 36
LED_Y = 38
LED_B = 40
# Use the BOARD numbering system
dbrgn /
Last active Jun 2, 2017
iC880A Backplane: ADC example script
Example script to read the input voltage, measured by the MCP3425 ADC.
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import time
import smbus
dbrgn /
Created Apr 3, 2017
Custom Text based Diesel type for an enum
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum State {
impl fmt::Display for State {
View gist:d729b144f7aaa80f246e40085ded37e9
$ docker run python:3.4 pip install pytest-pep8
Unable to find image 'python:3.4' locally
3.4: Pulling from library/python
693502eb7dfb: Pull complete
081cd4bfd521: Pull complete
5d2dc01312f3: Pull complete
54a5f7da9a4f: Pull complete
25b1aaa33436: Pull complete
3168f1c413f2: Pull complete
7834951bf6f6: Pull complete
/* automatically generated by rust-bindgen */
#[derive(Debug, Copy)]
pub struct Rectangle {
pub width: ::std::os::raw::c_int,
pub height: ::std::os::raw::c_int,
fn bindgen_test_layout_Rectangle() {
View gist:8a214487ec80c4673e31c9226c6f832b
= note: /home/danilo/Projects/rad1o-rust/target/thumbv7em-none-eabihf/release/deps/gravitation-e8a3aecc3f3d7459.0.o: In function `ram': undefined reference to `__aeabi_ui2d' undefined reference to `__aeabi_ddiv' undefined reference to `__aeabi_dmul' undefined reference to `__aeabi_ui2d' undefined reference to `__aeabi_ddiv' undefined reference to `__aeabi_dmul' undefined reference to `__aeabi_ddiv' undefined reference to `__aeabi_dsub' undefined reference to `__aeabi_ddiv'
You can’t perform that action at this time.