Skip to content

Instantly share code, notes, and snippets.

View det-peralta's full-sized avatar
💭
I may be slow to respond.

sirdetperalta det-peralta

💭
I may be slow to respond.
  • Portugal
View GitHub Profile
@det-peralta
det-peralta / passthru-nvidia-to-lxc.sh
Created May 20, 2024 10:11 — forked from paul-chambers/passthru-nvidia-to-lxc.sh
nvidia GPU passthru to an LXC container (for Debian)
#!/bin/bash
# In both host and container, add the nVidia repros (see https://nvidia.github.io/nvidia-container-runtime/)
set -x
which curl > /dev/null || apt install curl
# add the repo key:
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
# add the 'nvidia container runtime' repo to apt's sources
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
#!/bin/bash
# Global variables
SSH_CONFIG="/etc/ssh/sshd_config"
SSH_CONFIG_D="/etc/ssh/sshd_config.d/60-cloudimg-settings.conf"
# Function to update system repositories
update_system() {
sudo apt update && sudo apt upgrade -y
}
@det-peralta
det-peralta / create_samba_share.sh
Last active May 15, 2024 22:44
Bash script for setting up an authenticated Samba share on Debian, automating installation and configuration for easy network sharing.
#!/bin/bash
# Function to prompt for user input
prompt_for_input() {
local prompt="$1"
local variable_name="$2"
local input
while true; do
printf "%s: " "$prompt"
@det-peralta
det-peralta / setup_github_auth.sh
Created May 14, 2024 16:38
This bash script helps automate the setup of GitHub authentication using either a Personal Access Token (PAT) or SSH keys. Follow the script prompts to configure your GitHub credentials securely and efficiently.
#!/bin/bash
# Function to configure Git to use a Personal Access Token (PAT)
setup_pat() {
echo "Configuring Git to use a Personal Access Token (PAT)..."
read -p 'Enter your GitHub username: ' github_username
echo "Please generate a PAT from https://github.com/settings/tokens and copy it."
read -sp 'Enter your GitHub Personal Access Token: ' github_pat
echo
@det-peralta
det-peralta / mouse_jiggler.ps1
Created November 29, 2022 14:02
Mouse jiggler
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X % 500) + 1
$y = ($pos.Y % 500) + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 10
}
@det-peralta
det-peralta / install_docker_on_debian_wsl2.sh
Last active December 27, 2021 11:49
Install Docker Engine on Debian WSL2
#!/bin/sh
#Uninstall docker old versions
sudo apt remove --yes docker docker-engine docker.io containerd runc || true
#Set up the docker repository
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
@det-peralta
det-peralta / clean_spooler.bat
Created April 28, 2021 17:55
clean printer spooler
@echo off
powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/s,/c,net stop spooler & DEL /F /S /Q %systemroot%\System32\spool\PRINTERS\* & net start spooler' -Verb runAs"
docker run -it -d --name=xteve -p 34400:34400 -v /volume1/nasbox/Docker/xteve/xteve_home:/home/xteve/.xteve bl0m1/xtevedocker:latest
docker run -it -d --name=xteve --network=host --restart=always -v/volume1/nasbox/Docker/xteve:/home/xteve/conf dnsforge/xteve:latest
@det-peralta
det-peralta / airwick_kitchen.yaml
Created June 3, 2020 11:50
Esphome + relay + ultrasonic
esphome:
name: airwick_kitchen
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "ssid"
password: "pass"
# Enable fallback hotspot (captive portal) in case wifi connection fails
@det-peralta
det-peralta / ubuntu_server_docker.sh
Last active May 16, 2020 16:15
Ubuntu Server 20.04 + docker
#https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso
#https://github.com/pbatard/rufus/releases/download/v3.10/rufus-3.10p.exe
sudo groupadd docker
sudo usermod -aG docker ${USER}
logout