Skip to content

Instantly share code, notes, and snippets.

View mjuenema's full-sized avatar

Markus Juenemann mjuenema

View GitHub Profile

AES encryption with PKCS5 padding

NOTE: Possible use the Cryptography package instead.

Install Python pycrypto_ package.

@mjuenema
mjuenema / ..Molecule-Docker.md
Last active November 28, 2016 03:05
Use Molecule and Docker to test Ansible roles

Use Molecule and Docker to test Ansible roles

Install pre-requisites.

$ which yum && sudo yum install libffi-devel python-devel python-virtualenvwrapper
$ which apt-get && sudo apt-get libffi-dev python-dev python-virtualenvwrapper

Install Docker.

$ TODO

OpenSSL Commands

Displaying Server Certificates

$ echo | openssl s_client -connect www.example.com:https 2>/dev/null | openssl x509 -noout -text

$ echo | openssl s_client -connect www.example.com:https 2>/dev/null | openssl x509 -noout -dates
notBefore=Aug  4 00:00:00 2016 GMT
notAfter=Sep 19 23:59:59 2017 GMT

Vagrant Notes

Installing and customising Vagrant

Install Vagrant from the download page to ensure the most recent version is installed.

@mjuenema
mjuenema / bfg_git_repo_cleaner.md
Last active July 2, 2017 22:48
BFG Git Repo Cleaner

BFG Git repo cleaner

The BFG Git repo cleaner is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history, e.g.

  • Removing Crazy Big Files
  • Removing Passwords, Credentials & other Private data

Create a backup of your current working copy of the repository.

@mjuenema
mjuenema / git_flow_quickref.md
Last active January 22, 2019 14:43
Git Flow Quick Reference

Git Flow Quick Reference

Init

$ git flow init -d

Feature

Git Crypt

$ git-crypt init
$ vim .gitattributes
secretfile filter=git-crypt diff=git-crypt
*.key      filter=git-crypt diff=git-crypt
"""
Ping all hosts in 10.1.10/24 and print IP addresses of
hosts that replied.
Requires scapy (https://pypi.python.org/pypi/scapy) and
must be run with root permissions.
(c) 2017 Markus Juenemann
"""
@mjuenema
mjuenema / nosetest-stdout.md
Last active January 27, 2021 22:55
Capture and test sys.stdout with nosetest

Capture and test sys.stdout with nosetest

import sys
import tempfile

import sys
import tempfile

class Base(object):

Python decorator example

def typecheck(type_):
    def decorator_(func):
    
        def wrapper_(name):
           if not type(name) == type_:
               raise TypeError
 else: