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 / killingInTheNameOf.sh
Created March 28, 2019 08:16
Killing processes by name
#!/bin/bash
processName=$1
pids=$(ps -aux | grep $processName | egrep -v "grep|killingInTheNameOf" | awk '{ print $2 }')
names=$(ps -aux | grep $processName | egrep -v "grep|killingInTheNameOf" | awk '{ print $11 }')
#ps -aux | grep $processName | egrep -v "grep|killingInTheNameOf"
for name in $names; do echo $name; done
for pid in $pids; do echo $pid; sudo kill $pid; done
@mmodrow
mmodrow / MakeFavouriteMeal.js
Created April 2, 2019 13:18
Small Script to make one of my favourite meals.
(new Number(3735928559)).toString(16)
@mmodrow
mmodrow / HttpStatusForUrls.sh
Created April 8, 2019 14:38
Determines the HTTP StatusCode for every given url and prints it tab-separated with the url (to pipe into a CSV or Excel-File)
#!/bin/bash
for url in "$@"
do
statusCode=$(curl -i -s -L "$url" | grep HTTP/ | tail -1 | awk '{print $2}')
echo "$statusCode $url"
done
@mmodrow
mmodrow / git-changed.sh
Last active May 23, 2019 12:06
List all files in the current git repository that changed in the current commit compared to the origin master
#! /bin/bash
filter="ACDM"
for i in "$@"
do
case $i in
-A)
filter="${filter//A}"
;;
-C)
filter="${filter//C}"
@mmodrow
mmodrow / addSymbolCopyButtons.js
Created May 23, 2019 12:59
Adds a row of buttons to the YouTrack interface to copy ✔ or ✗into the clipboard.
(function() {
'use strict';
var targetParentSelector = ".yt-issue-toolbar";
function addSymbolFields(){
var symbols = ["✔", "✗"];
var fieldClasses = "button_310 button_ebb button_97b button_850 buttonWithoutIcon_b6a ringIconVerticalAlignFix_f8f light_cfe";
var paddingWrapperClasses = "yt-issue-toolbar__edit-section buttonGroup_951 buttonGroup_506 buttonGroup_2f0";
@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==
@mmodrow
mmodrow / PrintLinks.js
Last active November 29, 2019 19:30
print all links, that match a given prefix
@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 / 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 / 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")
}