Skip to content

Instantly share code, notes, and snippets.

View amoilanen's full-sized avatar
💭
"Simplicity is prerequisite for reliability." Edsger W. Dijkstra

Anton Moilanen amoilanen

💭
"Simplicity is prerequisite for reliability." Edsger W. Dijkstra
View GitHub Profile
@amoilanen
amoilanen / launch.json
Created November 29, 2023 13:43
VSCode debug configuration for running the current test file with Jest
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug test",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
@amoilanen
amoilanen / npm_install_local_package.sh
Created November 7, 2023 19:57
Installs a local NPM package to a local project for testing purposes. Usage: npm_install_local_package package_dir project_dir
#!/bin/bash
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` npm_package_dir project_dir"
echo "Installs a local NPM package to a local project for test purposes"
exit 0
fi
PACKAGE_DIR=$1
REPO_DIR=$2
PACKAGE_DIR=$1
@amoilanen
amoilanen / terminate.sh
Created October 14, 2023 19:05
.bashrc utilities to free a port and terminate a process
#!/bin/bash
free_port() {
kill -9 $(lsof -t -i:$1)
}
terminate() {
pids_to_kill=$(ps aux|grep $1|grep -v grep|grep -v terminate.sh |awk '{print $2}')
[[ ! -z $pids_to_kill ]] && kill -9 $pids_to_kill
@amoilanen
amoilanen / compress_video_utilities.sh
Created October 14, 2023 19:03
.bashrc fragment with utility commands to compress videos
#!/bin/bash
compress_videos() {
for f in "$@"; do compress_video $f; done;
}
compress_video() {
fullname=$1
extension="${fullname##*.}"
name_without_extension="${fullname%.*}"
@amoilanen
amoilanen / kind.useful.commands.md
Last active May 7, 2023 16:05
Useful commands for creating a local Kubernetes cluster and running local images with Kubernetes using Kind
@amoilanen
amoilanen / kind-config.yaml
Created April 10, 2023 16:50
Configuration for creating a local cluster with Kind https://kind.sigs.k8s.io/
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# One control plane node and three "workers".
#
# While these will not add more real compute capacity and
# have limited isolation, this can be useful for testing
# rolling updates etc.
#
# The API-server and other control plane components will be
# on the control-plane node.
@amoilanen
amoilanen / rsync_dirs.sh
Created July 17, 2022 16:35
Command line to show progress and sync two directories with rsync
rsync -ah --progress source_dir/ dest_dir/
@amoilanen
amoilanen / fix_kde_bottom_bar.sh
Created May 9, 2022 06:01
Sometimes KDE bottom bar disappears when switching between external displays, this script makes the bottom bar reappear
#!/bin/bash
rm ~/.config/plasma-org.kde.plasma.desktop-appletsrc
killall plasmashell
plasmashell &
@amoilanen
amoilanen / stack.yaml
Created February 6, 2022 18:47
Setting up local MongoDB `docker-compose -f stack.yaml up`. Authentication is disabled by default for the local development env
version: '3.1'
services:
local-mongo:
image: mongo:5.0.6
restart: always
ports:
- 27017:27017
@amoilanen
amoilanen / merge_into_book.sh
Created July 21, 2021 20:49
Create a book PDF from page image scans on Linux
#!/bin/bash
mogrify -quality 30 *.JPG
img2pdf *.JPG --output book.pdf