Skip to content

Instantly share code, notes, and snippets.

View peci1's full-sized avatar

Martin Pecka peci1

  • Czech Technical University in Prague
  • Czech republic
View GitHub Profile
@peci1
peci1 / revert_packages_to_ppa_versions.sh
Created January 7, 2019 12:54
Revert all packages from non-PPA versions to their latest PPA version.
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
@peci1
peci1 / scipy_odr_test.py
Created September 17, 2018 14:18
Test of scipy.odr regressor
from __future__ import print_function
import numpy as np
import scipy.linalg
from scipy.odr import *
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import sys
import time
@peci1
peci1 / path_tracer.sh
Created October 27, 2021 12:07
subt virtual path_tracer launcher script
#!/bin/bash
[ $# -lt 1 ] && echo "Provide path to simulator logs" && exit 1
dir="$1"
[ ! -f "${dir}/state.tlog" ] && echo "The given path is incorrect, it doesn't contain file state.tlog" && exit 1
tracer_conf="$(d="${dir}"; while [ "$d" != "/" ]; do if [ -f "${d}/path_tracer.yml" ]; then echo "${d}/path_tracer.yml"; break; else d="$(dirname "$d")"; fi; done)"
[ -z "${tracer_conf}" ] && echo "path_tracer.yml not found in the given or any parent directory" >&2 && exit 1
@peci1
peci1 / compile_darktable_on_windows.sh
Last active June 19, 2021 11:34
A script for compiling Darktable on Windows using the Windows Subsystem for Linux ("bash for Windows") introduced in Win 10.
#########################################
# DO NOT REPORT ANY BUGS FROM DARKTABLE INSTALLED THIS WAY.
#
# This is an unofficial compilation & installation guide.
# Darktable developers explicitly say that they don't support Windows ANY way and won't fix ANY bugs on Windows.
# Please, respect their decision and do not bother them with Windows bugreports.
#
# If you find a bug, please verify it on a regular Linux/Mac system or inside a virtual machine.
#
# There is a chance an official Windows build will appear. Just subscribe to https://github.com/darktable-org/darktable/pull/1327 to be informed.
@peci1
peci1 / ignition-dome.yaml
Created May 1, 2021 17:23
/etc/ros/rosdep/sources.list.d/ignition-dome.yaml
ignition-dome:
ubuntu: [ignition-dome]
ignition-cmake2:
ubuntu: [libignition-cmake2-dev]
ignition-common3:
ubuntu: [libignition-common3-dev]
ignition-fuel-tools5:
ubuntu: [libignition-fuel-tools5-dev]
ignition-gazebo4:
ubuntu: [libignition-gazebo4-dev]
@peci1
peci1 / syslog-ng.conf
Created May 28, 2020 01:09
Syslog NG config for Turris Omnia which saves important parts of the logs to NAS. Date is also unified to a single timezone for all messages.
@version:3.19
options {
chain_hostnames(no);
flush_lines(0);
stats_freq(0);
flush_lines(0);
log_msg_size(65536);
};
@peci1
peci1 / Abbreviate Journal Names in Bibtex Database.py
Last active January 28, 2021 07:22 — forked from FilipDominec/Abbreviate Journal Names in Bibtex Database.py
Using the translation table from the Jabref program, finds and replaces all scientific journal names to their standardized abbreviated form. First argument is the file to be processed; outputs safely to 'abbreviated.bib'
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys, os
import re
try: bibtexdb = open(sys.argv[1]).read()
except: print "Error: specify the file to be processed!"
if not os.path.isfile('journalList.txt'):
@peci1
peci1 / subt_cuda.Dockerfile
Last active January 6, 2021 19:33
Dockerfile combining SubT virtual testbed images with CUDA support
FROM osrf/subt-virtual-testbed:cloudsim_bridge_latest
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | sudo apt-key add - && echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list && echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list && sudo apt-get -yy update
ARG cuda_maj=10
ARG cuda_min=0
ARG cuda=$cuda_maj-$cuda_min
ARG cudnn=7
RUN sudo apt-get install -y --no-install-recommends cuda-cudart-$cuda cuda-compat-$cuda cuda-libraries-$cuda cuda-npp-$cuda cuda-nvtx-$cuda cuda-cublas-$cuda libnccl2="*+cuda$cuda_maj.$cuda_min" libcudnn$cudnn="$cudnn.*+cuda$cuda_maj.$cuda_min" && sudo apt-get clean && sudo apt-mark hold libnccl2 && sudo apt-mark hold libcudnn$cudnn && sudo ln -s cuda-$cuda /usr/local/cuda && echo "/usr/local/nvidia/lib" | sudo tee /etc/ld.so.conf.d/nvidia.con
@peci1
peci1 / anonymize_pdf.sh
Last active January 4, 2021 18:07
Anonymize a PDF document with comments so that both document metadata and comment author data do not disclose who the author is.
qpdf --qdf --object-streams=disable $1 $1.tmp # uncompress /FlateDecode sections
perl -pe 's/(?<=\/T \()(.*?)(?=\))/ "x" x length($1) /e' $1.tmp > $1.tmp2 # remove /T commands containing author name in comments
qpdf --compress-streams=y $1.tmp2 $1.tmp3 # recompress streams
qpdf --empty --pages $1.tmp3 1-z -- $1.anonymous.pdf # remove document metadata (this also removes whole comments)
rm $1.tmp* # cleanup
@peci1
peci1 / path_tracer.sh
Created October 26, 2020 13:59
Launcher for path_tracer subt script that automatically records a video, autoconfigures the top-view camera to view exactly the explored space, zooms out several levels in the end to show the whole world, and repeats the last frames of the video a few times for easier inspection of what the state was in the very end.
#!/bin/bash
[ $# -lt 1 ] && echo "Provide path to simulator logs" && exit 1
dir=$1
[ ! -f "${dir}/state.tlog" ] && echo "The given path is incorrect, it doesn't contain file state.tlog" && exit 1
tracer_conf="${dir}/../../path_tracer.yml"
[ $# -gt 1 ] && tracer_conf="$2"