Skip to content

Instantly share code, notes, and snippets.

View thibthibaut's full-sized avatar
🐧
~

Thibaut Vercueil thibthibaut

🐧
~
  • Paris, France
View GitHub Profile
/* All code goes to .text (flash) */
/* This goes into .rodata (flash) */
const uint8_t weights[10] = {0xFA, 0xB0, 0x32, 0x1C, 0x12, 0xDA, 0x7B, 0x01, 0x42, 0xCA};
/* This goes into .data (stored in flash and copied to ram at startup) */
float values[3] = {0.15, 0.20, 0.55};
/* This goes to .bss (will be 0-init in ram) */
int buffer[100];

GDB cheat sheet

Dumping memory

dump binary value filename variable

dump binary memory filename start_address end_address

set max-value-size 100000000

@thibthibaut
thibthibaut / image_stuff.h
Created January 29, 2020 08:54
Image stuff
const uint8_t rb528_table[32] = {
0, 8, 16, 25, 33, 41, 49, 58,
66, 74, 82, 90, 99, 107, 115, 123,
132, 140, 148, 156, 165, 173, 181, 189,
197, 206, 214, 222, 230, 239, 247, 255
};
const uint8_t g628_table[64] = {
0, 4, 8, 12, 16, 20, 24, 28,
32, 36, 40, 45, 49, 53, 57, 61,
/**
* @brief Enable or disable mirror mode for camera
* @param boolean value, 0 disable, other enable
* @retval void
*/
void BSP_CAMERA_Mirror(int enable){
const uint8_t MVFP_REG = 0x1E;
uint8_t reg_val = CAMERA_IO_Read(CameraHwAddress, MVFP_REG);
if(enable){
# %% Load libraries
import numpy as np
import matplotlib.pyplot as plt
# For RGB888
w, h = (640, 480)
img = np.fromfile('img.bin', dtype=np.uint8)
img = img.reshape((h, w, 3))
# For RGB565
@thibthibaut
thibthibaut / 2fa
Last active March 4, 2019 13:43
Two Factor Authentication on command line
#!/usr/bin/env bash
# !! requires oathtool and gpg !!
# very very inspired by
# https://www.sendthemtomir.com/blog/cli-2-factor-authentication
# $HOME/.2fa should look like this :
# service_name=code
# service_name2=code2
# and should be encrypted with gpg this way :
# gpg --cipher-algo AES256 -c ~/.2fakeys
#include <bitset>
#include <iostream>
#include <list>
#include <vector>
// Function to compute all permutations using iterators. It's still ugly, does a lot of copy and need some
// cleanup
/**
* \brief Computes permutations of the elements between the range (begin, end)
# Permutation function in python
# Computes all possible permutations of elements in a list
def permutations(lst):
perms = []
if len(lst) == 2: #This is the stop condition
perms.append(lst)
permuted = lst[0:2] # We need to make a copy
permuted[0], permuted[1] = permuted[1], permuted[0]
perms.append(permuted)
@thibthibaut
thibthibaut / passmgr.sh
Created March 20, 2017 14:47
The world simplest password manager
#!/bin/bash
#------------------------------------------------------------------------------
# passmgr.sh
# The world simplest password manager ever
# by Aehter Luminifer
# Dependancies:
# * pwgen
# * gpg
# Version: 3.14
# Licence :
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-surround'
Plug 'kien/ctrlp.vim'
Plug 'SirVer/ultisnips'