Skip to content

Instantly share code, notes, and snippets.

@blackpioter
blackpioter / tempcheck
Last active August 29, 2015 14:05
tempcheck on raspberry pi
#!/bin/bash
# vi /usr/bin/tempcheck
# */5 * * * * /usr/bin/tempcheck
# chmod 744 /usr/bin/tempcheck
#!/bin/sh
# This script reads the Broadcom SoC temperature value and shuts down if it
# exceeds a particular value.
# 80oC is the maximum allowed for a Raspberry Pi.
# Encrypted password in sec.conf
/secure passphrase <pass>
/secure set bncpass <pass>
# Default setting for all network
@blackpioter
blackpioter / allow_dns_iptables
Created September 11, 2014 20:06
Allow DNS master-slave
iptables -I INPUT -m tcp -p tcp --sport 1024:65535 --dport 53 -j ACCEPT
iptables -I INPUT -m udp -p udp --sport 1024:65535 --dport 53 -j ACCEPT
iptables -I OUTPUT -m tcp -p tcp --sport 1024:65535 --dport 53 -j ACCEPT
iptables -I OUTPUT -m udp -p udp --sport 1024:65535 --dport 53 -j ACCEPT
@blackpioter
blackpioter / DNS Make rev-PTR from A records
Created September 18, 2014 08:12
DNS Make rev-PTR from A records
cat ZONEFILE| grep -v "@\|TTL\|Serial\|after\|;" | awk -F" " '{ if ($3 == "A") print $0 }' | awk '{print $4" IN PTR "$1".DOMAIN."}'
@blackpioter
blackpioter / SED: Surround lines with apostrophe
Last active January 13, 2023 18:03
SED: Surround lines with apostrophe
sed -e "s/\(.*\)/'\1'/"
@blackpioter
blackpioter / awk: add string at the beginning of each line
Last active August 29, 2015 14:16
awk: add string at the beginning of each line
awk '{print "add_to_beginning"$0}' file
@blackpioter
blackpioter / VBox-CS
Last active October 22, 2018 11:48
Virtualbox list ostypes
VBoxManage list ostypes
@blackpioter
blackpioter / colordiff files
Last active February 9, 2016 15:43
colordiff files
diff --suppress-common-lines -y file1 file2 | colordiff -u | less -R
@blackpioter
blackpioter / htpasswd wo apache
Created February 22, 2016 09:37
htpasswd wo apache
printf "USER:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd
@blackpioter
blackpioter / salt CS
Last active April 20, 2016 14:22
salt CS
# Look for the state tree in the local file system and not to contact a Salt Master
salt-call --local state.apply
# Same as above in debug mode
salt-call --local state.apply -l debug
# Re-register salt minion
systemctl stop salt-minion.service && rm -rf /var/cache/salt/* && systemctl start salt-minion.service