Skip to content

Instantly share code, notes, and snippets.

View SkaTeMasTer's full-sized avatar

$hawn Reimerdes SkaTeMasTer

View GitHub Profile
@SkaTeMasTer
SkaTeMasTer / .bashrc
Last active April 23, 2024 16:27
Edit /home/pi/.bashrc to display MOTD and welcome screen
# via https://github.com/rosterloh/raspberry-pi/blob/master/configs/.bashrc
#
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
@SkaTeMasTer
SkaTeMasTer / .bash_profile
Created January 9, 2018 19:50
Edit the bash shell's profile to enable extras like colors, aliases and a new command line prompt!
sudo nano /home/pi/.bash_profile
@SkaTeMasTer
SkaTeMasTer / gist:cd350f923aeb61ef7bb224ffd07db72d
Created December 29, 2017 15:43
How to disable screen blanking on raspberry pi. You need to insert this entry in file: /etc/lightdm/lightdm.conf
xserver-command=X -s 0 -dpms
@SkaTeMasTer
SkaTeMasTer / update-system.sh
Created December 29, 2017 15:33
Oneliner update system to latest rolling: (1) update, (2)upgrade (3) distro-upgrade (4) clean (5) remove
#
# apt upgrade rolling everything in one line
#
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get clean && sudo apt-get remove
@SkaTeMasTer
SkaTeMasTer / speedtest-cron.sh
Created December 28, 2017 15:08
Create a log file entry for speedtest-cli. Place this in /etc/cron.hourly directory for continuous logging coolness. Reports ping time, and upload / download speed.
#!/bin/sh
MSG=`speedtest-cli --simple | perl -pe 's/^(.*): (.*) (.*?)(\/s)?\n/"$1_$3": $2, /m' | cut -d',' -f 1-3`
logger "{\"speed\": {$MSG}}"
@SkaTeMasTer
SkaTeMasTer / down-connection.sh
Created December 26, 2017 07:49
We lost connection on VPN tunnel. So let us not start leaking our local packets..
#!/bin/sh
iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE
@SkaTeMasTer
SkaTeMasTer / waitforit-vpn-onboot.sh
Last active December 22, 2017 18:22
Print the status of the OpenVPN connection.
#
# --mlock : Disable Paging -- ensures key material and tunnel
# data will never be written to disk.
# --up-delay : Delay tun/tap open and possible --up script execution
# until after TCP/UDP connection establishment with peer.
/usr/sbin/openvpn --show-gateway --up-delay --mlock --single-session
# outputs:
# Fri Dec 22 12:53:52 2017 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=eth0 HWADDR=b8:27:eb:27:5e:e1
@SkaTeMasTer
SkaTeMasTer / speedtest-cron.sh
Created December 22, 2017 05:59
This is where IFTTT‘s Maker Channel, introduced towards the middle of last year, comes in handy. I went ahead and created a recipe on IFTTT to take the data passed to a Maker Channel event called “speedtest” and automatically fill a Google Sheet with the output of speedtest-cli script. Screenshot 2016-01-31 16.33.31 The easiest way to get the da…
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
#!/bin/bash
base="/data/live"
cd $base
raspivid -n -w 720 -h 405 -fps 25 -vf -t 86400000 -b 1800000 -ih -o - \
| ffmpeg -y \
-i - \
-c:v copy \
# Local
auto lo
iface lo inet loopback
# Ethernet
auto eth0
iface eth0 inet static
address 192.168.1.104
netmask 255.255.255.0
gateway 192.168.1.1