Skip to content

Instantly share code, notes, and snippets.

@mattbell87
mattbell87 / remote-wsl.md
Last active November 23, 2024 22:03
VSCode Remote: Connect to WSL2 from another machine

VSCode Remote: Connect to WSL2 from another machine

Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this.

Proxy jump method

  1. On the host set up OpenSSH for Windows
  2. Run wsl --update to make sure you are running the latest WSL
  3. Open WSL and install another SSH server inside WSL with sudo apt-get install openssh-server
  4. Now run sudo systemctl enable --now ssh to automatically start ssh when WSL starts.
@mattbell87
mattbell87 / Steam-on-fedora.md
Last active October 31, 2024 19:49
How to install Steam on Fedora

Installing Steam on Fedora

These instructions are currently for Fedora 30. I'll update them over the releases if anything changes.

Open Software

Press the Win/Super key, type software and press Enter.

Enable the Third party and Steam repositories

@mattbell87
mattbell87 / create-mysql.bash
Last active May 7, 2024 01:07 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
#!/bin/bash
echo "Creating MySQL user and database"
PASS=$2
if [ -z "$2" ]; then
PASS=`openssl rand -base64 8`
fi
mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
@mattbell87
mattbell87 / docker-compose.yml
Last active March 5, 2024 02:34
Cmfive minimal docker compose setup
services:
cmfive:
image: ghcr.io/2pisoftware/cmfive:develop
environment:
- TZ=Australia/Sydney
- DB_HOST=mysql
- DB_DATABASE=cmfive
- DB_USERNAME=cmfive
- DB_PASSWORD=cmfive
- ENVIRONMENT=development
@mattbell87
mattbell87 / run_in_container.sh
Last active February 28, 2024 02:33
Run a command in a container
#!/bin/bash
# Link this file to /usr/local/bin/<command-name>
exec=$(basename $0)
container="container"
user="root"
dockerCmdNonInteractive="docker exec -u $user $container"
dockerCmd="docker exec -it -u $user $container"
display="🫙 $user@$container:$($dockerCmdNonInteractive pwd)\$ $exec $*"
@mattbell87
mattbell87 / docker-compose-healthcheck.sh
Created February 21, 2024 13:32
Get unhealthy container logs in a docker-compose project
#!/bin/sh
services=$(docker compose config --services)
for service in $services; do
echo "Service: $service"
container=$(docker-compose ps -q $service)
if docker inspect $container --format='{{.State.Health.Status}}' >/dev/null 2>&1; then
health=$(docker inspect --format='{{json .State.Health.Status}}' $container)
if [ "$health" != "\"healthy\"" ]; then
echo "CONTAINER IS NOT HEALTHY"
echo "==== STATUS ===="
@mattbell87
mattbell87 / install.sh
Created January 31, 2024 00:54
Playwright dependencies for Fedora
sudo dnf install atk at-spi2-atk libXcomposite libXdamage libXfixes libXrandr libgbm alsa-lib
@mattbell87
mattbell87 / iptables.md
Last active December 22, 2023 20:25
IPtables for routing over OpenVPN on Linux

Enable forwarding:

sysctl -w net.ipv4.ip_forward=1

Create this script eg sudo nano iptables.sh

eth=$1
proto=$2
@mattbell87
mattbell87 / keybase.md
Last active September 13, 2023 00:07
Keybase proof

Keybase proof

I hereby claim:

  • I am mattbell87 on github.
  • I am mattbell87 (https://keybase.io/mattbell87) on keybase.
  • I have a public key ASA-J1e_FaU-dfkUv-CmkXW6L1AnDl-JzI541JezR5kLiQo

To claim this, I am signing this object:

@mattbell87
mattbell87 / acfpro.md
Created May 4, 2021 07:05
Download ACF Pro

Download ACF Pro with your license key

Set the license key

export acflicense="licensekeyhere"

Download

wget -O ./acf-pro.zip "https://connect.advancedcustomfields.com/index.php?p=pro&amp;a=download&amp;k=$acflicense"