Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Metzler rmetzler

View GitHub Profile
@rmetzler
rmetzler / shell-execution.rb
Last active Jun 3, 2021 — forked from JosephPecoraro/shell-execution.rb
Shell Execution in Ruby
View shell-execution.rb
# 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 Dec 15, 2020 — 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/
View script-template.sh
#!/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 Oct 2, 2020 — forked from mojodna/default.vcl
Resolve ELB IPs and create a dynamic Varnish backend list (intended to run out of cron).
View default.vcl
# ...
include "dynamic_backends.vcl";
# ...
View xdebugfg.php
<!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 Jul 3, 2019 — forked from soloradish/vault_logrotate
logrotate setting file for HashiCorp's Vault audit file
View vault_logrotate
# 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 Jun 14, 2019 — forked from esamattis/systemdunit.py
Install Systemd units using Ansible
View systemdunit.py
"""
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 Jun 5, 2019 — forked from dmsimard/test.py
ara with ansible-runner
View test.py
#!/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
View neo4j.debug.log
2019-04-30 20:35:04.933+0000 WARN [io.netty.channel.AbstractChannelHandlerContext] An exception 'java.lang.OutOfMemoryError: Java heap space' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:
2019-04-30 20:35:04.933+0000 WARN [io.netty.channel.AbstractChannelHandlerContext] An exception 'java.lang.OutOfMemoryError: Java heap space' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:
2019-04-30 20:35:04.935+0000 ERROR [o.n.b.r.DefaultBoltConnection] Unable to close pack output of bolt session 'bolt-181'.
java.lang.NullPointerException
at org.neo4j.bolt.v1.transport.ChunkedOutput.close(ChunkedOutput.java:231)
at org.neo4j.bolt.runtime.DefaultBoltConnection.close(DefaultBoltConnection.java:313)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:242)
at org.neo4j.bolt.runt
@rmetzler
rmetzler / fuzzy-azure-account-switch
Created Apr 24, 2019
use fzf to switch between azure accounts
View fuzzy-azure-account-switch
function faz() {
az account set --subscription $(az account list -o table | fzf | cut -c '62-98')
az account show
}
@rmetzler
rmetzler / tcp_flags.txt
Created Apr 21, 2019 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
View tcp_flags.txt
##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)