Skip to content

Instantly share code, notes, and snippets.

View rmetzler's full-sized avatar
💭
Recruiters should mention the role and salary range if you spam me.

Richard Metzler rmetzler

💭
Recruiters should mention the role and salary range if you spam me.
View GitHub Profile
@rmetzler
rmetzler / shell-execution.rb
Last active June 3, 2021 19:26 — forked from JosephPecoraro/shell-execution.rb
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@rmetzler
rmetzler / script-template.sh
Created December 15, 2020 20:12 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@rmetzler
rmetzler / default.vcl
Created October 2, 2020 09:03 — forked from mojodna/default.vcl
Resolve ELB IPs and create a dynamic Varnish backend list (intended to run out of cron).
# ...
include "dynamic_backends.vcl";
# ...
<!DOCTYPE html>
<html>
<head>
<title>XDebug Flame Graph</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
<style>
label {cursor: pointer;}
svg{width:100%;}
</style>
@rmetzler
rmetzler / vault_logrotate
Created July 3, 2019 18:10 — forked from soloradish/vault_logrotate
logrotate setting file for HashiCorp's Vault audit file
# Change the path below to your own audit log path.
/var/log/vault/audit.log {
rotate 30
daily
# Do not execute rotate if the log file is empty.
notifempty
missingok
compress
# Set compress on next rotate cycl to prevent entry loss when performing compression.
delaycompress
@rmetzler
rmetzler / systemdunit.py
Created June 14, 2019 13:24 — forked from esamattis/systemdunit.py
Install Systemd units using Ansible
"""
Install Systemd units using Ansible
Handles unit restarting and systemd daemon reloading when the unit changes.
Also stops the unit correctly when uninstalled
In your playbook put this file to library/systemdunit.py and make sure the
server has python-sh package installed
@rmetzler
rmetzler / test.py
Created June 5, 2019 19:52 — forked from dmsimard/test.py
ara with ansible-runner
#!/usr/bin/env python3
# Proof of concept ara with ansible-runner
# Requires https://github.com/ansible/ansible-runner/issues/219#issuecomment-496191227
import ansible_runner
import os
from ara.setup import callback_plugins
PLAYBOOK = """
- name: Test for ansible-runner
@rmetzler
rmetzler / tcp_flags.txt
Created April 21, 2019 07:43 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@rmetzler
rmetzler / ssh-docker-vm.sh
Created December 12, 2018 12:08 — forked from abdennour/ssh-docker-vm.sh
ssh-docker-for-mac
#!/bin/bash
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
@rmetzler
rmetzler / ssh-d4m
Created December 12, 2018 12:08
SSH into Docker for Mac xhyve VM
1. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
2. when done use CTRL-A CTRL-\ and then y (for yes) to exit
Alternative method:
1. docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh