Skip to content

Instantly share code, notes, and snippets.

@charlie-x
charlie-x / gist:bc32ee0ed6d71ee097b0ecf59839d3bc
Last active February 25, 2024 20:47
segger RTT logger function for meshtastic that works with %i and floating point, it does use more stack etc
// i added in DebugConfiguration.cpp
#ifdef USE_SEGGER
// largest string it can process
const int BUFFER_SIZE = 512;
/*********************************************************************
*
* cx_SEGGER_RTT_vprintf
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/time.h>
int gcd(int a, int b);
void main()
{
struct timeval tvTime;
@charlie-x
charlie-x / gist:8b2a9e2d1ebaa11554be0ffc6871a0bb
Created August 11, 2021 19:37
windows 10 install.wim extraction and using it for MSU
notes on dism etc
download matching windows 10 ISO matching winver.exe, mount the iso or extract it
@powershell
Mount-DiskImage -ImagePath "c:\temp\Windows-10x64.iso"
(Get-DiskImage "c:\temp\Windows-10x64.iso" | Get-Volume).DriveLetter
if htere is no install.wim and its an install.esd instead
and change to the directory where it is, show the types of windows that are available
@charlie-x
charlie-x / gist:96a92aaaa04346bdf1fb4c3621f3e392
Created July 28, 2021 20:55
recompile wsl2 kernel, add modules and CAN modules + can utils.
mines ubuntu 20.04 based, WSL2
in windows
wsl --list -v
* Ubuntu-20.04 Stopped 2
in wsl
# the old update routine
sudo apt-get update -y
# add tools to build kernel, apologies if i missed anything as i already have a bunch of dev stuff setup
sudo apt-get install -y autoconf bison build-essential flex libelf-dev libncurses-dev libssl-dev libtool libudev-dev
@charlie-x
charlie-x / gist:b61719cf09bc07e3c83aae28fe781933
Created January 7, 2021 04:33
build hackrf/windows msvc 2019 static
git clone https://github.com/mossmann/hackrf
vcpkg install libusb:x64-windows-static
vcpkg install pthreads:x64-windows-static
cmake-gui
select hackrf/host/libhackrf/
select build folder
if cmake isn't integrated
#windows10 admin powershell
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=22 connectaddress=YOUR_WSL2IP connectport=22
netsh advfirewall firewall add rule name="Open Port 22 for WSL2" dir=in action=allow protocol=TCP localport=22
netsh interface portproxy show v4tov4
#wsl2
#first time
sudo apt-get install -y openssh-server
sudo ssh-keygen -A
@charlie-x
charlie-x / setup_gnuais.sh
Last active January 2, 2021 18:17
gnuradio + ais sim for WSL2 ubuntu 20.xx
# ubuntu 20+
sudo apt-get install -y gnuradio
sudo apt-get install -y git
sudo apt-get install -y doxygen
sudo apt-get install -y swig-dev
sudo apt-get install -y swig
sudo apt-get install -y libswig-dev
sudo apt-get install -y liborc-dev
sudo apt-get install -y libhackrf-dev
sudo apt-get install -y libbladerf-dev
options:
parameters:
author: Mictronics
category: Custom
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
@charlie-x
charlie-x / ais-simulator-file.grc
Last active January 2, 2021 18:11
ais to file
options:
parameters:
author: Mictronics
category: Custom
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
@charlie-x
charlie-x / gist:c42655120e81716e4ff580bec0b3d205
Created November 26, 2020 20:37
kmotion dinput starter
#include "stdafx.h"
#define DIRECTINPUT_VERSION 0x0700
#include <wbemidl.h>
#include <dinput.h>
#include <xinput.h>
#pragma comment(lib,"xinput.lib")
#define SAFE_RELEASE(x) if(x) { x->Release(); x = NULL; }