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 / ros-network.sh
Created January 15, 2015 14:58
ROS network setup depending on route to MASTER
#!bin/bash
# This script configures the ROS environment variables according to the route
# to the ROS_MASTER. ROS_MASTER can either be defined as an evironment variable
# itself or given as first argument to this script. The ROS_IP and ROS_HOSTNAME
# are set according to the IP that is sitting on the route to this master.
# The ROS_MASTER_URI is also set, using port 11311. ROS_MASTER needs to be defined
# as a numeric IP address, not a hostname.
if [ "$1" ]; then
@marc-hanheide
marc-hanheide / nm-reconnect.sh
Created February 25, 2015 09:15
reconnect NetworkManager to a specific network everytime it's lost
# every minute check if connection is still alive and try reconnecting if it's not
*/1 * * * * /usr/bin/nmcli c status id STRANDS-AAF > /dev/null || /usr/bin/nmcli c up id STRANDS-AAF
@marc-hanheide
marc-hanheide / autossh-aaf.sh
Last active March 9, 2016 10:44
autossh AAF
#!/bin/bash
trap stop_tunnels 1 2 3 6 15
PIDS=""
SSH_LOGIN="-N -p 22222 marc@78.142.144.123"
FORWARDS="
-L0.0.0.0:35900:localhost:5900
@marc-hanheide
marc-hanheide / vlc-stream.sh
Last active November 15, 2023 06:53
VLC screen streaming mjpeg
DISPLAY=:0 cvlc -vvv --no-audio screen:// --screen-fps 1 --sout "#transcode{vcodec=MJPG,vb=800}:standard{access=http,mux=mpjpeg,dst=:18223/}" --sout-http-mime="multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a"
@marc-hanheide
marc-hanheide / check-disk.sh
Last active August 29, 2015 14:21
check disk and mail root if >80%
#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom|none|udev' | awk '{ print $5 " " $1 }' | while read output;
do
#echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 80 ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
mail -s "Alert: Almost out of disk space $usep%" root
fi
@marc-hanheide
marc-hanheide / ssh.vpn.sh
Created May 27, 2015 20:27
ssh-vpn via ppp (OSX)
#
# You will need to change these variables...
#
# The host name or IP address of the SSH server that we are
# sending the connection request to:
SERVER_HOSTNAME=harek
@marc-hanheide
marc-hanheide / gist:c5b3d454409f6070c76f
Last active August 29, 2015 14:23
create a reverse tunnel from robot to harek
  1. On the robot install proxytunnel: sudo apt-get install proxytunnel

  2. enter this in ~/.ssh/config:

Host lcas ProxyCommand /usr/bin/proxytunnel -p lcas.lincoln.ac.uk:443 -E -d localhost:22 Compression yes ServerAliveInterval 120 TCPKeepAlive no RemoteForward *:19273 localhost:22

@marc-hanheide
marc-hanheide / README.md
Last active August 29, 2015 14:23
NFS and network setup on robots

NFS setup:

Main PC:

  • sudo mkdir -p /export/users
  • mkdir /nfshome
  • sudo apt-get install nfs-kernel-server
  • /etc/exports:
@marc-hanheide
marc-hanheide / mongo-tools.sh
Last active February 6, 2022 10:33
mongo queries and export and import
# dumping
mongodump --tlsInsecure -vvvv -d ff_rasberry -c 2021_riseholme_deltalink "--uri=mongodb://mhanheide@10.210.9.130:27017/?authSource=admin&tls=true&tlsAllowInvalidCertificates=true"
# restoring
mongorestore --tlsInsecure -vvvv --nsInclude=ff_rasberry.2021_riseholme_deltalink "--uri=mongodb://mhanheide@localhost:8000/?authSource=admin&tls=true&tlsAllowInvalidCertificates=true"