Skip to content

Instantly share code, notes, and snippets.

@dayjaby
dayjaby / sony_exif.py
Created January 10, 2024 18:47
read image id number and strings from Sony ILX LR1
import pyexiv2
img = pyexiv2.Image("DSC00093.JPG")
img.read_exif()
data = img.read_exif()
print(data["Exif.Sony1.0x2042"]) # read ID
print(data["Exif.Sony1.0x2043"]) # read string
@dayjaby
dayjaby / unittest.sh
Created January 13, 2023 18:08
PX4 unit tests
#!/bin/bash
export PX4_SIM_MODEL=unittest
export PX4_START_MODULES=start_modules.rc
# log file without mission and several different main states:
export replay=/home/david/Downloads/07370005-60a6-4a60-8d24-b86849a5c042.ulg
make px4_sitl_unittest
export PX4_BUILD_UNITTEST=$(pwd)/build/px4_sitl_unittest_replay
@dayjaby
dayjaby / camera_info.xml
Created February 1, 2022 09:13
camera_info.xml sample
<?xml version="1.0" encoding="UTF-8" ?>
<mavlinkcamera>
<definition version="7">
<model>T100</model>
<vendor>Foo Industries</vendor>
</definition>
<parameters>
<!-- control = 0 tells us this should not create an automatic UI control -->
<parameter name="CAM_MODE" type="uint32" default="1" control="0">
<description>Camera Mode</description>
@dayjaby
dayjaby / merge_datasets.py
Created December 29, 2021 12:13
pyulog: merge datasets
import numpy as np
# tuples of timestamps and "data"
data1 = np.array([
(3, 0xF0A),
(7, 0xF0B),
(12, 0xF0C),
(18, 0xF0D)
])
@dayjaby
dayjaby / gist:581544254106c30b52c96f9d9d7e4cb6
Created June 29, 2021 20:46
Rescue my system after stupid windows update
sudo fdisk -l /dev/sda
# /dev/sdaX -> EFI partition
# /dev/sdaY -> Ubuntu partition
sudo mount /dev/sdaY /mnt
sudo mount /dev/sdaX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sda
update-grub
/*
* Copyright (c) 2015-2016 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dayjaby
dayjaby / mavlink publications
Created April 21, 2021 08:34
ROS mavlink subscriptions and publications
@dayjaby
dayjaby / csr.h
Last active February 27, 2021 08:02
//--------------------------------------------------------------------------------
// Auto-generated by Migen (7014bdc) & LiteX (c715ba87) on 2021-02-27 08:59:55
//--------------------------------------------------------------------------------
#include <generated/soc.h>
#ifndef __GENERATED_CSR_H
#define __GENERATED_CSR_H
@dayjaby
dayjaby / gst_uninstalled.py
Last active February 9, 2021 15:35
gst_uninstalled improvement
#!/usr/bin/env python3
import argparse
import contextlib
import glob
import json
import os
import platform
import re
import site
@dayjaby
dayjaby / typelist.cpp
Last active May 6, 2020 19:17
Typelists to be used for mavlink streams in PX4
#include <iostream>
template<bool B, class T, class F>
struct conditional { typedef T type; };
template<class T, class F>
struct conditional<false, T, F> { typedef F type; };
// from https://stackoverflow.com/a/16803836
template <typename... Ts>