Skip to content

Instantly share code, notes, and snippets.

View dgehriger's full-sized avatar

Daniel Gehriger dgehriger

  • Globus Medical, inc.
  • Lausanne, Switzerland
  • 12:16 (UTC +01:00)
View GitHub Profile
@dgehriger
dgehriger / owning_movie_player.rs
Created November 6, 2024 20:10
Example of converting non-owning struct to owning struct
use mav_movie_player::{
FramesPerSecond, Movie, MovieBuilder, MovieFrame, MoviePlayer, Pixel, PlayMode, PlayerState,
};
use std::ops::{Deref, DerefMut};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let movie = create_movie()?;
let mut player = OwningMoviePlayer::new();
player.load_movie(movie);
player.play();
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"patternProperties": {
"^(?!archives$|credentials$|built-artifacts$|\\$schema)[a-zA-Z0-9_\\-.]+$": {
"$ref": "#/$defs/collection"
}
},
"properties": {
"$schema": {
@dgehriger
dgehriger / mctrl_elmo.v1.schema.json
Last active October 15, 2024 12:46
Motion Control ELMO Backend Config Schema
{
"$id": "https://gist.githubusercontent.com/dgehriger/b47be6a0d497e32fa48e3575cd9f78a0/raw/mctrl_elmo.v1.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Motion Control Configuration Schema",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"format": "uri",
"const": "https://gist.githubusercontent.com/dgehriger/b47be6a0d497e32fa48e3575cd9f78a0/raw/mctrl_elmo.v1.schema.json"
{
"layers": [
{
"name": "world",
"tileset": "MapEditor Tileset_woodland.png",
"data": [
-1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, 3, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 3, -1, 3, -1, -1, -1, -1, -1, -1, 3, -1,
-1, -1, 3, 3, 3, 3, -1, -1, -1, -1, 3, -1, 3, 3, 3, 3, 3, -1, 3, -1, -1,
3, -1, 3, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@dgehriger
dgehriger / ed25519.pub
Created August 13, 2024 09:12
Public key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICCLTG71+gHzsrYnAqdRF3i85881US+vV8ByWVW13HmE
@dgehriger
dgehriger / task_manager.v1.0.schema.json
Last active June 3, 2024 20:50
Task Manager Schema V1.0
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"duration": {
"type": "string",
"pattern": "^\\d+(nsec|ns|usec|us|msec|ms|seconds?|second|sec|s|minutes?|minute|min|m|hours?|hour|hr|h|days?|day|d|weeks?|week|w|months?|month|M|years?|year|y)((\\s\\d+)?(nsec|ns|usec|us|msec|ms|seconds?|second|sec|s|minutes?|minute|min|m|hours?|hour|hr|h|days?|day|d|weeks?|week|w|months?|month|M|years?|year|y))*$"
},
"storageSize": {
"type": "string",
function RunAsAdmin {
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$parentProcessId = (Get-CimInstance Win32_Process -Filter "ProcessId=$PID").ParentProcessId
$parentProcess = Get-CimInstance Win32_Process -Filter "ProcessId=$parentProcessId" | Select-Object -ExpandProperty CommandLine
if ($parentProcess -notmatch 'Invoke-Expression') {
Write-Host "This script must be run as Administrator." -ForegroundColor Red
Read-Host "Press any key to continue..."
exit 1
}
}
@dgehriger
dgehriger / map.json
Created January 24, 2023 15:58
Layer map
{
"layer001": 1,
"layer002": 2,
"layer003": 3
}