Skip to content

Instantly share code, notes, and snippets.

@gorbatschow
gorbatschow / DownsampleLTTB.h
Last active October 30, 2024 14:38
Largest-Triangle-Three-Buckets Downsampling C++
// Largest-Triangle-Three-Buckets algorithm
// SEE
// https://github.com/sveinn-steinarsson/flot-downsample
// https://www.base.is/flot/
// c++ port by [email protected]
template<typename T>
inline void DownsampleLTTB(const T* data_x, const T* data_y, size_t data_length,
T* sampled_x, T* sampled_y, size_t threshold)
{
@hackpascal
hackpascal / 0001-binutils-2.24-add-lexra-support.patch
Created December 17, 2017 14:35
Patch to binutils-2.24 for Lexra processors (LX4180/RLX4181/...)
--- binutils-2.24.orig/bfd/bfd-in2.h
+++ binutils-2.24/bfd/bfd-in2.h
@@ -1938,6 +1938,12 @@ enum bfd_architecture
#define bfd_mach_mipsisa64 64
#define bfd_mach_mipsisa64r2 65
#define bfd_mach_mips_micromips 96
+#define bfd_mach_mips4180 4180
+#define bfd_mach_mips4181 4181
+#define bfd_mach_mips4281 4281
+#define bfd_mach_mips5181 5181
@Saissaken
Saissaken / Update git fork with tags.sh
Last active April 6, 2025 04:17
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@ccbrown
ccbrown / DumpHex.c
Last active February 12, 2025 00:25
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];