Skip to content

Instantly share code, notes, and snippets.

View ardabbour's full-sized avatar
😎
Working on the next big thing.

AR Dabbour ardabbour

😎
Working on the next big thing.
View GitHub Profile
# consuming sodium in cmake is a needlessly difficult task.
include(ExternalProject)
set(SODIUM_VERSION 1.0.19)
ExternalProject_Add(
sodium
URL https://download.libsodium.org/libsodium/releases/libsodium-${SODIUM_VERSION}.tar.gz
PREFIX ${CMAKE_BINARY_DIR}/_deps/sodium # this is to avoid having a system install
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=<INSTALL_DIR>
@ardabbour
ardabbour / object_manager.h
Created August 24, 2023 10:19
Defines the ObjectManager class template for managing objects with activation and deactivation capabilities.
/**
* @file object_manager.h
* @brief Defines the ObjectManager class template for managing objects with activation and deactivation capabilities.
* @author Abdul Rahman Dabbour
* @license MIT
*/
#ifndef OBJECT_MANAGER_H
#define OBJECT_MANAGER_H
@ardabbour
ardabbour / Tree.h
Created July 4, 2023 13:56
A simple C++ tree implementation
/*
Copyright 2023 Abdul Rahman Dabbour
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@ardabbour
ardabbour / logger.sh
Created April 10, 2023 14:14
A simple logging 'library' for bash scripts.
#!/bin/bash
# A simple logging 'library' for bash scripts.
#
# There are three basic things to set:
# - Minimum log level [default: info] (debug < info < warn < error < critical)
# - Node name [default: unidentified]
# - Log path [default: $HOME/.local/log/$LOGGER_NODE_NAME.log]
#
# Example usage:
@ardabbour
ardabbour / git-recursive.sh
Created May 11, 2022 12:56
Executes a given command recursively on every git repository found under a given directory.
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
###
# git-recursive
#
# This script will execute a given command recursively on every git repository
# found under the current directory.
#
# Copyright 2022 Abdul Rahman Dabbour
@ardabbour
ardabbour / cpu_usage.c
Created December 16, 2021 07:19
very unoptimized way of calculating the cpu usage percentage
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
struct cpu_data_t {
int user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice;
};
// based on answer here: https://stackoverflow.com/a/23376195/8295404
@ardabbour
ardabbour / cmake_uninstall.py
Created December 1, 2021 11:21
'Uninstall's files installed using cmake via the install_manifest
#!/usr/bin/env python3
from pathlib import Path
from argparse import ArgumentParser
if __name__ == "__main__":
PARSER = ArgumentParser()
PARSER.add_argument(
"--install_manifest",
"-m",
@ardabbour
ardabbour / .dockerignore
Created June 9, 2021 21:09
A starting point for a ROS dockerignore file
## C++
# ----------------------------------------------------------------------------
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
@ardabbour
ardabbour / melodic.dockerfile
Last active June 9, 2021 21:23
A starting point for ROS melodic project Dockerfiles
FROM ros:melodic
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# Add essential tools
RUN apt-get update && apt-get install --no-install-recommends -y \
apt-transport-https \
@ardabbour
ardabbour / .clang-format
Created June 9, 2021 21:04
Clang Format configuration for ROS projects, from MoveIt!'s repository
BasedOnStyle: Google
ColumnLimit: 120
MaxEmptyLinesToKeep: 1
SortIncludes: true
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2