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 / install_python3.6_opensuse42.3.sh
Last active December 12, 2022 08:26
Installing Python 3.6 on OpenSUSE Leap 42.3
# !/bin/bash
# Step 1. Install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
source ~/.bashrc
@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 / bulk_download_Coursera_videos.js
Last active May 21, 2022 02:18
Bulk download of Coursera videos with wget
/*
* Bulk download of Coursera videos with wget.
*
* Copyright (c) 2014 Anton Ivanov anton.al.ivanov@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@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 &