Skip to content

Instantly share code, notes, and snippets.

View plusangel's full-sized avatar
😁
happy coding!

angelos plastropoulos plusangel

😁
happy coding!
View GitHub Profile
@plusangel
plusangel / invoices_example.cpp
Created August 29, 2019 16:09
invoices example in modern c++
#ifndef INVOICE_H_
#define INVOICE_H_
#include <chrono>
#include <memory>
#include <ostream>
#include <string>
#include <vector>
#include "Customer.h"
@plusangel
plusangel / iterators-example.cpp
Created August 25, 2019 15:51
c++ iterators example #1
#include <array>
#include <algorithm>
#include <iostream>
class MyType {
public:
MyType() = default;
MyType(int item):item_{item}
{ }
@plusangel
plusangel / switch_intrface.cpp
Created August 16, 2019 12:27
abstract, interfaces
#include <iostream>
class Switchable {
public:
virtual void on() = 0;
virtual void off() = 0;
};
class Switch {
private:
@plusangel
plusangel / main.cpp
Created July 13, 2019 20:00
c++ thread experiments #1
#include <iostream>
#include <vector>
#include <thread>
#include <future>
std::mutex g_display_mutex;
// function for threads
void accumulator_function(const std::vector<int> &v, unsigned long long &acm,
@plusangel
plusangel / bashrc_ROSX.txt
Created April 21, 2019 11:27
bashrc for ROS
# ROS1
export ROS_DISTRO=melodic
source /opt/ros/$ROS_DISTRO/setup.bash
source /home/user/catkin_ws/devel/setup.bash
# ROS2
export ROS_DISTRO=crystal
source /opt/ros/$ROS_DISTRO/setup.bash
source /home/user/ros2_ws/install/local_setup.bash
@plusangel
plusangel / rPi3-ad-hoc.txt
Created March 18, 2019 13:52
rPi3-ad-hoc
I have setup Ad-Hoc mode on my Pi3.
This involves modification to network configuration file /etc/network/interfaces so you should first make a backup e.g. sudo cp /etc/network/interfaces /etc/network/interfaces.orig.
Replace the interfaces file with the following:-
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
@plusangel
plusangel / storeOutputToString.py
Created February 21, 2019 09:03
Store standard output on a variable in Python
#from StringIO import StringIO # Python2
from io import StringIO # Python3
import sys
# Store the reference, in case you want to show things again in standard output
old_stdout = sys.stdout
# This variable will store everything that is sent to the standard output
result = StringIO()
@plusangel
plusangel / main.c
Last active November 19, 2018 20:47
RIOT-OS serial comm in arduino m0 pro
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "board.h"
#include "msg.h"
#include "thread.h"
#include "periph/uart.h"
How to download all Gazebo models
Gazebo is a wonderful simulation tool widely used in robotics projects. The project includes a library of 3D models that are automatically downloaded on demand. However this makes the application pause each time a model is used for the first time, which can take a considerable time depending on connection speed and interfere with the flow of work.
In order to avoid this issue I wrote the below script to do a bulk download of all models in the Gazebo library, then copy them to the local model folder. Simply copy the lines below to a script file on a convenient local folder and run it from a command prompt.
#!/bin/sh
# Download all model archive files
wget -l 2 -nc -r "http://models.gazebosim.org/" --accept gz
@plusangel
plusangel / my_ROS_misc.txt
Last active July 15, 2023 13:27
ROS misc
How to install packages from github
git clone -b <branch> <address>
e.g. git clone -b hydro-devel https://github.com/ros/common_msgs.git
What python version I ahve installed?
pkg-config --modversion opencv
How to view a camera topic on ROS?
rosrun image_view image_view image:=/usb_cam/image_rect