Skip to content

Instantly share code, notes, and snippets.

@epomatti
epomatti / create_readhat_linux_root_user.sh
Last active May 6, 2021 00:43
Script to create a RedHat Linux user with root permissions
useradd $username
passwd $username
# open and uncomment "%wheel ALL=(ALL) ALL" line
visudo
# add user to wheel group, this is the admin group
usermod -aG wheel $username
# check if user has root permissions
@epomatti
epomatti / add_redhat_linux_firewall_port.sh
Last active March 23, 2022 02:13
Add RedHat Linux Firewall Port
firewall-cmd --list-all
firewall-cmd --zone=public --add-port=55555/tcp --permanent
firewall-cmd --reload
@epomatti
epomatti / gpg-symmetric-cipher.sh
Last active January 8, 2022 22:17
gpg symmetric cipher
# How to encrypt a sensitive file with symmetric cipher. (e.g. Solana keypairs)
keypair="$HOME/.config/solana/mainnet.json"
# This will create a new encrypted file "mainnet.json.gpg" on the target location
# You'll be asked to enter a passphrase
gpg -c --no-symkey-cache $keypair
# Run this command to decrypt the file using your previous passphrase
gpg -d --no-symkey-cache "$keypair.gpg"
@epomatti
epomatti / threads.py
Created March 23, 2022 02:11
threads in python
import time
import threading
def do_work(work):
print(f'Doing {work}')
time.sleep(3)
print(f'Finished {work}')
def do_all_the_work(work):
index = 0
@epomatti
epomatti / deploy_multiple_vms.sh
Created March 23, 2022 14:32
Deploy multiple VMs in Azure
# Windows
# Use System Preparation Tool
sysprep /generalize
# Linux
# Take a backup of the VM first
sudo waagent -deprovision+user
# Template
# https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-copy-managed-disks
@epomatti
epomatti / file_upload.sh
Created April 19, 2022 11:07
Upload CSV file using CURL
#!/bin/bash
# Load Variables
source dev.local.env
# Decrypt the API password
api_password=$(gpg --decrypt --no-symkey-cache $pwd_encrypted_file)
# Authenticate to MuleSoft and get the token (requires jq to be installed)
access_token=$(curl -X POST -u $username:$api_password -d $auth_url | jq -r '.access_token')
@epomatti
epomatti / udp.sh
Created June 1, 2022 12:31
Test UDP connection with netcat
nc -zvu ntp.pool.org 123
@epomatti
epomatti / pipenv_developer_install.sh
Last active June 17, 2022 03:21
Pipenv WSL Ubuntu developer setup
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential python3-pip python3-venv -y
python3 -m pip install --upgrade pip
sudo pip install virtualenv pipx
pipx install pipenv
git submodule sync
git submodule update --init --recursive
python3 -m pip install -e . --upgrade
@epomatti
epomatti / install_latest_maven_ubuntu.sh
Last active August 3, 2022 17:04
install updated maven ubuntu
maven_version='3.8.6'
wget "https://dlcdn.apache.org/maven/maven-3/$maven_version/binaries/apache-maven-$maven_version-bin.tar.gz"
tar -xvf apache-maven-*-bin.tar.gz
sudo mv "apache-maven-$maven_version" /usr/share/maven
echo 'export PATH="$PATH:/usr/share/maven"' >> ~/.bashrc
echo 'export PATH="$PATH:/usr/share/maven/bin"' >> ~/.bashrc
source ~/.bashrc
@epomatti
epomatti / readme.md
Last active September 20, 2022 21:39
Yarn 3 init

Here's how to init your Node.js project with latest Yarn version:

Enable corepack (Node.js >=16.10)

corepack enable

Set the latest versions: