Skip to content

Instantly share code, notes, and snippets.

@sven-bock
sven-bock / gist:408b6e845666e06a0cf4002271c2780f
Last active September 19, 2020 03:17
rosbag filter specific TF
#Removes all tfs except the one that has 'base_footprint' as child frame id
rosbag filter old.bag new.bag "topic != '/tf' or (len(m.transforms)>0 and m.transforms[0].child_frame_id=='base_footprint')"
#Same as above but limiting other topics to '/odom' and '/scan'
rosbag filter old.bag new.bag "topic == '/odom' or topic == '/scan' or (topic == '/tf' and len(m.transforms)>0 and m.transforms[0].child_frame_id=='imu_link')"
@sven-bock
sven-bock / gist:cdb6cbcee5eed945d68c26d3a3ab1ac1
Created January 26, 2018 16:04
Convert, animate images in command line using function from image magick
#Convert the format of one image
convert source.pgm target.png
#Convert all images format of one type into another
# e.g. png is the target format
# e.g. all pgm images starting with "source" are converted
mogrify -format png source*.pgm
#Convert multiple images to one animated image
# e.g. takes all pgm images in the folder to create one animated gif. Verify that the images are numbered in ascending order.
@sven-bock
sven-bock / gist:c07722544af41751cd76e5ae34265898
Last active January 26, 2018 16:13
Check valid period of ssl certificate remotely
nmap -p 25 -sC yourDomain.com
@sven-bock
sven-bock / gist:2860bdc7f45b8d7195a9d0b88a87bce5
Created January 26, 2018 16:11
Run some executable as a background process
# This can be quite useful to run some process on the server,
# as it will not listen to the hangup signal of the terminal
# and will not terminate the process, if you close the terminal.
# In addition all output is appended in the log file
nohup /usr/bin/python3.4 /abspath/someFile.py 2>&1 | /usr/bin/tee -a /abspath/log.txt &
# Quickly create an android app for IoT :
https://www.blynk.cc/
#ROS stack and library for roomba and create:
https://github.com/AutonomyLab/create_autonomy
https://github.com/AutonomyLab/libcreate/blob/master/include/create/types.h
@sven-bock
sven-bock / gist:3d0517a8a3f41799ebb5863917317496
Last active January 30, 2018 16:22
Quickly replace all "strings" in files recursively
# Replace OLD with the string you want to replace, and NEW with the string you want to insert
find ./ -type f -exec sed -i -e 's/OLD:/NEW:/g' {} \;
grep -rl 'OLD' . | xargs sed -i 's/OLD/NEW/g'
@sven-bock
sven-bock / gist:56f4e6548a9d9d24312bf573a1056b91
Last active February 28, 2019 16:00
Setting a fixed port (with a simlink) to a USB device (udev/rules)
#Example:
#get some info with:
udevadm info -a -n /dev/ttyUSB0 | grep serial
udevadm info -a -n /dev/ttyUSB0 | grep idProduct
udevadm info -a -n /dev/ttyUSB0 | grep idVendor
#or
udevadm info -a -n /dev/ttyUSB0 | grep -E 'idVendor|idProduct|serial'
@sven-bock
sven-bock / gpio_control.py
Created March 15, 2018 15:38
Example: MQTT and GPIO control on Raspberry Pi
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
import time
import signal
TOPIC_1= "lab_switch"
HOST="localhost"
USER="openhab"
class MQTTGPIO():
def __init__(self):
@sven-bock
sven-bock / gist:f7856974c89e24a4969f292d96aa1173
Last active April 30, 2018 12:54
Enable SSH on Raspberry Pi on SD card
+ Plugin SD card that contains the Raspbian OS into your computer
+ Find the partition that is called "boot"
+ Create a file there called ssh
REMARK: Only works for raspbian!
@sven-bock
sven-bock / split_pdf.bash
Created March 21, 2018 21:09
Split PDF in single page PDFs
#!/bin/bash
# Splits the PDF in single pages PDFs which are saved in a subfolder called extracted and the page name.
# If the pages does already exist, it will increment the page number by one, until the filename is not occupied.
#sudo apt-get install pdftk
#chmod +x split_pdf.bash
#./split_pdf.bash source.pdf
PDFFILE=$1
echo "File: "$PDFFILE