Skip to content

Instantly share code, notes, and snippets.

#! /bin/sh
power_raw=`cat /sys/bus/i2c/devices/2-0044/hwmon/hwmon1/power1_input`
voltage_raw=`cat /sys/bus/i2c/devices/2-0044/hwmon/hwmon1/in1_input`
temperature_raw=`cat /sys/devices/platform/soc/soc:i2c-gpio/i2c-2/2-0076/iio:device0/in_temp_input`
humidity_raw=`cat /sys/devices/platform/soc/soc:i2c-gpio/i2c-2/2-0076/iio:device0/in_humidityrelative_input`
pressure_raw=`cat /sys/devices/platform/soc/soc:i2c-gpio/i2c-2/2-0076/iio:device0/in_pressure_input`
power=`echo "scale=2; $power_raw / 1000000" | bc`
voltage=`echo "scale=2; $voltage_raw / 1000" | bc`
#!/bin/sh
LOAD=$(uptime | sed -n -e 's/^.*average: //p'| sed 's/ //g')
LOAD5=$(echo $LOAD | cut -d ',' -f 2)
LOAD500=$(awk -v var=$LOAD5 'BEGIN{print var * 100}')
[ $LOAD500 -gt 50 ] && reboot
@valentt
valentt / gist:69dac03c575d9e20006f6f1f41aaae0f
Last active April 10, 2018 17:31
docker gerbera (upnp media server)
sudo docker pull gpbenton/gerbera
sudo docker run -it -v /home/user/Music:/media/music -v /home/user/Videos:/media/videos -v /home/user/Pictures:/media/pictures --name gerbera docker.io/gpbenton/gerbera:latest
volumes:
/media/pictures
/media/videos
/media/music
/home/gerbera/.config/gerbera
@valentt
valentt / openvpn-profile-gen.sh
Last active October 5, 2017 10:14
Script for creating Openvpn config files for Windows
#!/bin/bash
#Dir where easy-rsa is placed
EASY_RSA_DIR="/etc/openvpn/easy-rsa/2.0"
KEYS_DIR="$EASY_RSA_DIR/keys"
# Dir where profiles will be placed
OVPN_PATH="/etc/openvpn/easy-rsa/2.0/keys"
REMOTE="YOUR-vpn-SERVER.com 1194"
if [ -z "$1" ]
#!/bin/sh
if [ -z "$1" ]; then
echo "Please run this command with Location as a parameter"
exit 1
else
location=$1
fi
sysname=`uci get system.@system[0].hostname`
korisnici=`cat /tmp/dhcp.leases|wc -l`
@valentt
valentt / susjedi
Last active October 15, 2016 17:56
show babel netighboorts and send High or Low signal via serial connection to Arduino with lasers
#!/bin/sh
#########################################################
# Display the status of the Babel mesh.
# Latest version:
# http://redmine.bidon.ca/projects/reseaulibre-scripts/repository/raw/babelstatus.sh
#
# Usage:
# babelstatus.sh : shows babel routes
# babelstatus.sh --full : show other relevant info
# download latest libevent2 and tmux sources, and extract them somewhere
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# don't compile tools as root, just don't do it.
# install deps
#!/bin/sh
#
# fedora-fromiso - Patch the ramdisk of Fedora to allow booting from
# ISO image
#
# Copyright (C) 2012 Mansour <mansour@oxplot.com>
# All rights reserved.
# Copyright (C) 2013 Matthias Saou <matthias@saou.eu>
# Update for Fedora 18
#