Skip to content

Instantly share code, notes, and snippets.

@xqms
xqms / rate_limiter.cpp
Created January 31, 2022 11:26
Smooth rate limiter (C++)
// Smooth rate limiter based on token bucket
// Author: Max Schwarz <[email protected]>
#include "rate_limiter.h"
#include <ros/time.h>
class RateLimiter::Private
{
public:
@xqms
xqms / Dockerfile
Last active March 10, 2022 16:46
Dockerfile for Ubuntu 18.04 + ROS Melodic + kalibr
FROM ros:melodic-ros-base
RUN apt-get update && apt-get -y install python-catkin-tools python-osrf-pycommon git wget libeigen3-dev libopencv-dev libv4l-dev libatlas-base-dev liblapack-dev libblas-dev ros-melodic-cv-bridge python-matplotlib python-igraph
RUN mkdir /workspace && cd /workspace && mkdir src && cd src && git clone --depth 1 https://github.com/ethz-asl/kalibr.git && cd ..
RUN . /opt/ros/melodic/setup.sh && cd /workspace && catkin init && catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo && catkin build
@xqms
xqms / CMakeLists.txt
Created June 14, 2019 15:12
Corrade::Utility::Debug benchmark
cmake_minimum_required(VERSION 3.0)
project(corrade_benchmark)
find_package(Corrade REQUIRED Utility)
set(CMAKE_CXX_STANDARD 17)
add_executable(corrade_benchmark main.cpp)
target_link_libraries(corrade_benchmark Corrade::Utility)
@xqms
xqms / log
Created May 24, 2019 15:09
latexrun bug
hashing latex.out/talk.nav
hashing latex.out/talk.bcf
hashing latex.out/talk.log
hashing latex.out/talk.aux
hashing latex.out/talk.out
hashing latex.out/talk.snm
hashing latex.out/talk.toc
hashing latex.out/talk.run.xml
hashing latex.out/talk.fls
committing database
// Compile-time type names
// Author: Max Schwarz <[email protected]>
#ifndef TYPE_NAME_H
#define TYPE_NAME_H
#include <cstdlib>
#include <boost/hana/string.hpp>
@xqms
xqms / visdom_video.py
Last active June 25, 2018 12:38
video workaround for visdom
from tqdm import tqdm
import base64
import tempfile
import subprocess
def encode(tensor):
L = tensor.size(0)
H = tensor.size(1)
W = tensor.size(2)
@xqms
xqms / after_lspci
Created November 3, 2016 17:17
T440p crash with kernel 4.8.6
[ 130.673600] thinkpad_acpi: EC reports that Thermal Table has changed
[ 130.673657] nouveau 0000:02:00.0: DRM: resuming kernel object tree...
<system freezes, high CPU load>
@xqms
xqms / Makefile
Created October 12, 2014 19:04
i2c-rk3x clock rate change tester
ifneq ($(KERNELRELEASE),)
obj-m := i2c-clk-tester.o
i2c-clk-tester-y := tester.o
else
KDIR ?= /lib/modules/`uname -r`/build
@xqms
xqms / System configuration
Created October 2, 2014 10:27
Linux configuration for Intel Graphics and NVIDIA CUDA on Lenovo T440p
This is my current system configuration. I use the intel graphics for graphics, and just keep the NVidia card running for CUDA applications. Note that this setup does not give you 3D acceleration on the NVidia card!
Sometimes (only after suspend) I have to use the attached reload_nvidia.sh script because my CUDA applications complain about a "invalid device ordinal".
BIOS version: 1.17
Linux: Ubuntu 14.04 with kernel 3.17.0-031700rc4-generic
kernel cmdline: "acpi_osi=!Windows 2012"
nvidia driver 340 manually installed from the xorg-edgers PPA:
https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa
@xqms
xqms / gist:7902930
Created December 11, 2013 00:20
T440p with GT730M - complete dmesg log during the crash
Dec 11 01:18:24 xq-nb kernel: [ 705.236351] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Integer], ACPI requires [Package] (20131115/nsarguments-95)
Dec 11 01:18:24 xq-nb kernel: [ 705.236411] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20131115/nsarguments-95)
Dec 11 01:18:24 xq-nb kernel: [ 705.236581] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20131115/nsarguments-95)
Dec 11 01:18:24 xq-nb kernel: [ 705.236743] pci 0000:02:00.0: optimus capabilities: enabled, status dynamic power, hda bios codec supported
Dec 11 01:18:24 xq-nb kernel: [ 705.236745] VGA switcheroo: detected Optimus DSM method \_SB_.PCI0.PEG_.VID_ handle
Dec 11 01:18:24 xq-nb kernel: [ 705.236770] nouveau 0000:02:00.0: enabling device (0004 -> 0007)
Dec 11 01:18:24 xq-nb kernel: [ 705.236870] [drm] hdmi device not found 2 0 1
Dec 11 01:18:24 xq-nb kernel: [ 705.236948] no