Skip to content

Instantly share code, notes, and snippets.

View pgassmann's full-sized avatar

Philipp Gassmann pgassmann

View GitHub Profile
@pgassmann
pgassmann / bash_tool_skeleton.sh
Last active July 5, 2016 14:48
bash tool boilerplate
#!/bin/bash
# Bash script with subcommands and options
# Licence: MIT
# Based on
# - http://stackoverflow.com/questions/13638248/sub-commands-with-bash
# - http://wiki.bash-hackers.org/howto/getopts_tutorial
help() {
echo "Help: valid commands: install, apply, setup, help" >&2
}
@pgassmann
pgassmann / logo_tif_png_convert.sh
Created May 20, 2016 09:56
Convert and resize black and white tif images to resized transparent, white pngs
#!/bin/bash
# Convert and resize black and white tif images to resized transparent, white pngs
# convert utility from imagemagick
# Author: Philipp Gassmann <[email protected]>
# source: logo in multiple languages in folder translated as en.tif, de.tif etc.
# target: converted/logo_en.png ..., converted/[email protected] ...
for original in translated/*.tif ; do
convert $original -colorspace sRGB -depth 24 \
-transparent white -fill white -opaque black \
@pgassmann
pgassmann / ssl_cert_days_till_expire.sh
Last active May 18, 2016 08:50
Get number of days till certificate file expires in bash
#!/bin/bash
# Get number of days till certificate file expires in bash
# calculate number of days between two dates in bash
A="now"
B="$(openssl x509 -in /path_to_cert.pem -noout -enddate | cut -d= -f2-)"
echo "( `date -d \"$B\" +%s` - `date -d \"$A\" +%s`) / (24*3600)" | bc -l
@pgassmann
pgassmann / Streaming from Sony PXW X70.md
Last active August 29, 2015 14:25
Streaming from Sony PXW X70 with ffmpeg. Display, save and forward stream to Youtube