Skip to content

Instantly share code, notes, and snippets.

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

Vlad Babii vladbabii

💭
I may be slow to respond.
View GitHub Profile
@vladbabii
vladbabii / pi_readonly_auto_sh
Last active July 24, 2021 16:53
pi_readonly_auto.sh
#!/bin/bash
# based on
# https://learn.adafruit.com/read-only-raspberry-pi/
if [ $(id -u) -ne 0 ]; then
echo "Installer must be run as root."
echo "Try 'sudo bash $0'"
exit 1
fi
@vladbabii
vladbabii / pi_initial.sh
Last active October 30, 2017 19:02
PiInitial
#!/bin/bash
apt-get update
apt-get install -y nano screen htop
echo remove dns, bluetooth,
apt-get remove -y bluez avahi-daemon samba-common triggerhappy
echo "## disabling wifi and bluetooth modules..."
cat > /etc/modprobe.d/raspi-blacklist.conf <<EOL
@vladbabii
vladbabii / pi_readonly.sh
Last active October 30, 2017 18:17
PiReadOnly.sh
#!/bin/bash
# based on
# https://learn.adafruit.com/read-only-raspberry-pi/
# CREDIT TO THESE TUTORIALS:
# petr.io/en/blog/2015/11/09/read-only-raspberry-pi-with-jessie
# hallard.me/raspberry-pi-read-only
# k3a.me/how-to-make-raspberrypi-truly-read-only-reliable-and-trouble-free
if [ $(id -u) -ne 0 ]; then
@vladbabii
vladbabii / check_socat_zwave.sh
Created October 25, 2017 17:06
Check socat for zwave
#!/bin/bash
LOCALPORT=/dev/zwave
REMOTEPORT=10.11.12.222:7676
TIMEWAIT=10
echo "checking socat..."
if [[ $(ps ax | grep -v grep | grep tcp:$REMOTEPORT | wc -l) -eq 0 ]]
then
echo " ... restarting"
/usr/bin/socat pty,link=$LOCALPORT,raw,group=root,mode=777 tcp:$REMOTEPORT &
@vladbabii
vladbabii / map_zwave_stick_to_dev_zwave.sh
Created October 25, 2017 16:40
map zwave stick to /dev/zwave
echo "SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0658\", ATTRS{idProduct}==\"0200\", SYMLINK+=\"zwave\", RUN+=\"/bin/x-hass-restart-zwave-replug\"" > /etc/udev/rules.d/99-zwave-stick.rules
@vladbabii
vladbabii / how_to_ssh_alias.txt
Created August 28, 2017 13:35
Save a ssh alias linux
nano ~/.ssh/config
add at the end of file:
Host favorite
HostName some.host.org
Port 3563
then you can use ssh user@favorite
@vladbabii
vladbabii / le_certs.sh
Created February 22, 2017 23:42
LetsEncrypt Auto Gen Cert
echo "Starting letsencrypt - please wait a while.. might take a couple of minutes!"
letsencrypt \
--standalone \
--duplicate certonly \
-d z.example.com \
-d y.example.com \
-d x.example.com \
--standalone-supported-challenges http-01 --http-01-port 54321
@vladbabii
vladbabii / ubuntu_apt_cache_configuration.sh
Created February 18, 2017 08:01
Configure apt-cache on ubuntu
echo "Acquire::http::Proxy \"http://<ip>:<port>\";" > /etc/apt/apt.conf.d/01proxy
@vladbabii
vladbabii / ssh_permit_root_login.sh
Created February 18, 2017 07:48
Ssh permit root login
sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
service ssh restart
@vladbabii
vladbabii / delete_apt_cache_files_automatically.sh
Created February 18, 2017 07:47
Delete apt cache files automatically (works well with apt-cache)
echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | sudo tee /etc/apt/apt.conf.d/clean