Skip to content

Instantly share code, notes, and snippets.

View mfehr's full-sized avatar

Marius Fehr mfehr

View GitHub Profile
@mfehr
mfehr / flatten_directory.sh
Last active April 24, 2020 14:42
Move all files in tree to root folder, delete all subfolders and auto-remove all duplicate files.
#!/usr/bin/env bash
find $1 -type f -exec mv --backup=numbered -t $1 {} +
find $1 -type d -empty -delete
fdupes -rdNS $1
# Sources:
# - https://superuser.com/questions/658075/how-do-i-move-files-out-of-nested-subdirectories-into-another-folder-in-ubuntu
# - https://unix.stackexchange.com/questions/8430/how-to-remove-all-empty-directories-in-a-subtree
#!/usr/bin/env bash
set -e
ROSBAG_FOLDER=$1
TOPICS="${@:2}"
ROSBAG_PATH_OUT=${ROSBAG_FOLDER}/combined.bag
i=0
#!/usr/bin/env bash
set -e
ROSBAG_FOLDER=$1
TOPICS="${@:2}"
ROSBAG_PATH_OUT=${ROSBAG_FOLDER}/combined.bag
i=0
#!/usr/bin/env python
import sys
import roslib;
import rospy
import rosbag
from rospy import rostime
import argparse
import os
def parse_args():
@mfehr
mfehr / imu-mynteye-s.yaml
Last active February 28, 2019 10:13
maplab calibration for mynteye S
id: 55111e8de9825e51aff5d6fd9e83a37b
hardware_id: mynteye/imu/data_raw
sensor_type: IMU
sigmas:
acc_noise_density: 0.016925432397973516
acc_bias_random_walk_noise_density: 0.016925432397973516
gyro_noise_density: 0.0010848026158819934
gyro_bias_random_walk_noise_density: 0.000023404834136742844
saturation_accel_max_mps2: 200.0
saturation_gyro_max_radps: 7.5
@mfehr
mfehr / gflags_from_ros_params.cc
Created February 7, 2019 18:32
Directly parse and set Gflags from ROS params.
// NOTE(mfehr): program_name can be obtained through argv[0].
void parseGflagsFromRosParams(
const char* program_name, const ros::NodeHandle& nh_private) {
CHECK_NOTNULL(program_name);
std::vector<google::CommandLineFlagInfo> flags;
google::GetAllFlags(&flags);
VLOG(1) << "Parsing gflags from ROS params...";
std::stringstream ss;
@mfehr
mfehr / gstrep.sh
Last active June 18, 2018 13:56
Show all branches and whether they are up to date on the remote
#!/bin/bash
git fetch --quiet
message="Does not exist on remote!"
all_remote_branches=$(git branch -r)
echo -e "\n\e[1m remote\tlocal\tbranch name\e[0m"
git branch | while read line ; do
@mfehr
mfehr / upgrade_14.04_gcc.sh
Created November 30, 2017 17:08
Upgrade gcc and g++ on Ubuntu 14.04
# Upgrade 14.04 to gcc/g++ from 16.04
# Based on: https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-snapshot -y && \
sudo apt-get update && \
sudo apt-get install gcc-5 g++-5 -y && \
@mfehr
mfehr / speedup.sh
Last active November 29, 2017 12:09
speedup.sh
#!/usr/bin/env bash
# USAGE: speedup.sh <video> <speedup_factor (e.g. 2)> <speedup_factor_inv (e.g. 0.5)>
# speedup_factor_inv has to be equal to 1 /speedup_factor
let b=30*$2
echo "ffmpeg -i $1 -r $b -filter:v 'setpts=${3}*PTS' ${1}_${2}x.mp4"
ffmpeg -i $1 -r $b -filter:v "setpts=${3}*PTS" ${1}_${2}x.mp4
@mfehr
mfehr / gifify.sh
Last active March 2, 2023 09:48
gifify.sh
#!/usr/bin/env bash
# USAGE: gifify.sh <video> <start time in s> <duration in s> <desired FPS> <scale in px>
#
# Example: ./gifify yourvideo.mp4 3 [start time in seconds] 10 [duration in seconds] 15 [desired FPS] 600 [gif scale, expressed as desired width in pixel]
#
palette="/tmp/palette_$2_$3_$4_$5.png"
filters="fps=$4,scale=$5:-1:flags=lanczos"