Skip to content

Instantly share code, notes, and snippets.

View marc-hanheide's full-sized avatar
💭
coding?

Marc Hanheide marc-hanheide

💭
coding?
View GitHub Profile
@marc-hanheide
marc-hanheide / 01_generate_certificate_authority.sh
Last active May 20, 2020 09:54
Generate certificates for mongodb
# set all variables
KEY_BITS=4096
CA_PRIVATE_KEY_NAME="certificate_authority_private_key.key"
CA_CERT_NAME="certificate_authority_root_certificate.cert"
DAYS_VALID=365
# these are subject variables to be added into the certificate
CA_COUNTRY_CODE="GB"
CA_PROVINCE="Lincolnshire"
CA_LOCATION="Lincoln"
CA_ORGANISATION="University of lincoln"
@marc-hanheide
marc-hanheide / v4l2_loopback.sh
Created April 2, 2020 14:13
Using V4L2 video loopback with ffmpeg and ROS
# https://superuser.com/questions/1330959/what-is-the-right-ffmpeg-output-format-for-a-v4l2-loopback-device
# https://github.com/lucasw/image_to_v4l2loopback
# install and load video loopback
sudo apt-get install v4l2loopback-utils v4l2loopback-dkms
sudo modprobe v4l2loopback
# stream the desktop
ffmpeg -f x11grab -r 15 -s 640x480 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuyv422 -threads 0 -f v4l2 /dev/video0
@marc-hanheide
marc-hanheide / README.md
Created November 3, 2019 11:24
Thorvald SIM tipcs and tricks

Some notes to launch Thorvald

Launch GRASPberry robot:

roslaunch rasberry_bringup robot_bringup.launch robot_model:=$(rospack find rasberry_bringup)/config/tall_robot_example.yaml model_extras:=$(rospack find graspberry_description)/scara_arm/urdf/Harvesting_extras.xacro ekf_publish_tf:="$EKF_PUBLISH_TF" simple_sim:=$USE_SIM with_teleoperation:=true world_name:=$GAZEBO_WORLD use_gui:=$USE_GUI
@marc-hanheide
marc-hanheide / docker-purge.sh
Created October 7, 2019 20:35
Purge all docker resources (legacy)
# dangerous: removes all containers:
docker ps -aq --no-trunc | xargs docker rm
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
@marc-hanheide
marc-hanheide / dbus-config.sh
Last active August 27, 2020 14:22
connect to Dbus (in gnome session) via SSH
# source this to set the dbus env in a gnome session
export DISPLAY=:0
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
# You may now configure things in gsettings, e.g. run vino:
gsettings reset org.gnome.Vino network-interface
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
@marc-hanheide
marc-hanheide / merge.php
Created November 16, 2018 14:24
milestone merge in PGR system
<?php
$mt_name_old = "TDNAI (With Confirmation of Studies)"
$mt_name_new = "RDNAI (With Confirmation of Studies)"
// Get Old and New MilstoneType IDs
$mt_old = App\Models\MilestoneType::where('name', $mt_name_old )->withTrashed()->first();
$mt_new = App\Models\MilestoneType::where('name', $mt_name_new )->first();
@marc-hanheide
marc-hanheide / pre-release-command.sh
Created October 20, 2018 21:03
ROS pre-release in LCAS
sudo apt-get install python3-ros-buildfarm
mkdir -p /tmp/prerelease_job
cd /tmp/prerelease_job
generate_prerelease_script.py \
https://raw.githubusercontent.com/LCAS/ros_buildfarm_config/master/index.yaml \
kinetic default ubuntu xenial amd64 \
--custom-repo pcl_catkin_test__custom-2:git:https://github.com/LCAS/pcl_catkin.git:lcas_c11 \
--level 1 --output-dir ./
@marc-hanheide
marc-hanheide / install-github-client.sh
Created October 17, 2018 09:37
Install GitHub client on Linux (snap)
#!/bin/bash
curl -L https://github.com/shiftkey/desktop/releases/download/release-1.4.2-linux1/GitHubDesktop-linux-amd64-1.4.2-linux1.snap > /tmp/GitHubDesktop-linux-amd64-1.4.2-linux1.snap && \
snap install --dangerous --classic /tmp/GitHubDesktop-linux-amd64-1.4.2-linux1.snap
@marc-hanheide
marc-hanheide / find_dbus.sh
Created September 26, 2018 09:19
gain access to local running dbus session in gnome
# source or copy this to gain access to a running dbus session in your ssh session
GNOME_SESSION_PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$GNOME_SESSION_PID/environ|cut -d= -f2-)
@marc-hanheide
marc-hanheide / logging.py
Created June 17, 2018 13:24
colored logs example
import coloredlogs
import logging
logging.debug("debug")
logging.info("info")
logging.warning("warning")
logging.error("error")
logging.fatal("fatal")
logger = logging.Logger(__file__)
coloredlogs.install(level='DEBUG', logger=logger)