Skip to content

Instantly share code, notes, and snippets.

@juliangaal
juliangaal / find.py
Created February 6, 2024 08:54
$(find PACKAGE)/foo/bar, but ROS2
from pathlib import Path
from ament_index_python import get_package_share_directory
def find(path_string):
assert path_string, "A non-empty path string must be provided"
assert not path_string.startswith('/'), "The path string can't start with /"
path_parts = path_string.split('/')
assert len(path_parts) > 1, "The path string must contain at least two parts"
@juliangaal
juliangaal / run_gitlab_runner.sh
Last active November 2, 2023 08:48
Run gitlab runner locally
#!/bin/bash
set -e
# Run gitlab runner locally
# Prerequisite: non-root docker
#
# Usage: _gitlab_runner <BUILD_TAG (Default: build)>
function _gitlab_runner() {
TARGET=${1:-build}
@juliangaal
juliangaal / Dockerfile
Created March 28, 2023 08:27
Docker X11 Ubuntu 20.04
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y x11-apps
ARG user=julian
ARG home=/home/$user
RUN groupadd -g 1000 $user
RUN useradd -d $home -s /bin/bash -m $user -u 1000 -g 1000 \
&& echo $user:ubuntu | chpasswd \
&& adduser $user sudo
WORKDIR $home
USER $user
@juliangaal
juliangaal / error.txt
Created March 25, 2023 00:11
kobold error
2023-03-25T00:10:36.712041Z INFO 📦 starting build
2023-03-25T00:10:36.712422Z INFO spawning asset pipelines
2023-03-25T00:10:36.772944Z INFO building kobold_csv_editor_example
Compiling cfg-if v1.0.0
Compiling itoa v1.0.6
Compiling ryu v1.0.13
Compiling rustversion v1.0.12
error[E0463]: can't find crate for `core`
|
= note: the `wasm32-unknown-unknown` target may not be installed
TriMesh::HalfedgeHandle heh_init = mesh->halfedge_handle(vh);
auto heh = heh_init;
/** Loop die vertices der reihe nach abgeht:
* * ausgehend vom inserteten vertex
* * sprung zum naechst aeusseren vertex
* * speicher der outside edge zur uberpruefung von delaunay
* * sprung zurueck in die "mitte"
*/
do {
@juliangaal
juliangaal / tools.hpp
Created January 22, 2019 11:08
enumerate and zip operators (similar to python) for C++
// tested with xcode10 and g++8.2
namespace tools
{
template<typename T,
typename TIter = decltype(std::begin(std::declval<T>())),
typename = decltype(std::end(std::declval<T>()))>
constexpr auto enumerate(T &&iterable)
{
@juliangaal
juliangaal / matrix.cxx
Created November 14, 2018 13:27
Matrix class with custom iterators
#include <iostream>
#include <array>
struct Dims
{
unsigned int rows;
unsigned int colums;
unsigned int size;
};
# -*- coding: utf-8 -*-
# @Author: juliangaal
# @Date: 2018-02-10 12:25:41
# @Last Modified by: juliangaal
# @Last Modified time: 2018-02-10 15:07:28
import numpy as np
import matplotlib.pyplot as plt
values = [1124, 800, 628, 379, 199, 104, 279, 227, 97, 226, 105, 95, 150, 180, 200, 226, 250, 279, 399, 415, 430, 455, 470, 498, 504]
filtered = []