Skip to content

Instantly share code, notes, and snippets.

@sriramster
sriramster / dyn_arr.c
Created March 26, 2026 19:27
Dynamic generic array implementation.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
size_t count;
size_t capacity;
} Header;
#define ARR_INIT_CAPACITY 256
@sriramster
sriramster / cleanup_gcc.c
Created February 6, 2026 04:47
Cleanup attribute check for gcc
// gcc -g -O2 -Wall -std=c2x file.c -o file
#include <stdio.h>
#include <stdlib.h>
static void cleanup_free(void * p) {
free(*(void **)p);
}
void leak_check_test() {
__attribute__((cleanup(cleanup_free))) char * c = malloc(100);
#include <stdio.h>
#include <inttypes.h>
uint32_t rev(uint32_t x)
{
x = (x & 0x55555555) << 1 | (x >> 1) & 0x55555555;
x = (x & 0x33333333) << 2 | (x >> 2) & 0x33333333;
x = (x & 0x0F0F0F0F) << 4 | (x >> 4) & 0x0F0F0F0F;
x = (x << 24) | ((x & 0xFF00) << 8) |
(x >> 8) & 0xFF00 | (x >> 24);
@sriramster
sriramster / process_fork.c
Created February 16, 2021 05:46
Sys call experiments
#include <dirent.h>
#include <error.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#define CHAR_BIT 8
int min(int x, int y)
{
return y ^ ((x ^ y) & -(x < y)); // min(x, y)
}
int max(int x, int y)

Rosbag2 Transactions v0.1

Sqlite transaction based querying model.

Things to take care off

  • Rosbag2 sqlite plugin does'nt work based on sqlite transactions.
  • To enable optimized querying or writes within sqlite transactions are the best options.

Some URL references on transactions are below:

Sriram Raghunathan

Projects

  • Visteon [Present]

    ** Currently working and leading a team on the development of Autonomous Framework from Bangalore. ** Ported DM-verity to one of the car embedded stacks, developed the file system manager to handle verity partitions. ** Enabled secure signing features on u-boot and ported the same onto ARM targets.

@sriramster
sriramster / git_stuffs.md
Last active November 1, 2020 15:07
git flow

Git stuffs

Some basic commands. Ignore if you are already familiar with these stuffs.

Creating a new repo.

git init $PATH

Path needs to be empty or could have source files, except a .git folder.

@sriramster
sriramster / ci.md
Last active October 27, 2015 07:01
CI configuration notes