Skip to content

Instantly share code, notes, and snippets.

@MaZderMind
MaZderMind / atlassian-vulnerabilitiey-api-interpretation.ts
Last active February 25, 2024 14:14
Atlassian Vulnerabilitiey API Interpretation code
import { parse, valid } from "semver";
type Status = "AFFECTED" | "FIXED"
function isVulnerable(selectedVersion: string, versions: [string, Status][]) {
return isFilterSelected(selectedVersion, versions) || checkVersionAffected(selectedVersion, versions);
}
function isFilterSelected(selectedVersion: string, versions: [string, Status][]) {
return versions
@MaZderMind
MaZderMind / compressor-hangs.py
Created November 3, 2022 21:44
Apple Compressor Hangs
# https://support.apple.com/en-gb/guide/compressor/cpsr9be73312/4.6.1/mac/11.5.1
import subprocess
proc = subprocess.Popen(['/Applications/Compressor.app/Contents/MacOS/Compressor', '-monitor'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
while True:
c = proc.stdout.read(1)
print(c) # prints up to the last '\n'
# never gets here
print('done')
@MaZderMind
MaZderMind / Inzidenz + Impfprogress.js
Created May 21, 2021 17:22
Inzidenz + Impfprogress Deutschland – Widget für iOS Scriptable
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
// Thanks to @rphl (https://github.com/rphl) and @tzschies (https://github.com/tzschies) for their inspiring work on this widget. See https://gist.github.com/rphl/0491c5f9cb345bf831248732374c4ef5 and https://gist.github.com/tzschies/563fab70b37609bc8f2f630d566bcbc9.
function round(n, d) {
const m = Math.pow(10, d);
return Math.round((n + Number.EPSILON) * m) / m;
}
function buildQuery(params) {
@MaZderMind
MaZderMind / datetime_custom_rollover.py
Created April 23, 2021 06:48
datetime_custom_rollover.py
from datetime import datetime, time, date, timedelta
def rollover(dt: datetime, rollover: time) -> date:
given_time = dt.time()
if given_time < rollover:
return dt.date()
else:
return dt.date() + timedelta(days=1)
def test_rollover():
<!doctype html>
<html lang="en">
<head>
<style type="text/css">
.box {
background: linear-gradient(180deg, #2a4b65 0%, #0a748a 100%);
width: 1020px;
margin: 0 auto;
position: absolute;
@MaZderMind
MaZderMind / input.scss
Created October 6, 2020 14:22
Generated by SassMeister.com.
.header-1 {
&:hover {
& .team-project-icon {
transform: scale(1.2);
}
}
}
.header-2 {
&:hover {
@MaZderMind
MaZderMind / meet.css
Last active August 9, 2023 09:13
User-CSS for clean Google Meets
/* Block URLs with uBlock Origin:
* https://www.gstatic.com/meet/sounds/*
*/
/* Top Right Menu */
.NzPR9b { display: none }
/* On-Hover-Footer */
.rG0ybd { display: none }
@MaZderMind
MaZderMind / Main.java
Created March 22, 2020 17:39
pad-block-deadlock.
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.freedesktop.gstreamer.Element;
import org.freedesktop.gstreamer.Gst;
import org.freedesktop.gstreamer.Pad;
import org.freedesktop.gstreamer.Pipeline;
import org.slf4j.Logger;
@MaZderMind
MaZderMind / hls-transcode.sh
Created March 20, 2020 13:24
hls-transcode.sh
ffmpeg -v warning -nostats -nostdin -y -analyzeduration 3000000 \
-i http://live.ber.c3voc.de:8000/sloop_native_hd.webm \
\
-c:v libx264 -preset:v veryfast -profile:v main -pix_fmt yuv420p -flags +cgop \
-r:v:0 25 -g:v:0 75 -crf:v:0 21 -maxrate:v:0 4M -bufsize:v:0 18M \
-threads:v 0 -aspect 16:9 \
\
-c:a aac -b:a 192k -ar 48000 -ac 1 \
\
-map 0:v:0 -map 0:a:0 \
@MaZderMind
MaZderMind / component-with-callback.ts
Created February 19, 2020 12:42
Angular Component with Callback
export declare type QueryCallbackFunction = (results: string[]) => void;
declare type QueryFunction = (query: string, callback: QueryCallbackFunction) => void;
import {Component, Input} from '@angular/core';
@Component({
selector: 'app-example',
styleUrls: ['./example.component.scss'],
templateUrl: './example.component.html',
})