Skip to content

Instantly share code, notes, and snippets.

@tsmx
tsmx / increase-efi-partition-in-dual-boot.md
Created December 4, 2024 21:24
Increasing the EFI partition in a Win 11 / Fedora 40 dual-boot scenario

Increasing the EFI partition in a Win 11 / Fedora 40 dual-boot scenario

A guide on how I did come to a proper working Win 11 / Fedora 40 dual boot setup with a right-sized EFI partition. Hope that helps :)

Windows and Linux dual-boot setup

In most Windows/Linux dual-boot setups it is very likely you had first installed Win 11 (or any other Windows version) on your machine. Typically you'll then shrink down the existing Windows partition from the right end side to create some unpartitioned space for the Linux installation. This could easily be done with Windows built-in harddisk manager tool. Then install Linux in the free space and use GRUB2 as the bootloader.

I previously did this procedure again on a new PC having Win 11 preinstalled. Made up some space as described above and installed Fedora 40 with GRUB2. Works like a charm.

@tsmx
tsmx / froggit-custom-protocols.md
Last active August 22, 2024 15:48
Froggit weather station custom server protocols - Ecowitt and Wunderground

Froggit weather station protocols for custom server

Example output and NodeJS server code snippet for a Froggit weather station when using an own custom server instead of predefined weather services.

My hardware:

  • WH3000SE sensor
  • DP1500 Dongle

Ecowitt protocol type

@tsmx
tsmx / timeseries-dummydata-csv.sh
Last active November 26, 2021 11:29
Creating time-series dummy mass data CSV file, e.g. for DB stress-test.
#!/bin/bash
# Creates time series dummy data in a CSV with random hourly values.
#
# timeseries: array of name|from|to for the time series
# -> name: name of the series (string)
# -> from: lower limit of the hourly values (number)
# -> to: upper limit of the hourly values (number)
# amount: number of hourly values to create for each series, 24 for one complete day, 24*365 for a year etc.
# startdate: date-time of the first hour
@tsmx
tsmx / git-build-nodejs-multi-version-coveralls.yml
Last active June 28, 2021 18:51
Building a NodeJS app for multiple node versions with GitHub actions and report test results to Coveralls.
# save as ./github/workflows/git-ci-build.yml
# make sure that 'test-coverage' generates the coverage reports (lcov)
name: git-ci-build
on:
[push]
jobs:
build:
@tsmx
tsmx / sorted-iterable-map.js
Last active September 30, 2023 13:41
sorted-iterable-map: iterate with a for-loop over a JavaScript Map sorted by value attributes with a custom iterator using function* and yield*
// In the example: sort descending by 'activeUsers' attribute of the value object
var countries = new Map();
countries.set('DE', { name: 'Germany', activeUsers: 15000 });
countries.set('PL', { name: 'Poland', activeUsers: 13900 });
countries.set('UK', { name: 'United Kingdom', activeUsers: 14500 });
console.log('without iterator:');
for (let [key, info] of countries) {
@tsmx
tsmx / express-param-middleware.js
Last active March 26, 2021 21:48
NodeJS Express - middleware function with custom parameter
var express = require("express");
var app = express();
const setMyInfo = (text) => {
return (req, res, next) => {
req.myInfo = text;
next();
};
};
@tsmx
tsmx / fedora-fix-grub2-after-kernel-update.md
Last active January 27, 2025 12:45
Fedora - fix grub2 after kernel update with invalid environment block error

Sometimes an update of the kernel breaks your current grub2. You will see an error like /usr/bin/grub2-editenv: error: invalid environment block during execution of the update procedure.

In that case don't restart your machine because it is most likely that this will fail and then you'll have to fix it using chroot from a Live Media. Instead, immediately after the update showing up the error, fix it by executing the following as root:

dnf reinstall grub2-efi-x64 shim-x64
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
@tsmx
tsmx / nginx-cors-dev-proxy.md
Last active September 18, 2023 07:57
nginx as local proxy to avoid CORS during development

nginx as a proxy to avoid CORS during development

A simple setup for using nginx to avoid CORS errors during local development without the need of code changes.

Local dev situation

Let's assume you are developing a frontend and a backend service belonging together. It's a good practice to have those two projects separated to decouple development, deployment, patching etc.

At the end, both parts mostly would run under one domain but in different contexts, e.g.:

@tsmx
tsmx / react-counter-func.md
Last active March 21, 2022 16:56
CounterFunc: functional React component for animated counting up using standard hooks

CounterFunc: functional React component for animated counting up using standard hooks

Small functional React component for counting numbers up to a certain value in a specified duration in ms. Useful for creating animated dashboards etc.

Uses React hooks useEffect, useState and useRef. Good example on how to pass props to a useEffect hook without declaring them as dependencies and how to deal with setInterval in functional components.

Usage

<CounterFunc countFrom={0} countTo={123} durationMs={400} />
@tsmx
tsmx / react-counter.md
Last active May 2, 2021 18:39
Counter: a simple React component for animated counting up

Counter: React component for animated counting up

Small React component for counting numbers up to a certain value in a specified duration in ms. Useful for creating animated dashboards etc.

Usage

<Counter countFrom={0} countTo={123} durationMs={400}/>