Skip to content

Instantly share code, notes, and snippets.

View TheFern2's full-sized avatar

Fernando B TheFern2

View GitHub Profile
@TheFern2
TheFern2 / kali-resize-utm.md
Created April 11, 2024 18:54
UTM VM resize script and udev rule

source: utmapp/UTM#4064 (comment)

Hi, just adding a more elegant way of making dynamic resolution. We gonna just use the udev event for that.

YOU MUST have installed :

sudo systemctl start spice-vdagent
sudo systemctl enable spice-vdagent
@TheFern2
TheFern2 / notes.md
Last active September 29, 2023 02:06
micropython patch notes
  • initial goals
  • hurdles
  • things to watch out for
  • testing
  • micropython constraints
sudo usermod -aG dialout $USER
@TheFern2
TheFern2 / cuda.md
Last active September 28, 2023 20:47
new linux install

Install cuda toolkit 12.2 Update 2

https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
@TheFern2
TheFern2 / install_cuda_11_ubuntu_2004.md
Created September 19, 2023 23:52 — forked from ksopyla/install_cuda_11_ubuntu_2004.md
How to install CUDA toolkit 11 at ubuntu 20.04

Step by step instruction how to install CUDA 11 Ubuntu 20.04

NVidia Ubuntu 20.04 repository for CUDA 11

If you need CUDA Tolkit 11 with nvcc, other tools and libraries you can install it from NVIDIA Ubunutu 20.04 repository.

Add Ubuntu 20.04 repository

@TheFern2
TheFern2 / ffmpeg_snapshot.py
Created September 15, 2023 01:41
ring-mqtt motion snapshots with ffmpeg (NO SUBSCRIPTION) - home assistant ring doorbell or any rtsp camera
import os
import time
import datetime
import shutil
@service
def take_snapshot(uri=None, save_path=None, count=3):
IMAGE_COUNT = count
ffmpeg = f"/usr/bin/ffmpeg -y -i {uri}"
@TheFern2
TheFern2 / create-python-layer.sh
Created August 29, 2023 22:59
create aws python layer
#!/bin/bash
LAYERS_HOME=~/aws/layers
PACKAGE_NAME="$1"
mkdir -p $LAYERS_HOME/zip/$PACKAGE_NAME $LAYERS_HOME/tmp
python3.11 -m pip install -t $LAYERS_HOME/python_$PACKAGE_NAME $PACKAGE_NAME
current_epoch=$(date '+%s')
# copy package into a python named tmp dir
@TheFern2
TheFern2 / bash_strict_mode.md
Created April 10, 2023 16:24 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@TheFern2
TheFern2 / SSH.py
Created January 11, 2023 22:10
paramiko ssh sudo and scp
import logging
from paramiko import SSHClient, AutoAddPolicy
from scp import SCPClient
class SshClient:
def __init__(self, ssh_machine, ssh_username, ssh_password):
self.ssh_machine = ssh_machine
self.ssh_username = ssh_username
self.ssh_password = ssh_password
@TheFern2
TheFern2 / multiple_ssh_setting.md
Created October 31, 2022 15:30 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@TheFern2
TheFern2 / fish_install.md
Created October 28, 2022 14:49 — forked from gagarine/fish_install.md
Install fish shell on macOS Mojave with brew

Installing Fish shell on MacOS (Intel and M1) using brew

Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.

Note that you need the https://brew.sh/ package manager installed on your machine.

Install Fish

brew install fish