Available for hire

Could not find any match !

Shell -

Locate invalid ZIPs


#!/bin/bash

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Identifies corrupted ZIP/JAR/WAR files.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ ! -z ${1} ]; then
  echo "Scanning ${1} ..."
  if [ -d "${1}" ]; then
    find ${1} -regex ".*\.\(jar\|war\|zip\)" | xargs -L 1 zip -T | grep error | grep invalid
    echo "Finished searching for invalid ZIP/JAR/WAR"
  else
    echo "You need to supply a directory !"
  fi
else
  echo "You need to supply a directory !"
fi

Securely erase harddisk


openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 </dev/null | base64)" -nosalt </dev/zero | pv --progress --eta --rate --bytes | dd of=/dev/sde

Set permissions for all directories


sudo find . -type d -exec chmod 755 {} \;

Set permissions for all files


sudo find . -type f -exec chmod 644 {} \;

Synchronize two directories


#!/bin/sh

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Makes sure that the source directory will be synced with a target directory as long as this script keeps going.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FROM=${1}
TO=${2}

while inotifywait -r -e modify -e create -e delete ${FROM}; do
    rsync -p -r ${FROM} ${TO}
done