Skip to content

Instantly share code, notes, and snippets.

@igricart
igricart / set_docker.sh
Last active October 14, 2020 10:59
Install docker and set the system to no use it as sudo
#!/bin/bash
sudo apt update
sudo apt install docker.io
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
docker version
docker run hello-world
@igricart
igricart / FindGMock.cmake
Created October 22, 2020 12:16
enable find_package(GMock) on cmakelists
# Locate the Google C++ Mocking Framework.
# (This file is almost an identical copy of the original FindGTest.cmake file,
# feel free to use it as it is or modify it for your own needs.)
#
#
# Defines the following variables:
#
# GMOCK_FOUND - Found the Google Testing framework
# GMOCK_INCLUDE_DIRS - Include directories
#
@igricart
igricart / oneshot_example.md
Last active October 28, 2020 10:27
Gist to create some test files to show the basic functionality of a oneshot systemd service

Test script

create a script file:

touch /tmp/oneshot_example

copy and paste the content from Run script session then run chmod +x /tmp/oneshot_example and sudo /tmp/oneshot_example

Raw example can be found here

Run script

@igricart
igricart / ros-docker.md
Last active November 6, 2020 14:55
Gist to create a debian package out of a ROS package using docker and meant for amd or arm architectures

Create debian packages out of a ROS package (docker)

The dockerfile should be something like

# If amd64 architecture
# FROM osrf/ros:melodic-desktop-full-bionic

# If arm64 architecture
FROM arm64v8/ros:melodic

# uncomment ARG if you need to interact with a remote repository
@igricart
igricart / PahoMQTTC.md
Last active November 17, 2020 14:07
Install-Create Deb package Paho MQTT C/Cpp

How create a debian package out of Paho MQTT C

$ git clone https://github.com/eclipse/paho.mqtt.c.git
$ cd paho.mqtt.c

# Check version from Paho MQTT Cpp too
$ git checkout v1.3.1
@igricart
igricart / condition_variable.md
Last active November 11, 2020 11:35
example of condition_variable usage

Example to show the usage of condition variable

In addition to the good documentation provided by cppreference

I had a doubt that the mutex would be locked in the waiting cycle, but because of the condition_variable::wait() function, it actually allows other threads to access the variable while no notifi_all() method has been called.

#include <iostream>
#include <condition_variable>

Create a debian pkg out of CMakeFiles/CMakeLists.txt

The following script is meant to be used to create a debian package out of a CMake project well defined

  GNU nano 2.9.3                                                                                 build_deb_from_cmake.sh                                                                                 Modified  

export DEBMAIL="[email protected]"
export DEBFULLNAME="Ignacio Ricart"
export DEB_BUILD_OPTIONS=nocheck
@igricart
igricart / cheatsheet.md
Last active November 19, 2020 09:47
Cheat sheet for deb packages

Simple Cheat Sheet

This gist is menat to help find some information and handle errors with packages using either dpkg or apt

To use it, change <package> for your package name

Getting install tree from package

$ dpkg -c <package>
@igricart
igricart / example.md
Created November 19, 2020 14:52
How to check if a command succeeded or not

How to check it ?

$? represents last command sent

#!/bin/bash

touch a/a/.a
if [ $? -eq 0 ]; then
 echo OK
@igricart
igricart / debian_pkg.md
Last active May 8, 2024 16:01
Create a simple debian package

Having a simple debian package out of a Python script

Create a directory to store the debian folder

$ mkdir -p test_folder/DEBIAN

Create a control file inside debian folder