Skip to content

Instantly share code, notes, and snippets.

@wmik
wmik / clean.sh
Created October 16, 2025 07:40
Quick storage recovery commands
#!/bin/bash
sudo find / -type f -size +10M -exec ls -lh {} \;
sudo journalctl --vacuum-time=7d
sudo apt-get clean
sudo apt-get autoclean
npm cache clean --force && npm cache verify
@wmik
wmik / command
Created January 3, 2023 10:14
Linux command to generate self signed certificate
openssl req -x509 -newkey rsa:2048 -keyout certificates/localhost.key -out certificates/localhost.crt -sha256 -days 365 -nodes -subj '/CN=localhost' -addext subjectAltName=DNS:localhost,IP:127.0.0.1

Raspberry PI NAS server setup with plexmediaserver + docker + k8s

NAS setup

  1. Download Raspberry PI Imager from the official website
  2. Install OS on SD card (Tip: Ctrl + Shift + X on windows to show SSH setup configuration)
  3. Connect Raspberry PI to router via ethernet and power up
  4. Find Raspberry PI IP address on network
  5. Login to Raspberry PI using ssh
  6. Run sudo apt update && sudo apt upgrade to install latest updates
  7. Run sudo nano /etc/dhcpcd.conf and update the configuration at the end of the file to reserve a static IP address for the Raspberry PI
@wmik
wmik / index.html
Created December 2, 2020 16:09
Switch input built with HTML, CSS & JS (Vanilla)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Switch input</title>
</head>
@wmik
wmik / tooltip.css
Created September 18, 2020 14:56
CSS for tooltip component
.tooltip {
--tooltip-bg-color: hsl(210deg, 10%, 10%);
--tooltip-text-color: hsl(210deg, 10%, 90%);
position: relative;
}
.tooltip:before, .tooltip:after {
transition: visibility 0.2s;
visibility: hidden;
position: absolute;
@wmik
wmik / padlock.css
Created April 8, 2020 09:28
Padlock CSS behavior. Adapted from https://codepen.io/skwintz/pen/GQgwbx
/* :::::::::::::: Presentation css */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
--locked-color: hsl(210deg, 10%, 30%);
--unlocked-color: hsl(210deg, 10%, 40%);
}
.container {
display: flex;
@wmik
wmik / phredux.php
Created January 5, 2019 09:14
Naive PHP implemententation of a simple redux store. (NO MIDDLEWARE SUPPORT YET!)
<?php
class Action {
public $type;
public $payload;
public function __construct(string $_type, $_payload = NULL) {
$this->type = $_type;
$this->payload = $_payload;
}
}
@wmik
wmik / example.slang
Last active December 18, 2018 07:49
Audio progression using slang (https://github.com/kylestetz/slang)
@synth (adsr (osc tri) 0.01 8n 0.2 1n)
play @synth (notes [b3 e4 f4]) (rhythm [4n])
@drums (drums) + (gain 2)
play @drums (notes [1 5]) (rhythm [2n])
play @drums(notes [7 6]) (rhythm [4n 8n])
play @drums(notes [6 7]) (rhythm [4n 8t 1n])
@wmik
wmik / cli-draw-rect.js
Created October 10, 2018 12:59
A fun little configurable function that draws rectangular shapes using ascii characters
function drawRect(width, height, chars) {
if (typeof chars === "string") {
chars = { verticalEdge: chars, horizontalEdge: chars, vertex: chars };
}
chars = Object.assign(
{
verticalEdge: "|",
horizontalEdge: "-",
vertex: "+"
},
@wmik
wmik / vectron.js
Last active January 11, 2019 03:54
A simple 2D vector JS script
(function (global, factory) {
global.vectron = factory();
console.log('%cvectron loaded successfully', 'color:crimson');
})(this, function() {
'use strict';
/**
* @typedef Vector
* @property {Number} x - X value
* @property {Number} y - Y value
*/