Skip to content

Instantly share code, notes, and snippets.

View ppmathis's full-sized avatar

Pascal Mathis ppmathis

View GitHub Profile
@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, #
@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 / 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 / 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 / instruction.md
Last active December 31, 2015 23:08
elementaryOS with kernel 3.12.5

uname -a
Linux smith 3.5.0-18-generic #29-Ubuntu SMP Thu Oct 25 07:26:14 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

  1. wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12.5-trusty/linux-headers-3.12.5-031205_3.12.5-031205.201312120254_all.deb
  2. wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12.5-trusty/linux-headers-3.12.5-031205-generic_3.12.5-031205.201312120254_amd64.deb
  3. wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.12.5-trusty/linux-image-3.12.5-031205-generic_3.12.5-031205.201312120254_amd64.deb
  4. dpkg -i linux-headers* linux-image*

uname -a
Linux smith 3.12.5-031205-generic #201312120254 SMP Thu Dec 12 07:55:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

S5

S5 is an abbreviation for Snap Serv Server Stack Script. Basically it is meant for setting up a fresh Debian Wheezy x86/x64 system. You can read everything it does in config.sh, which is an example config. Remember to adjust to example configuration to some sane values.

Usage

  1. Connect to your fresh server

  2. Adjust network configuration if necessary

  3. Download s5.sh and config.sh into /root:

@ppmathis
ppmathis / gist:3fbf3903c62aec569395
Last active August 29, 2015 14:03
keepass.io API Proposal #1
/* Basic concept */
/**
* Fluent interfaces like jQuery. meta(), string() all use the same principle:
*
* meta() = Return all metadata as a JSON object
* meta(key) = Return a specific key of the metadata
* meta(key, undefined) = Removes the specific key
* meta(key, value) = Set a specific key of the metadata
* meta(jsonObject) = Set multiple keys at once (or removes them, if value of a key is undefined)
*
@ppmathis
ppmathis / Library comparison
Created July 31, 2014 09:07
keepass.io - Issue #9
==== NeoXiD (Xubuntu 14.04) ====
nm build/Release/kpion.node | grep _ZTVN8CryptoPP18StringSinkTemplateISsEE
> U _ZTVN8CryptoPP18StringSinkTemplateISsEE
nm /usr/lib/libcrypto++.a | grep _ZTVN8CryptoPP18StringSinkTemplateISsEE
> 0000000000000000 V _ZTVN8CryptoPP18StringSinkTemplateISsEE
> U _ZTVN8CryptoPP18StringSinkTemplateISsEE
pmathis@troja:~/Projects/keepass.io$ nm -gC /usr/lib/libcrypto++.a | grep StringSinkTemplate
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::IsolatedInitialize(CryptoPP::NameValuePairs const&)
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::Put2(unsigned char const*, unsigned long, int, bool)
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::StringSinkTemplate(std::string&)
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::StringSinkTemplate(std::string&)
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::~StringSinkTemplate()
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::~StringSinkTemplate()
0000000000000000 W CryptoPP::StringSinkTemplate<std::string>::~StringSinkTemplate()
0000000000000020 W non-virtual thunk to CryptoPP::StringSinkTemplate<std::string>::~StringSinkTemplate()
0000000000000000 W non-virtual thunk to CryptoPP::StringSinkTemplate<std::string>::~StringSinkTemplate()
@ppmathis
ppmathis / bootstrap.yml
Last active August 29, 2015 14:21
Ansible Connection Bootstrapper
---
# First, we are going to check if the netcat binary is available.
# This is required to quickly check if the preferred SSH port is reachable.
- name: Connection Bootstrapper >> Check if 'nc' binary is available
delegate_to: 127.0.0.1
local_action: stat path=/usr/bin/nc
register: nc_binary_check
- name: Connection Bootstrapper >> Abort execution if 'nc' binary does not exist
fail: