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
#include <algorithm>
#include <stdexcept>
#include <vector>
/**
* @brief Find the best vector of costs arranged in descending order from a vector of vectors of costs.
*
* @tparam T A comparable type.
* @param costs A vector of vectors of prioritized costs.
* @param minimize Whether or not smaller values are better.
@ardabbour
ardabbour / cccm.py
Last active December 3, 2021 13:10
Merges compile_command.json spread across multiple packages under a catkin workspace for debugging using llvm tools.
#!/usr/bin/env python3
"""
Copyright 2021 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
@ardabbour
ardabbour / .clang-tidy
Created June 9, 2021 21:03
Clang Tidy configuration for ROS projects, from MoveIt!'s repository
Checks: '-*,
performance-*,
llvm-namespace-comment,
modernize-redundant-void-arg,
modernize-use-nullptr,
modernize-use-default,
modernize-use-override,
modernize-loop-convert,
readability-named-parameter,
readability-redundant-smartptr-get,
@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
@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 / .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 / 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 / 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 / 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 / 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: