Skip to content

Instantly share code, notes, and snippets.

View monostere0's full-sized avatar

Daniel monostere0

  • Amsterdam, Netherlands
View GitHub Profile
@monostere0
monostere0 / clean_missing_playlist.py
Created June 24, 2026 19:26
Removes files that are in your Rekordbox playlist but have been deleted from your drive
#!/usr/bin/env python3
"""
clean_missing_playlist.py
Remove all entries from a Rekordbox playlist whose linked audio file
no longer exists on disk.
By default it scans the playlist, reports every entry with a missing
file, then asks for confirmation before removing them.
@monostere0
monostere0 / format.json.bookmarklet.js
Last active January 14, 2026 15:31
Format JSON bookmarklet
javascript:!function(){var n,e,r,i;n=window,e=document.body,r=JSON.parse,i=JSON.stringify,n.isf||(e.innerHTML="<pre>"+i(r(e.innerText),null,4).replace(/\"(.*)[^\:]\:/g,'<span style="color:#9C3636">$1&colon;</span>')+"</pre>",n.isf=!0)}();
//usage:
//save as bookmark and click it whenever you open a json response in a browser tab/window
@monostere0
monostere0 / main.tf
Last active August 10, 2021 06:53
Terraform VPC
provider "aws" {
version = "~> 2.0"
region = "eu-central-1"
}
# VPC
resource "aws_vpc" "tf_vpc" {
cidr_block = "10.0.0.0/16"
tags = {
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
<lots of information about the resources that Terraform is about to create>
Plan: 15 to add, 0 to change, 0 to destroy.
@monostere0
monostere0 / window.location.searchJSON.js
Last active February 19, 2020 08:11
Retrieve the query string params as JS object
Object.defineProperty(location, 'searchJSON', {
get: function() {
var a = window.location,
b = a.href.split('?'),
c = a.search;
return (c.slice(1) || (b.length > 1 && b[1]) || '').split("&").reduce(function(p, c) {
return (c = c.split("=")) && (p[c[0]] = unescape(c[1])) && p
}, {}) || {};
},
enumerable: false,
@monostere0
monostere0 / GlobalEvents.js
Last active February 19, 2020 08:10
Fire events between different browser windows using localStorage.
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
const assert = require('assert');
function solution(array) {
const k = array.length / 4;
let buffer = [];
return flatten(array.reduce((a, b, i) => {
buffer.push(b);
if (b !== array[i + 1]) {
a.push(buffer);
buffer = [];
@monostere0
monostere0 / enzyme_render_diffs.md
Created February 4, 2019 09:44 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@monostere0
monostere0 / get.js
Last active October 27, 2016 14:04
Get object path
function get(obj, path) {
let spl;
return new Function(
`return arguments[0]&&${(spl = path.split('.')).reverse().map((prop, index) => {
return `arguments[0].${spl.slice(spl.length - index - 1).reverse().join('.')}`;
}).join('&&')}`)(obj);
}
//usage:
// const hello = {world:{foo:{bar:baz:1}}}
@monostere0
monostere0 / http-service.ts
Created August 18, 2016 11:38 — forked from tomasstankovic/http-service.ts
Angular 2 Http interceptor
import { Injectable } from '@angular/core';
import {
Http,
ConnectionBackend,
RequestOptions,
RequestOptionsArgs,
Response,
Headers
} from '@angular/http';
import { Observable } from 'rxjs/Observable';