Skip to content

Instantly share code, notes, and snippets.

@oldrev
oldrev / fixedpoint-pid.c
Created July 25, 2019 00:12
Fixed-Point PID Algorithm
// Fixed-Point PID Algorithm
// Ported from: https://gist.github.com/bradley219/5373998
// Author: Li "oldrev" Wei <oldrev@gmail.com>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#define FIXED32_Q (16)
@eleciawhite
eleciawhite / td-snapshot.py
Created February 15, 2017 16:35
A Temporal-Difference Learning Snapshot
# ===== A Temporal-Difference Learning Snapshot =====
# Patrick M. Pilarski, pilarski@ualberta.ca, Feb. 11, 2017
# ----
# 'xt' and 'xpt1' are the state information for the current (time t) and next (time t+1) time steps in the form of binary vectors
# e.g., if you had a house with five rooms, 'xtp1' could be [0,0,1,0,0], with the single '1' indicating that you are in Room 3;
# in this case, 'xt' might be [0,1,0,0,0] indicating you were just in Room 2;
# for a robot servo, instead of "rooms" you could use binned joint angle ranges.
# 'r' is the signal to be predicted; this is a scalar and could represent reward, or any other signal of interest
# e.g., in the examples above, it might be the reward you get for entering a given room, or the current draw of the servo.
# 'gamma' is the desired time scale of the prediction (with 0 <= gamma <= 1);
@RichardBronosky
RichardBronosky / pep8_cheatsheet.py
Created December 27, 2015 06:25
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py
@gbaman
gbaman / HowToOTG.md
Last active July 19, 2024 11:47
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

Reverse proxy over 3G modem (draft)

We will explain how to configure a cubieboard running debian as a reverese proxy. The modules that will be used are wvdial and autossh

Credits goes to:

1. http://blog.rootshell.be/2015/02/19/my-little-pwnie-box/
2. https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd
@veproza
veproza / AGPS.md
Last active July 23, 2023 04:36
Getting u-blox MAX-7C GPS to work with Assisted A-GPS

Getting u-blox MAX-7C GPS to work with Assisted A-GPS

So you got your u-blox GPS and wired it up only to look at it struggling to get a valid fix? Under less than ideal conditions, it can take a better part of half an hour. That's because unlike your smartphone GPS, it doesn't have the luxury of having downloaded all the auxiliary navigation data (almanacs and the lot) out-of-band, via fast mobile connection. Instead it relies on the satellite's signal itself, which is being transmitted to you at meager 50 bits per second (I'm not missing "kilo" there, it's three orders of magnitude slower than your 2G GPRS connection).

Luckily, the u-blox receivers are fitted with what the company calls "AssistNow" capability and it does exactly the same thing your iPhone does - feeds the GPS with pre-downloaded almanacs, speeding up the acquisition process to mere seconds.

In principle, the process looks easy enough - we just need to download the data, and then push them to the receiver. Sadly, the AssistNow documentat

@KonradIT
KonradIT / HERO4BlackWifiHacking2.md
Last active March 8, 2016 23:34
GoPro HERO4 Black WIfi Hacking ep2
@KonradIT
KonradIT / hero4.md
Last active March 19, 2017 04:55
GoPro HERO4

#GoPro HERO4 (A tale of firmware leaks and marketing)

Written by /u/konrad-iturbe (Konrad Iturbe) and with help of /u/OverByThere's leaked firmware.


The GoPro HERO4 Black Adventure edition is 4x times more powerful than ever.

HERO4 cameras:

  • HERO4 Black (BANZAI)
@KonradIT
KonradIT / readme.md
Last active July 11, 2024 20:46
GoPro Studio for Linux
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)