Skip to content

Instantly share code, notes, and snippets.

@aelveborn
aelveborn / ipredator-iptables.sh
Last active August 30, 2015 10:21
Synology DSM 5 script to prevent IP leak for ipredator VPN service. Based on the script from mik3y http://www.mik3y.net/files/syno/
#!/bin/ash
# wget https://gist.githubusercontent.com/aelveborn/e0faab9185256eeb86ad/raw/ -O ipredator-iptables.sh
# chmod 755 ipredator-iptables.sh
# and modify your local ip in the script
enableRules() {
if [ -f /etc/ipredator/iptables.orig ]; then
echo "Ipredator iptables rules already enabled!"
else
@aelveborn
aelveborn / vpn-status.sh
Last active April 9, 2021 07:31
Synology DSM 5 VPN reconnection script.Save file to /usr/openVPNreconnect then run chmod +x /usr/openVPNreconnect. Schedule by following http://forum.synology.com/enu/viewtopic.php?f=241&t=65444
# Replace o1234567890 with your OpenVPN id. To get your id, start the VPN and run ps|grep client_o
# Replace YOUR_VPN_NAME with the name of your VPN profile in DSM 5 admin panel.
if echo `ifconfig tun0` | grep -q "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"
then
echo "VPN is running"
else
echo conf_id=o1234567890 > /usr/syno/etc/synovpnclient/vpnc_connecting
echo conf_name=YOUR_VPN_NAME >> /usr/syno/etc/synovpnclient/vpnc_connecting
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting
@aelveborn
aelveborn / cpu-freq.sh
Created December 25, 2013 23:31
Check the CPU frequency in Linux
#!/bin/bash
watch grep \"cpu MHz\" /proc/cpuinfo
@aelveborn
aelveborn / switch-turbo.sh
Last active February 18, 2021 15:39
Bash script to enable / disable turbo on the CPU in Linux. Change permissions: sudo chmod a+x switch-turbo.sh Run the script: sudo ./switch-turbo.sh
#!/bin/bash
status=$(head /sys/devices/system/cpu/intel_pstate/no_turbo | grep -o '[0-1]')
if [ $status = 0 ]; then
echo "Switching CPU-turbo: OFF"
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
else
echo "Switching CPU-turbo: ON"
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo