Skip to content

Instantly share code, notes, and snippets.

View codebymikey's full-sized avatar

codebymikey codebymikey

View GitHub Profile
<?php
/**
* Checks where a serialize call would've failed.
*/
public static function check($checking_key, $data, $path = [], $processed = []) {
try {
// Attempt to serialize the data to check for serializability.
serialize($data);
} catch (\Throwable $e) {
#!/usr/bin/env bash
#: Your comments here.
set -o errexit
set -o nounset
set -o pipefail
work_dir=$(dirname "$(readlink -f "${0}" 2> /dev/null)")
readonly conf_file="${work_dir}/script.conf"
readonly error_reading_conf_file=80
readonly error_parsing_options=81
readonly script_name="${0##*/}"
@codebymikey
codebymikey / rotate-secrets.yml
Created September 25, 2019 10:25 — forked from tomwassenberg/rotate-secrets.yml
A hacky Ansible playbook that can be adapted to rotate Ansible Vault-encrypted secrets in-place.
---
# This playbook rotates Ansible Vault-encrypted secrets that are defined
# as dictionaries in the group_vars of an Ansible repository.
#
# The changes are split over multiple tasks, because the dictionary logic
# doesn't handle looping over secrets on differing levels within a
# dictionary.
- hosts: "all"
user: "ansible"
@codebymikey
codebymikey / rsync.sh
Created April 23, 2018 20:22 — forked from macmladen/exclude-rsync.sh
rsync exclude patterns
# /dir/ means exclude the root folder /dir
# /dir/* means get the root folder /dir but not the contents
# dir/ means exclude any folder anywhere where the name contains dir/
# Examples excluded: /dir/, /usr/share/mydir/, /var/spool/dir/
# /dir means exclude any folder anywhere where the name contains /dir
# Examples excluded: /dir/, /usr/share/directory/, /var/spool/dir/
# /var/spool/lpd//cf means skip files that start with cf within any folder within /var/spool/lpd
#
# include, +
# exclude, -
@codebymikey
codebymikey / super_decoder.js
Last active November 17, 2018 16:20 — forked from Inndy/super_decoder.js
Decode jsfuck / aaencode / jjencode / deobfuscatejs / decodejs / jsunfuck / unfuckjs
!function () {
var global = this;
var old_eval = global.eval;
var old_const = global.Function.prototype.constructor;
global.Function.prototype.constructor = function (code) {
console.log('Function Constructor: ' + code);
return old_const(code);
};
global.eval = function (code) {
console.log('EVIL: ' + code);
@codebymikey
codebymikey / le-renew.sh
Created August 7, 2017 09:35 — forked from erikaheidi/le-renew.sh
Auto renewal for Let's Encrypt Apache
#!/bin/bash
#================================================================
# Let's Encrypt renewal script for Apache on Ubuntu/Debian
# @author Erika Heidi<[email protected]>
# Usage: ./le-renew.sh [base-domain-name]
# More info: http://do.co/1mbVihI
#================================================================
domain=$1
le_path='/opt/letsencrypt'
le_conf='/etc/letsencrypt'