Skip to content

Instantly share code, notes, and snippets.

View mmodrow's full-sized avatar

Marc A. Modrow mmodrow

  • Bremen, Germany
View GitHub Profile
@mmodrow
mmodrow / ConvertTo-Rtttl.ps1
Last active February 9, 2024 05:34
MIDI->RTTTL converter for BLHeli_32 and BlueJay Quadcopter ESCs
[CmdletBinding()]
param (
[string]
$midiFilePath,
[string]
$label = "Label",
[int[]]
$midiChannels = @(2),
[int]
$ticksPerQuarterNote = 192,
@mmodrow
mmodrow / bigData.ps1
Last active May 3, 2023 13:58
"Big Data" creator (creates big json files with an object array)
[CmdletBinding()]
param (
[Parameter()]
[String]
$filePath,
[long]
$targetSizeInBytes = 500000000, #4294967296 Bit = 512MiB
[switch]
$deleteFile = $false
)
@mmodrow
mmodrow / Copy-FileToTimestamp.ps1
Last active August 22, 2025 13:37
copy files and rename them by creation time stamp conflict-free
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]
$source,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]
$destination,
@mmodrow
mmodrow / TimeCampDailyActivityReport.js
Created March 25, 2022 09:25
Generates a full dump of a given TimeCamp Time Tracking Report as JSON
/* *************************************************************************
* Filter TimeCamp Time Tracking Report.
* *************************************************************************
* Goto https://app.timecamp.com/app#/reports/projects_and_tasks/detailed
* Filter the desired time span etc.
* Inspect result of https://app.timecamp.com/time_tracking/ajax_get_reports_data
* in your browser dev tools network analysis.
* ************************************************************************* */
var response = response ?? {}; // insert response from the ajax call in the header - can be several thousands of lines long.
@mmodrow
mmodrow / TimeCampDailyLocationReport.js
Last active March 25, 2022 09:57
Get days in certain location from a time camp location report
/* *************************************************************************
* Filter TimeCamp Location Report for specific Locations (e.g. to check
* home office days vs. on premise days).
* *************************************************************************
* Goto https://app.timecamp.com/app#/location
* Filter the desired time span etc.
* Inspect result of https://app.timecamp.com/location/index in your browser
* dev tools network analysis.
* ************************************************************************* */
@mmodrow
mmodrow / Get-AsStacks.ps1
Created May 2, 2021 11:48
Takes an integer and translates it into <#> stack + <#> singles, useful to calculate Minecraft item amounts.
function Get-AsStacks{
param([int]$count, [int]$size = 64, [string]$stackLabel = "Stacks")
[float]$divisor = [float]([float]$count / [float]$size)
$floatingPointDigits = $divisor % 1
$stacks = $divisor - $floatingPointDigits
$singles = [int]($floatingPointDigits * $size)
Write-Host ("$stacks $stackLabel + $singles")
}
@mmodrow
mmodrow / purgeSprintSpooler.ps1
Created May 2, 2021 11:42
Clean out print spooler from non-cancellable jobs by completely emptying the spooler.
$killPrintSpoolContent = {
Write-Host "Stopping print spooler."
Stop-Service -Name "Spooler" -Force -ErrorAction Continue
$queue = Get-ChildItem -Path "C:\WINDOWS\system32\spool\PRINTERS" -ErrorAction Continue
Write-Host "Deleting following print jobs from spooler:"
Write-Host $queue
$queue | Remove-Item -ErrorAction Continue
Start-Service -Name "Spooler" -ErrorAction Continue
Write-Host "Starting print spooler."
Read-Host “Press ENTER to continue...”
@mmodrow
mmodrow / overcast-recently-played.ps1
Last active August 9, 2020 20:37 — forked from cleverdevil/overcast-recently-played.py
Fetch recently played episodes from an Overcast.fm full OPML-Export. Then, return those episodes as JSON.
param (
# path the to a file with the response of https://overcast.fm/account/export_opml/extended
[string]$inputFileName = "overcast_all.opml",
[bool]$playedOnly = $true,
# 0: title only; 1: adds user manipulation data; 2: adds publishing data; 3: adds overcast metadata
[int]$verbosity = 1
)
$ompl = [xml](Get-Content $inputFileName)
@mmodrow
mmodrow / PrintLinks.js
Last active November 29, 2019 19:30
print all links, that match a given prefix
@mmodrow
mmodrow / styleAdder.js
Created June 3, 2019 09:20
Template for adding a style tag to the head of sites - e.g. for custom colour blind modes
// ==UserScript==
// @name CSS adder
// @namespace http://css.com/
// @version 0.1
// @description Adds styles to a site
// @author Marc A. Modrow
// @match http*://*css.com*/*
// @grant none
// ==/UserScript==