This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Program flow tracing (with source modification) | |
=============================================== | |
* assert() | |
Instead of | |
if (variable < 0) | |
printf(...); | |
else | |
printf(...); | |
use | |
assert(variable > 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gst/gst.h> | |
#include <glib.h> | |
#include <czmq.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
/* Gstreamer "main" pipeline */ | |
GstElement *pipeline; | |
void* zmq_thread(void *data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.embest-tech.com/shop/star/marsboard.html | |
U-boot | |
====== | |
git clone git://git.denx.de/u-boot.git | |
cd u-boot | |
# Build U-boot | |
mkdir _build | |
make O=_build marsboard_defconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to use 'pci pass-through' to run Linux in Qemu accessing real Ath9k adapter | |
=============================================================================== | |
# Boot kernel with 'intel_iommu=on' | |
# Unbind driver from the device and bind 'pci-stub' to it | |
echo "168c 0030" > /sys/bus/pci/drivers/pci-stub/new_id | |
echo 0000:0b:00.0 > /sys/bus/pci/devices/0000:0b:00.0/driver/unbind | |
echo 0000:0b:00.0 > /sys/bus/pci/drivers/pci-stub/bind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12345678901234567890123456789012345678901234567890123456789012345678901234567890 | |
pbuf vs. netbuf | |
=============== | |
pbuf -- internal representation of a packet (should not be directly accessed | |
when using netconn or socket API). | |
PBUF_POOL -- one struct containing header + data buffer (+ space reserved for | |
headers) obtained from a pool of limited amount of statically allocated | |
structs (i.e. slab allocator). | |
The size of the whole struct is fixed, in case the data are bigger than the | |
pre-allocated buffer in a struct, multiple pbufs are chained together |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Barebox bootloader | |
================== | |
sudo apt-get install lzop, libusb-1.0-0-dev | |
Build it | |
'''''''' | |
git clone git://git.pengutronix.de/git/barebox.git | |
cd barebox/ | |
mkdir _build | |
CROSS_COMPILE=arm-linux-gnueabihf- make ARCH=arm O=_build imx_v7_defconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multiplatform programming | |
========================= | |
Issues to be aware of: | |
* Integer types sizes (int -- 16 or 32 bits? long -- 32 or 64 bits?) | |
- Storing pointers into integer types | |
(unsigned long on 64-bit Linux vs. 64-bit Windows) | |
* Endianess (big, little) | |
* Memory access width (byte access, word access) | |
* Unaligned memory access |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Undefined behavior | |
================== | |
http://blog.regehr.org/archives/213 | |
...If any step in a program's execution has undefined behavior, | |
then the entire execution is without meaning. This is important: | |
it's not that evaluating (1<<32) has an unpredictable result, | |
but rather that the entire execution of a program that evaluates | |
this expression is meaningless. Also, it's not that the execution | |
is meaningful up to the point where undefined behavior happens: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for (( i=1 ; $i-10; i=$i+1 )) | |
do | |
sleep 0.5s; | |
clear | |
echo -e ' oo\n<|>\n_|_'; | |
sleep 0.5s; | |
clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo -e "Usage: $0 FLAC_FILE CUE_FILE\n" | |
exit 1; | |
fi | |
FLAC_FILE=$1 | |
CUE_FILE=$2 |
NewerOlder