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 / vpn_ros_hostname
Last active August 29, 2015 14:02
to set the ROS_HOSTNAME from a ppp address in an /etc/hosts file
export ROS_HOSTNAME=`grep \`ifconfig | grep -A1 ppp | grep inet | cut -f2 -d:| cut -f1 -d" "\` /etc/hosts | tr -s " " | cut -f2 -d " "`
echo "ROS_HOSTNAME set to $ROS_HOSTNAME"
@marc-hanheide
marc-hanheide / robot-overlord.sh
Last active October 17, 2022 16:25
robot-overlord
export ROS_HOSTNAME=`grep \`ifconfig | grep -A1 ppp | grep inet | cut -f2 -d:| cut -f1 -d" "\` /etc/hosts | tr -s " " | cut -f2 -d " "`
echo "ROS_HOSTNAME set to $ROS_HOSTNAME" >&2
export ROS_MASTER_URI=http://linda:11311/
echo "ROS_MASTER_URI set to $ROS_MASTER_URI" >&2
@marc-hanheide
marc-hanheide / ssh-tmux
Created October 6, 2014 16:00
automatically start tmux in interactive ssh sessions (to be used in .bashrc)
case $- in
*i*) # interactive shell
if [ -z "$TMUX" ]; then
if [ "$SSH_CLIENT" ]; then
TMUX_SESSION=`echo ${SSH_CLIENT} | cut -f1 -d" "`
echo "checking for tmux session with ID $TMUX_SESSION"
if tmux has-session -t "$TMUX_SESSION" > /dev/null; then
exec tmux at -t "$TMUX_SESSION"
else
@marc-hanheide
marc-hanheide / release.sh
Created October 22, 2014 15:47
Releasing packages to the official rosdistro
# if the rosdistro has been reconfigured to use another version,
# bloom needs to be told to use the official one with this env variable:
ROSDISTRO_INDEX_URL=https://raw.github.com/ros/rosdistro/master/index.yaml bloom-release -r indigo -t indigo mongodb_store
@marc-hanheide
marc-hanheide / gist:1e3ab2c1e0abbc0e7c1c
Created October 24, 2014 10:29
disable reverse-path filtering for all interfaces
sudo sysctl -a | grep \\.rp_filter | cut -f1 -d" " | xargs -i{} -- sudo sysctl -w {}=0
@marc-hanheide
marc-hanheide / install
Last active August 29, 2015 14:08
Build jekyll debian packages from ruby gem
# taken from https://github.com/jordansissel/fpm/wiki/ConvertingGems#convert-a-gem-and-all-of-its-dependencies
sudo apt-get install ruby1.9.3 rubygems
mkdir /tmp/gems
gem1.9.3 install --no-ri --no-rdoc --install-dir /tmp/gems jekyll
find /tmp/gems/cache -name '*.gem' | xargs -rn1 fpm -d ruby1.9.3 -d rubygems --gem-gem /usr/bin/gem1.9.3 -s gem -t deb
@marc-hanheide
marc-hanheide / README.md
Last active April 14, 2016 09:56
create debian package the easy way

Based on https://github.com/jordansissel/fpm/wiki/ConvertingPython

For Twython, I did this:

fpm -s python -t deb --python-package-name-prefix python-strands oauthlib
fpm -s python -t deb -v 2.1.0 --python-package-name-prefix python-strands requests
fpm -s python -t deb -v 0.4.0 --python-package-name-prefix python-strands  requests-oauthlib
fpm -s python -t deb --python-package-name-prefix python-strands twython 
@marc-hanheide
marc-hanheide / ffmpeg.sh
Last active November 3, 2016 13:40
FFMPEG convert lectures (mono, frame rate 0.5, mp4)
nice -15 ffmpeg -ss 0:5:0 -i ~/Desktop/CMP1036M-lecture_7-raw.mov -r 0.5 -s 480x320 -ac 1 -to 0:50:0 ~/Desktop/CMP1036M-lecture_7.mp4
@marc-hanheide
marc-hanheide / autossh.sh
Last active August 29, 2015 14:10
autossh connection for ROS live streaming
# enable reverse port forwarding in firewall settings:
# 8181: mjpegserver
# 9090: rosws
# 22222: reverse ssh
AUTOSSH_POLL=5 AUTOSSH_FIRST_POLL=5 autossh -M 6000 harek -R8181:localhost:8181 -R9090:localhost:9090 -R22222:localhost:22
# put this in your `.ssh/config`
Host harek
TCPKeepAlive yes
ServerAliveInterval 20
@marc-hanheide
marc-hanheide / lines.m
Last active August 29, 2015 14:13
Lines intersections in 3D (MATLAB)
%%%%%%%%%
% Generate some test data, here 4 points p with directions d
% the position of the offset of the lines
p=[0 0; 1 0; 0 1; 1 1]';
% the direction for the individual lines, not sure if this is the format that is needed or if you have the rotation matrix.
% If the latter then simply multiply take the first row of the rotation matrix as d_i
d=[1 1; -1 1; 1 -1; -1 -1]';