Skip to content

Instantly share code, notes, and snippets.

@sytsereitsma
sytsereitsma / CTest_code_coverage.md
Created June 8, 2023 11:47
Code coverage with CMake/CTest

Code coverage analysis with ctest

The following script creates a library with a function int add(int a, int b) and a test application that links to the library and calls add

CMakeLists.txt

cmake_minimum_required(VERSION 3.25)
project(CoverageTest)

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" "int add(int a, int b) { return a + b; }")
@sytsereitsma
sytsereitsma / cleanupbugs.vba
Last active December 16, 2021 06:36
Remove all duplicate bug entries from email list
Option Explicit
Private Enum deleteReason
DoNotDelete = 0
userComment = 1
DuplicateComment = 2
End Enum
Private Function WordBefore(ByVal str As String, pos As Long) As String
Dim startPos As Long
startPos = pos - 1
@sytsereitsma
sytsereitsma / sliding_dft.py
Created August 15, 2019 14:16
Sliding DFT analysis in python (transcribed simulink model)
import numpy
from matplotlib import pyplot
import math
import random
from collections import deque
class DelayLine:
def __init__(self, length):
self.buffer = deque()
extern crate pulldown_cmark;
extern crate pulldown_cmark_to_cmark;
use pulldown_cmark::Parser;
use pulldown_cmark_to_cmark::fmt::cmark;
use std::env;
use std::io::stdout;
use std::io::{Read, Write};
use std::fs::File;
void cleanNode(Node node, item_to_wipe) {
workspacePath = node.getWorkspaceFor(item_to_wipe)
if(!workspacePath){
println(" Failed to find workspace path on ${node.name}.")
return
}
if (workspacePath.exists())
{
try {
@sytsereitsma
sytsereitsma / cleanWorkspaces.groovy
Last active May 29, 2019 12:24
[Jenkins] Delete project workspace on all nodes
import jenkins.model.Jenkins
String[] JOBS_TO_WIPE=[
"CueingMiddleware",
"CueingMiddlewareH",
"HardwareDetector",
"RemoteParker"
]
@sytsereitsma
sytsereitsma / gist:1b370c558a4a34dfe014
Last active March 14, 2024 05:16
[Jenkins] Clear build queue and cancel all builds
def q = Jenkins.instance.queue
q.items.findAll { q.cancel(it.task) }
//q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) }
def items = Jenkins.instance.items
items.each { job ->
job.builds.findAll { build -> build.building }.each { run ->
println("Aborting: " + job.name)
run.doStop();
}
virtual void OnKeyPress() {
vtkRenderWindowInteractor *rwi = this->Interactor;
const char* ch = rwi->GetKeySym ();
if (strcmp (ch, "Delete") == 0) {
vtkPlanes* frustum = static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())->GetFrustum();
vtkSmartPointer<vtkExtractGeometry> extractGeometry =
vtkSmartPointer<vtkExtractGeometry>::New();
extractGeometry->SetImplicitFunction(frustum);
extractGeometry->SetInputData(this->Points);
HANDLE handle = ::CreateFileW (L"\\\\.\\ezusb-0",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
0,
OPEN_EXISTING,
0,
0);
unsigned short pipe;
unsigned short commandCode; //Command code sent to device which has the IC on board
@sytsereitsma
sytsereitsma / IMUInterface.c
Last active August 29, 2015 14:04
IMU driver for microblaze
#include "xparameters.h"
#include "xiic.h"
#include "platform.h"
#include "Sleep.h"
static const u8 kI2CAddress = 0x68;
static volatile u32* kI2CBase = (u32*) XPAR_IIC_0_BASEADDR;
typedef enum {
kIRQStatus = 0x020 >> 2,