Skip to content

Instantly share code, notes, and snippets.

View codebymikey's full-sized avatar

codebymikey codebymikey

View GitHub Profile
@codebymikey
codebymikey / AADecoder.java
Last active October 12, 2018 07:44
AADecoder for javascript that has been obsfucated using `AAEncode`
package com.codebymikey;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Adapted from:
* https://github.com/madushan1000/jdtrunk/blob/00b2e9b3b18124ed39ece74b24afe6f08007b23f/src/org/jdownloader/encoding/AADecoder.java
*/
@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'
@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 / rsync.sh
Created April 23, 2018 20:22 — forked from macmladen/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 / generate-computed-styles.js
Created June 28, 2019 09:32
Generate computed css styles for all browsers. Puts the output into a textarea on the page (so it can be easily copied).
// Generate computed styles to compare differences between two
function generateComputedStyles(selector, pseudoEl) {
// https://stackoverflow.com/a/26878397
var styles = [], css, el = document.querySelector(selector);
if (el) {
var computedStyle = window.getComputedStyle(el, pseudoEl);
for (var i = computedStyle.length; i--;) {
var propertyName = computedStyle[i];
var propertyValue = computedStyle.getPropertyValue(propertyName);
if (!propertyValue) {
@codebymikey
codebymikey / drupal-8-log-queries.patch
Last active November 10, 2021 11:34
Drupal 8 log queries
Index: core/lib/Drupal/Core/Database/Query/Select.php
Description: Log RAW SELECT queries in Drupal 9.
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php
--- a//core/lib/Drupal/Core/Database/Query/Select.php
+++ b//core/lib/Drupal/Core/Database/Query/Select.php (date 1636458764911)
@@ -509,7 +509,33 @@
@codebymikey
codebymikey / autocomplete.sh
Created September 20, 2019 13:51
Ansible autocomplete
sudo curl -L -o /etc/bash_completion.d/ansible-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-completion.bash
sudo curl -L -o /etc/bash_completion.d/ansible-doc-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-doc-completion.bash
sudo curl -L -o /etc/bash_completion.d/ansible-galaxy-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-galaxy-completion.bash
sudo curl -L -o /etc/bash_completion.d/ansible-playbook-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-playbook-completion.bash
sudo curl -L -o /etc/bash_completion.d/ansible-pull-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-pull-completion.bash
sudo curl -L -o /etc/bash_completion.d/ansible-vault-completion.bash https://raw.githubusercontent.com/dysosmus/ansible-completion/master/ansible-vault-completion.bash
export ANSIBLE_COMPLETION
@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 / wsl-notify.sh
Created May 13, 2020 19:01
(wsl-notify) WSL notify-send shim.
#!/usr/bin/env bash
# Inspiration: https://codelearn.me/2019/01/13/wsl-windows-toast.html
# Shim https://ss64.com/bash/notify-send.html for WSL.
# Just add an alias for it:
# alias notify-send='wsl-notify'
POSITIONAL=()
urgency='terminal'
wget -nv -q https://github.com/mglaman/drupalorg-cli/releases/latest/download/drupalorg.phar && \
chmod +x drupalorg.phar && sudo mv drupalorg.phar /usr/local/bin/drupalorg