Skip to content

Instantly share code, notes, and snippets.

View Micrified's full-sized avatar
🇫🇷
Collating...

Micrified

🇫🇷
Collating...
  • Rotterdam, Nederlands
View GitHub Profile
@Micrified
Micrified / main.tex
Created March 24, 2020 21:56
What to include in main
% These packages are for presenting code
\usepackage{listings}
\usepackage{color}
% Here I import the code presentation style
\input{Config/code_style.tex}
@Micrified
Micrified / code_style.tex
Created March 24, 2020 21:55
Latex code style file
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.97,0.97,0.97}
\lstdefinestyle{c-style}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
@Micrified
Micrified / Callchain.cpp
Created March 4, 2020 09:06
ROS2 Executor callchain
bool Executor::get_next_ready_executable(AnyExecutable & any_executable)
{
bool success = false;
// Check the timers to see if there are any that are ready
memory_strategy_->get_next_timer(any_executable, weak_nodes_);
if (any_executable.timer) {
success = true;
}
@Micrified
Micrified / mpu6050.c
Created March 2, 2020 19:13
Source file for the MPU-6050 ESP32 wrapper
#include "mpu6050.h"
/*
*******************************************************************************
* Global Variables *
*******************************************************************************
*/
@Micrified
Micrified / mpu6050.h
Created March 2, 2020 19:12
Header file for the MPU-6050 ESP32 wrapper.
/*
*******************************************************************************
* (C) Copyright 2020 Micrified *
* Created: 27/02/2020 *
* *
* Programmer(s): *
* - Charles Randolph *
* *
* Description: *
* MPU-6050 interface for the ESP32 I2C driver *
@Micrified
Micrified / dynamic_notes.md
Created January 27, 2020 15:32
Dynamic library mini guide

Dynamic Linked Libraries

Assuming you have a directory of source files you want to turn into a dynamic linked library, first convert them into object files using the following command:

gcc -fPIC -c *.c

The -fpic command stands for "position independent code".

Next, the library is created using the following command:

@Micrified
Micrified / stefano_meeting_notes.md
Created January 27, 2020 15:05
Meeting Notes for Communications

Communication Hardware/Software Facts

  1. The hardware takes a slice of bytes and sends it.
  2. A driver provides an interface to send information
  3. There isn't just one interface, but several that can be used (expanded upon later)
  4. Stefano has been told that all buses are point-to-point.
  5. Stefano has been told he will have his own UART
  6. The hardware internally uses a simple protocol with a header, size, body, etc.
  7. The hardware provides telemetry information that can be queried via the driver.
@Micrified
Micrified / cpp.md
Last active November 26, 2019 13:38
C++

C++

File headers

Begin all files by including your headers, possibly after whatever comment banner you might want to include. To avoid an annoying implicit namespace warning, make sure to declare you are using the std namespace after the #include directives. Example:

@Micrified
Micrified / wfdb.md
Last active November 13, 2019 11:39
WFDB file solutions

When you get the error: init: can't open header for ...

Basically locate what directory your database files are in. Suppose it is:

  • /Users/Owatch/Documents/Academics/TU/y2/b1/IoT-Seminar-IN4398/wfdb/local/database

Then simply export the WFDB environment variable:

  • WFDB=/Users/Owatch/Documents/Academics/TU/y2/b1/IoT-Seminar-IN4398/wfdb/local:/Users/Owatch/Documents/Academics/TU/y2/b1/IoT-Seminar-IN4398/wfdb/local/database LC_CTYPE=UTF-8
@Micrified
Micrified / annot_amplitude.c
Last active November 14, 2019 09:52
Reads both a WFDB record and annotation file at once, pairing sample amplitude to a annotation.
#include <stdio.h>
// #include <malloc.h>
#include <wfdb/wfdb.h>
#define USE_FMT "%s <record> :: Extracts annotations + " \
"amplitude at annotation for a record\n"
int main (int argc, char *argv[], char **envp) {