Skip to content

Instantly share code, notes, and snippets.

@zflat
zflat / #devcontainer_template_for_ros2_colcon_workspace.md
Last active January 26, 2024 21:44
devcontainer template for ros2 colcon workspace
  • Create a directory for your new workspace
    mkdir dev_ros2
    cd dev_ros2
  • Download the zip and extract inside your workspace directory as .devcontainer
    wget -qO- https://gist.github.com/zflat/445b2ef3427dd947e2a3d46b61420b9b/archive/main.tar.gz | tar -xz --transform "s/^445b2e.*main/.devcontainer/"
  • Create the workspace volume. Run from the root of your workspace:
@zflat
zflat / talker_ros2_latency.py
Last active November 17, 2022 16:07
Script to test sending ROS2 messages and record latency
#!/usr/bin/env python3
#
# This is a test script that can be used to test latency of sending ROS messages between containers
#
# First get a baseline by running everything in the same container
# Terminal 1:
# ```
# python3 talker_ros2_latency.py
# ```
# Terinal 2:
@zflat
zflat / init-productivity-emacs.org
Last active November 19, 2023 14:30
Emacs configuration for productivity tools magit, org and others

Emacs Init File

This is a configuration file used to customize Emacs. To use this file, ensure the prerequisites are met and then follow the steps in the initial setup instructions section below to download this file from the upstream gist to a file named config.org in your emacs config directory.

Once the config.org file is in your emacs config directory and the setup is complete, you will be able to run Emacs with the customizations defined in the emacs configuration details section of the config.org file. Further customizatons and tweaks can be made by editing the appropriate sections of ~/.emacs.d/config.org.

Table of Contents

@zflat
zflat / #Embedding_ign-gui_into_QML_application.md
Last active April 9, 2022 18:25
Embedding ign-gui into QML application

Minimal example of embedding ign-gui into a QML application.

Host:

git clone https://gist.github.com/138385fb3934fd75ddfcfe42f802e2cf.git downstream
git clone https://github.com/zflat/ign-gui.git -b ign5-application_base
git clone https://github.com/ignitionrobotics/ign-rviz.git
docker build -t my_ign:latest ./downstream
xhost + local:root
@zflat
zflat / print_cpu_temperature.sh
Last active May 12, 2021 16:55
Script to print CPU temperature in a while loop to STDOUT
#!/usr/bin/env bash
# Script to print CPU temperature in a while loop to STDOUT
if [ -z $1 ]; then
echo "Required THERMAL_ZONE arg not given." 1>&2
echo "List thermal zones and types with:" 1>&2
echo " grep . /sys/class/thermal/thermal_zone*/type" 1>&2
echo "" 1>&2
echo "Usage:" 1>&2
echo " $0 THERMAL_ZONE [SECONDS_BETWEEN_READINGS]" 1>&2
exit 1;
#!/bin/bash
# Synology DLNA server does not recognize mp4 audio files
# but does recognize them if ther are .M4A.
# https://www.synology.com/en-global/dsm/software_spec/audio_station
find "${HOME}/Music/tmp" -name "*.mp4" | while read filename
do
name=$(echo "${filename}" | sed -e "s/.mp4$//g")
echo "${name}"
@zflat
zflat / docker_nic_bridge.md
Created September 24, 2020 20:45
Bridge a docker container to a physical network adapter NIC

Bridge a docker container to a physical network adapter NIC

Set up a network bridge to the physical interface (NIC) on your host connected to a specific LAN

docker network create -d macvlan \
 --subnet=192.168.111.0/24 \
 -o parent=enx000ec6be0a54 br_net
@zflat
zflat / #Conventions_for_building_packages_from_source
Last active November 4, 2020 03:43
Conventions for building packages from source
git clone https://gist.github.com/5678a1d78d80e758301d9da3bc4fb4f1.git /opt/source
@zflat
zflat / csv2vcard.rb
Created October 25, 2017 13:18
Simple script to split a CSV into vcard files
#! /usr/bin/ruby
# coding: utf-8
#
# Split a CSV into vcard files
infile = File.new(File.join(File.expand_path(File.dirname(__FILE__)), ARGV), "r")
while (line = infile.gets)
vals = line.split( ",")
continue if vals.empty?
fname = File.join(File.expand_path(File.dirname(__FILE__)), "vcard","#{vals[0]}.vcf".gsub( " ", "").strip)
File.open(fname, "w:UTF-8") do |f|
@zflat
zflat / bit_sum.c
Last active October 15, 2018 17:21
sum the bits of an integer
#include <stdio.h>
#include <stdlib.h>
unsigned long bit_sum(unsigned long n) {
return n ? (1 + bit_sum(n & (n - 1))) : 0;
}
void main(int argc, char ** argv) {
char * p;
long n;