Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@TekuConcept
TekuConcept / example.cpp
Last active March 23, 2024 23:57
FFmpeg stream forwarding in C++
#include <cstdint>
#include <string>
#include <memory>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
@TekuConcept
TekuConcept / callback_swig_project.i
Last active January 11, 2024 01:17
SWIG Native C++ / NodeJS Callbacks
// SWIG's %native directive is now supported for JavaScript since SWIG release (4.0.1+)
// This allows us to not only wrap our C/C++ code with ease, but also add our own
// specialized wrapper functionality to our projects - such as callbacks!
//
// Below are three callback implementations shared for convinience (for Node/V8 engines)
// 1. one-off, inline callback
// 2. one-off, async callback
// 3. persistent async callback
%module "native_callbacks"
@TekuConcept
TekuConcept / fp_math.cpp
Last active April 3, 2022 11:37
Fixed-Point Trigonometric Functions & Other Fun Stuff
/**
* Created by TekuConcept on September 23, 2020
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdint>
// Q10(256) = 262144 := BPI (proportional representation of 2pi as a power of 2)
@TekuConcept
TekuConcept / ReplClient.js
Created October 20, 2021 02:51
REPL Over Sockets (NodeJS v17.0)
var net = require('net')
var socket = net.createConnection(5005)
socket.on('connect', () => {
process.stdin.resume()
process.stdin.on('data', d => {
socket.write(d)
})
})
socket.pipe(process.stdout)
@TekuConcept
TekuConcept / cheat_sheet.txt
Created July 10, 2020 19:28
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@TekuConcept
TekuConcept / ARMonQEMUforDebianUbuntu.md
Created June 1, 2020 20:16 — forked from luk6xff/ARMonQEMUforDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead