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 / docker_haproxy_auto_config.php
Created January 30, 2018 14:59
Configure haproxy automatically for docker open ports
<?php
$list=@shell_exec('netstat -antepul | grep -i "listen" | grep "127.0.0.1:" | grep -i "docker-proxy"');
$list=explode("\n",str_replace("\r","",$list));
$ports=array();
foreach($list as $k=>$v){
$v=trim($v);
if(strlen($v)>0){
while(stripos($v,' ')!==false){
@vladbabii
vladbabii / mariadb_galera_cluster_check_restart.sh
Created January 30, 2018 09:25
MariaDB Galera 10.1+ Cluster Check and Restart
STFAILED="failed"
STRUNNING="active"
STSTOPPED="stopped"
STSTARTING="starting"
CMDBOOTSTRAP="/usr/bin/galera_new_cluster"
CMDSTART="systemctl start mysql"
STARTWAIT=15
@vladbabii
vladbabii / disable_docker_auto_start.sh
Created January 29, 2018 16:55
Disable docker auto-start
bash -c 'echo manual | sudo tee /etc/init/docker.override'
@vladbabii
vladbabii / mount_x.service
Created January 29, 2018 16:54
Systemd run script after mount
# original: https://askubuntu.com/questions/25071/how-to-run-a-script-when-a-specific-flash-drive-is-mounted
# you can find your device unit with: sudo systemctl list-units -t mount
# put this into /etc/systemd/system/your.service
[Unit]
Description=SharedMountTrigger
Requires=mnt-shared.mount
After=mnt-shared.mount
[Service]
@vladbabii
vladbabii / rancher_load_balancer_timeout__haproxy_custom.txt
Created January 29, 2018 12:48
Rancher Load Balancer Timeout ( Haproxy Custom )
global
maxconn 4096
maxpipes 1024
defaults
timeout client 36000s
timeout server 36000s
@vladbabii
vladbabii / install_rancher_over_docker.sh
Created January 29, 2018 11:55
install_rancher_over_docker.sh
mkdir -p /mnt/rancher_mysql
chmod -R 777 /mnt/rancher_mysql
docker run -d -v /mnt/rancher_mysql:/var/lib/mysql --restart=always -p 64080:8080 -p 9345:9345 rancher/server --advertise-address $RANCHERPUBLICIP --advertise-http-port 64080
@vladbabii
vladbabii / install_docker_latest_on_ubuntu_with_root_user.sh
Created January 29, 2018 11:49
install_docker_latest_on_ubuntu_with_root_user.sh
apt-get update
apt-get remove docker docker-engine docker.io
apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
-y
@vladbabii
vladbabii / utmskeeper_cron_check_rds_usb_modem.sh
Created November 21, 2017 21:22
UtmKeeper Cron Check RDS Romania USB Modem ZTE WCDMA Technologies MSM
#!/bin/bash
echo "Starting check at `date`"
echo "checking... "
ps -aux | grep -v grep | grep "keeper" | grep "19d2:1515" > /dev/null
result=$?
echo "exit code: ${result}"
echo "---"
if [ "${result}" -eq "0" ] ; then
echo "service running, everything is fine"
else
Backup of https://hallard.me/raspberry-pi-read-only/
Protect your Raspberry PI SD card, use Read-Only filesystem
Posted on May 14, 2015 by Charles
Today I decided to protect all my Raspberry Pi SD cards from unproper shutdown and also prevent SD card premature end of life. This means protect them from power outage or just unplugging the power while the Pi is running.
Edit :
April 2016 to works on Jessie and Raspberry PI 3
January 2017 Fix SSH access problem after reboot / moved resolv.conf to tmpfs
@vladbabii
vladbabii / home_asistant_upgrade_virtualenv_srv.sh
Created November 13, 2017 19:56
Upgrade home assistant in /srv/homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade homeassistant