Skip to content

Instantly share code, notes, and snippets.

@Heegiiny
Heegiiny / imperfect-design.md
Last active December 27, 2022 22:22 — forked from dev-zzo/imperfect-design.md
A curated list of research papers and blog posts on embedded security, keyed by the device p/n
/*
* Sample application that makes use of the SPIDEV interface
* to access an SPI slave device. Specifically, this sample
* reads a Device ID of a JEDEC-compliant SPI Flash device.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
# Enable i2c
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
# Disable default audio interface
dtparam=audio=off
# Enable audio (loads snd_bcm2835)
dtoverlay=i2s-mmap
/* USER CODE BEGIN 0 */
uint32_t data_buf_i = 0;
// Буферы данных
#define DATA_BUF_SIZE 1024
uint8_t data_buf[DATA_BUF_SIZE];
uint8_t comm_buf[DATA_BUF_SIZE];
// Буферы для текущего передаваемого байта
<div class="photo-gallery" style="display:none">
<div data-family="1">
<div class="item">
<img src="image/slide1.jpg" alt="">
<div class="bg"></div>
<div class="caption">
<h3>Предложение <br>руки и сердца</h3>
<p class="date">10 октября 2018 г.</p>
</div>
</div>
# Batch rename files by finding and replacing terms in the filename
#
# http://www.peteryu.ca/tutorials/shellscripting/batch_rename
FIND="1ad91ff3d38e48eaff6d08dcfcbbd630"
REPLACE="font"
for filename in $FIND*; do mv $filename ${filename//$FIND/$REPLACE}; done
# makefile for libpng using MSYS/gcc (shared, static library)
# Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
#
# Portions taken from makefile.linux:
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta
# Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@Heegiiny
Heegiiny / flip9bits.cpp
Created April 11, 2018 12:22
Bitwise mirror of the last 9 bits of integer
uint16_t flip9bits(uint16_t in)
{
uint16_t out;
for (int i = 0; i < 9; i++) {
out <<= 1;
out |= in & 1;
in >>= 1;
}