Skip to content

Instantly share code, notes, and snippets.

View filviu's full-sized avatar

Silviu Vulcan filviu

View GitHub Profile
@filviu
filviu / connect-vpn.sh
Created September 9, 2014 05:50
Auto connect a vpn with NetworkManager. Place this in /etc/NetworkManager/dispatcher.d/
#! /bin/bash
REQUIRED_CONNECTION_NAME="NAME"
VPN_CONNECTION_NAME="VPN_NAME"
activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION_NAME}")
activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
if [ "${activ_con}" -a ! "${activ_vpn}" ];
then
@filviu
filviu / rename.sh
Created September 16, 2014 20:13
I discovered that xbmc prefers "movie name (yyyy)" instead "yyyy - movie name"
#!/bin/bash
while read NAME; do
YEAR=$(echo $NAME | sed -r 's/\ -\ /_/' | awk -F_ '{print $1}')
NEWNAME=$(echo $NAME | sed -r 's/\ -\ /_/' | awk -F_ '{print $2}')
mv "$NAME" "$NEWNAME ($YEAR)"
done < <(ls -1 | grep -v rename.sh)
shutdown /s /f /t 3600
REM where
REM /s - shutdown local computer
REM /f - force programs to close without showing warning
REM /t 3600 - delay for 3600 seconds (1 hour)
@filviu
filviu / clone.sh
Created September 30, 2014 09:21
dd with pv progress
#!/bin/bash
dd if=/dev/vg/sys01 | pv -ptera -s 10g | dd of=/dev/vg/sys02
@filviu
filviu / hostapd.conf
Created October 16, 2014 10:48
hostapd configuration for hotspot on debian
interface=wlan0
driver=nl80211
country_code=RO
ieee80211d=1
ssid=SSIDNAME
channel=6
hw_mode=g
@filviu
filviu / ssl-operations.md
Last active August 29, 2015 14:08
Check SSL Certificate Expiration Date and other information

Checking the Date and other details of an SSL Certificate

Check when an SSL certificate expires:

echo | openssl s_client -connect site:port 2>/dev/null | openssl x509 -noout -dates

We'll check this and the next example using google.com :

@filviu
filviu / umlaut-rename.sh
Created November 5, 2014 08:49
Rename characters containing umlauts, etc. to their ascii literal equivalent
#!/bin/bash
type iconv >/dev/null 2>&1 || { echo >&2 "iconv has to be installed. Aborting."; exit 1; }
find . -type f | while read FILE; do
if [ -f "$(echo "$FILE" | iconv -f utf8 -t ascii//TRANSLIT)" ]; then
echo "No rename required: $FILE"
else
mv -v "$FILE" "$(echo "$FILE" | iconv -f utf8 -t ascii//TRANSLIT)"
fi
done
@filviu
filviu / nagstatmon.sh
Created November 26, 2014 08:52
Script to restart/respawn nagstatmon (any program really) since for me it often crashes. Loop exists on user exit.
until /opt/Nagstamon/Nagstamon/nagstamon.py; do
echo "Nagstatmon crashed; respawing..."
sleep 1
done
@filviu
filviu / poodle-check.sh
Last active August 29, 2015 14:14
Check a site if it's vulnerable to poodle using nmap
# check site for poodle
nmap --script ssl-enum-ciphers -p 443 twitter.com |grep "SSLv3: No supported" ||echo "Site vulnerable to poodle"
@filviu
filviu / esekeyd.conf
Created January 27, 2015 12:25
Simple raspi "cloud" scanner
#
# ESE Key Deamon 1.2.7 config file
#
#
# example 1: to run mutt in xterm we must set DISPLAY
# so the command line will be as follows:
#MAIL:/bin/sh -c "DISPLAY=:0 xterm -e mutt"
#
# example 2: turn on/off GPS reciever when lid is open/closed