Skip to content

Instantly share code, notes, and snippets.

View ppmathis's full-sized avatar

Pascal Mathis ppmathis

View GitHub Profile
@ppmathis
ppmathis / dynmotd.sh
Last active December 27, 2017 01:06
DynMOTD
#!/bin/sh
# Only for empty SSH subsystems
if [ ! -z "$SSH_ORIGINAL_COMMAND" ]; then
exit 0
fi
# Helper function for centering a toilet banner
center() {
LINE_STR=$1
PADDING_STR=$(printf '%*s' $PADDING '')
@ppmathis
ppmathis / screenshot.sh
Last active August 4, 2018 18:51
Linux screenshot script, can be used together with a custom shortcut. Based on notify-send, shutter, scp and xclip.
#!/bin/sh
# Options
RANDOM_CHARS=$(< /dev/urandom tr -dc a-z0-9 | head -c10)
FILE_DESTINATION='/home/pmathis/Pictures/Screenshots'
FILE_FORMAT=$RANDOM_CHARS'_%Y-%m-%d_%H.%M.%S.png'
SSH_ALIAS='trinity'
SSH_FOLDER='/home/pmathis/public/screens.snapserv.net'
HTTP_URL='https://screens.snapserv.net'
SUCCESS_ICON='/usr/share/icons/gnome/32x32/status/stock_dialog-info.png'
FAILURE_ICON='/usr/share/icons/gnome/32x32/status/stock_dialog-error.png'
@ppmathis
ppmathis / app.coffee
Last active December 19, 2015 10:59
[sequelize] validation gets messed up when updating an model instance
# Modules
sequelize = require('sequelize')
# Connect to database
Sequelize = new sequelize('sequelize', 'sequelize', 'sequelize-test',
host: 'localhost'
port: '3306'
dialect: 'mysql'
syncOnAssociation: false
@ppmathis
ppmathis / duo_auth.sh
Created October 14, 2012 13:19
Improved two factor authentication with DuoSecurity
###########################################################
# Two factor authentication with DuoSecurity #
# #
# (c) 2012 P. Mathis <pmathis@snapserv.net> #
###########################################################
# This script will improve the normal UNIX integration #
# of DuoSecurity. You can specify for each SSH subsystem #
# if the two factor authentication is required. #
# #
# I am not responsible for lost or breached servers, #