Skip to content

Instantly share code, notes, and snippets.

@marrobHD
marrobHD / compile.sh
Last active March 14, 2020 23:00
Installs Hyperion.ng on Raspberry Pi 3B+ on debian
# How to use: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh (var1: -i/-b) (var2: target) (var3: cfg)
# Example:
# with installation: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh -i
# only build: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh -b
# depraced way; WONT WORK only build: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw | bash -s -- -b
#!/bin/sh
@marrobHD
marrobHD / ProxmoxNag.sh
Last active June 29, 2020 14:10
Removes the nag from Proxmox | Tested 5.1-3 - 6.2-4
# Disable Commercial Repo
sed -i "s/^deb/\#deb/" /etc/apt/sources.list.d/pve-enterprise.list && apt-get update
# Add PVE Community Repo
echo "deb http://download.proxmox.com/debian/pve $(grep "VERSION=" /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p') pve-no-subscription" > /etc/apt/sources.list.d/pve-no-enterprise.list && apt-get update
# Remove nag
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script && apt --reinstall install proxmox-widget-toolkit
@marrobHD
marrobHD / resize.sh
Last active January 18, 2020 12:39
Resize partition
#!/bin/bash
set -e
if [[ $# -eq 0 ]] ; then
echo 'please tell me the device to resize as the first parameter, like /dev/sda'
exit 1
fi
if [[ $# -eq 1 ]] ; then
@marrobHD
marrobHD / add_domains.bat
Created February 16, 2020 15:44
Windows 10: Add trusted domains to all users using batch
@ECHO OFF
SETLOCAL
SET REG="%WINDIR%\system32\reg.exe"
SET INTRANET_DOMAINS=contoso.local example.local
SET TRUSTED_DOMAINS=microsoft.com example.com
IF EXIST "%USERPROFILE%\..\Default User\NTUSER.DAT" SET NTUSER="%USERPROFILE%\..\Default User\NTUSER.DAT"
IF EXIST "%USERPROFILE%\..\Default\NTUSER.DAT" SET NTUSER="%USERPROFILE%\..\Default\NTUSER.DAT"
IF DEFINED PROGRAMFILES(x86) SET X64=TRUE
@marrobHD
marrobHD / hassosproxmoxinstall.sh
Last active March 13, 2020 11:05
This script will create a new Proxmox VM with the latest version of HassOS. To create a new VM in the local-lvm storage, run the following in a SSH session or the console from Proxmox interface
#!/bin/bash
# wget -qO - https://gist.githubusercontent.com/marrobHD/760704aa7c864a10a7c5c5fa323b0012/raw/043d2f61ad5717228504f476e923eb829b3f9d58/hassosproxmoxinstall.sh | bash -s local-lvm
set -o pipefail
shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
function error_exit() {
REASON=$1
MSG="\e[91mERROR: \e[93m$EXIT@"
@marrobHD
marrobHD / remove-cluster.sh
Last active July 1, 2020 12:13
Removing/Deleting a created cluster in Proxmox 6.1-8
Moved to https://github.com/marrobHD/proxmox-tools/blob/master/leave-cluster.sh
and https://raw.githubusercontent.com/marrobHD/proxmox-tools/master/leave-cluster.sh
@marrobHD
marrobHD / proxmoxve_community.sh
Last active May 18, 2020 18:55
How to setup a community version of Proxmox VE 5.x-6.x
# Disable Commercial Repo
sed -i "s/^deb/\#deb/" /etc/apt/sources.list.d/pve-enterprise.list && apt-get update
# Add PVE Community Repo
echo "deb http://download.proxmox.com/debian/pve $(grep "VERSION=" /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p') pve-no-subscription" > /etc/apt/sources.list.d/pve-no-enterprise.list && apt-get update
# Remove nag
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script && apt --reinstall install proxmox-widget-toolkit
@marrobHD
marrobHD / docker-cleanup
Created June 5, 2020 20:21
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
@marrobHD
marrobHD / install-docker.sh
Last active June 29, 2020 14:12
Install Latest Docker and Docker-compose on Ubuntu
# !WARNING!
# Script moved to https://blob.CLITools.tk/install-docker(https://github.com/marrobHD/clitools/blob/master/install-docker)
# This script is no longer updated on GitHub Gist.
# !WARNING!
# wget -qO- https://gist.github.com/marrobHD/42f1ab222d4f83e811b15bae72a346ea/raw | bash
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
@marrobHD
marrobHD / uninstall-docker.sh
Last active June 29, 2020 14:11
Fully removes docker and docker-compose
# !WARNING!
# Script moved to https://blob.CLITools.tk/uninstall-docker(https://github.com/marrobHD/clitools/blob/master/uninstall-docker)
# This script is no longer updated on GitHub Gist.
# !WARNING!
# Remove docker compose
sudo rm $(which docker-compose)
sudo pip uninstall docker-compose