Skip to content

Instantly share code, notes, and snippets.

View filviu's full-sized avatar

Silviu Vulcan filviu

View GitHub Profile
@filviu
filviu / extract_sql.pl
Created October 24, 2015 17:11
Extract table from mysqldump full database dump file. Lifted shamelessly from https://blog.tsheets.com/2008/tips-tricks/extract-a-single-table-from-a-mysqldump-file (it's GPL so it's ok)
#!/usr/bin/perl -w
##############################################################################
##
## Written by: Jared Cheney <[email protected]>
##
## Original Template written by:
## Brandon Zehm <[email protected]> and Jared Cheney <[email protected]>
##
## License:
##
@filviu
filviu / ifup-local
Last active August 29, 2015 14:24
Print IP on CentOS 7 after boot
#!/bin/bash
# goes in /sbin !!!
nohup sh -c "sleep 1 ; /usr/local/sbin/update-issue.sh" &
@filviu
filviu / lcd.py
Created June 18, 2015 10:18
output text on pi GPIO HD44780 lcd
#!/usr/bin/python
#
# HD44780 LCD Test Script for
# Raspberry Pi
#
# Author : Matt Hawkins
# Site : http://www.raspberrypi-spy.co.uk
#
# Date : 26/07/2012
#
@filviu
filviu / zfs_health.sh
Last active May 4, 2020 07:04
Original from: https://calomel.org/zfs_health_check_script.html The ZFS Health Check script You are welcome to copy and paste the following script. We call the script "zfs_health.sh", but you can use any name you wish. Make sure to set the script to be executable and define your full path to the bash shell binary at the top. Also, take a look at…
#!/bin/bash
#
# Calomel.org
# https://calomel.org/zfs_health_check_script.html
# FreeBSD 9.1 ZFS Health Check script
# zfs_health.sh @ Version 0.15
# Check health of ZFS volumes and drives. On any faults send email. In FreeBSD
# 10 there is supposed to be a ZFSd daemon to monitor the health of the ZFS
# pools. For now, in FreeBSD 9, we will make our own checks and run this script
@filviu
filviu / download.php
Created February 12, 2015 08:34
Push a file as a download from php. Useful to force a download on the brain-dead android.
<?php
$file = 'somefile.txt';
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename="'.basename($file).'"');
readfile($file);
?>
@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
@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 / 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 / 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 / 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 :