Skip to content

Instantly share code, notes, and snippets.

View windowsair's full-sized avatar
🍋
Eating sour lemons

windowsair

🍋
Eating sour lemons
View GitHub Profile
@cfillion
cfillion / openocd-LPC546xx.cfg
Last active May 30, 2024 07:45
OpenOCD script for LPC546xx via MCU-Link2 (w/o flash support)
set CHIPNAME LPC546xx
set CPUTAPID 0x10CAA02B
adapter driver cmsis-dap
transport select swd
adapter speed 3000
# gdb_memory_map enable
# gdb_flash_program enable
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# update pacman dbs
# sudo pacman -Syy
# install 950q driver if missing
# https://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-950Q
if [[ ! -f /lib/firware/dvb-fe-xc5000-1.6.114.fw ]]; then
wget http://www.kernellabs.com/firmware/xc5000/dvb-fe-xc5000-1.6.114.fw
mv dvb-fe-xc5000-1.6.114.fw /lib/firmware/
@jtbr
jtbr / endianness.h
Last active October 14, 2025 08:31
cross-platform / cross-compiler standalone endianness conversion
/**
* @file endianness.h
* @brief Convert Endianness of shorts, longs, long longs, regardless of architecture/OS
*
* Defines (without pulling in platform-specific network include headers):
* bswap16, bswap32, bswap64, ntoh16, hton16, ntoh32 hton32, ntoh64, hton64
*
* Should support linux / macos / solaris / windows.
* Supports GCC (on any platform, including embedded), MSVC2015, and clang,
* and should support intel, solaris, and ibm compilers as well.
@kwk
kwk / README.md
Created October 1, 2014 13:52
Forgot to sign-off commits?

No problem,

run

git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Your Name <Your.Name@example.com>'" HEAD~2..HEAD

To sign-off the last two commits.

Then force to push them to the remote repo with the -f option:

@ccbrown
ccbrown / DumpHex.c
Last active December 9, 2025 20:00
Compact C Hex Dump Function w/ASCII
#include <stdio.h>
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];