Skip to content

Instantly share code, notes, and snippets.

@clalancette
clalancette / ned-to-emu
Created January 28, 2020 20:12
ned-to-emu
#include <cmath>
#include <cstdio>
#include <tf2/LinearMath/Matrix3x3.h>
#include <tf2/LinearMath/Quaternion.h>
void print_quat(double x, double y, double z, double w)
{
tf2::Quaternion quat(x, y, z, w);
fprintf(stderr, "Quaternion:\n");
@clalancette
clalancette / pc_pipe_full.repos
Last active April 1, 2020 18:05
A full repos file for reproducing lost messages in the ROS 2 pipeline
repositories:
ament/ament_cmake:
type: git
url: https://github.com/ament/ament_cmake.git
version: master
ament/ament_index:
type: git
url: https://github.com/ament/ament_index.git
version: master
ament/ament_lint:
@clalancette
clalancette / parse_pc_pipe_times.py
Created April 1, 2020 18:08
Python3 script to parse pc_pipe_times
import bisect
import copy
import statistics
import sys
if len(sys.argv) != 2:
print("Usage: %s <file>" % (sys.argv[0]))
sys.exit(1)
total_time_ms_list = []
@clalancette
clalancette / sync-ros-gbp-devel-branch.py
Last active July 6, 2020 17:56
Script to synchronize ros-gbp devel branches with the entries from rosdistro
import argparse
import git
import github
import keyring
import os
import sys
import tempfile
import urllib.request
import yaml
@clalancette
clalancette / overloaded-virtual.cpp
Created September 15, 2020 19:02
Overloaded virtual example
#include <cstdio>
class Base
{
public:
virtual void foo()
{
fprintf(stderr, "Foo no argument\n");
}
};
@clalancette
clalancette / format-string.cpp
Created November 5, 2020 19:41
format-literal cut-down example
#include <iostream>
#include <string>
typedef struct rcutils_log_location_t
{
/// The name of the function containing the log call.
const char * function_name;
/// The name of the source file containing the log call.
const char * file_name;
/// The line number containing the log call.
@clalancette
clalancette / melodic-stretch-disable.groovy
Created December 14, 2020 22:40
Groovy script to disable Debian Stretch in Melodic.
count = 0
for (p in Jenkins.instance.allItems) {
if (
(
p.name.startsWith("Msrc_dS") ||
p.name.startsWith("Mbin_ds") ||
p.name.startsWith("Mpr_ds") ||
p.name.startsWith("Mrel_ds") ||
p.name.startsWith("Mdev_ds") ||
@clalancette
clalancette / wmi.py
Created April 20, 2021 02:03
Get CD information from Windows WMI without wmi library
import win32com.client
def get_raw_windows_device_size():
obj = win32com.client.GetObject("winmgmts:")
typecomp = obj._oleobj_.GetTypeInfo().GetContainingTypeLib()[0].GetTypeComp()
result = typecomp.Bind('wbemFlagReturnImmediately')
if not result[0]:
raise AttributeError(name)
wbemFlagReturnImmediately = result[1].value
repositories:
ament/ament_cmake:
type: git
url: https://github.com/ament/ament_cmake.git
version: master
ament/ament_index:
type: git
url: https://github.com/ament/ament_index.git
version: master
ament/ament_lint:
repositories:
ament/ament_cmake:
type: git
url: https://github.com/ament/ament_cmake.git
version: master
ament/ament_index:
type: git
url: https://github.com/ament/ament_index.git
version: master
ament/ament_lint: