Skip to content

Instantly share code, notes, and snippets.

View gMagicScott's full-sized avatar

Scott Lesovic gMagicScott

View GitHub Profile
@gMagicScott
gMagicScott / README.md
Created November 25, 2015 18:04
Ansible - remove unmanaged files from a directory

from this question on Stack Overflow

Set up a managed_files variable as an array

- hosts: whatever
  vars:
    managed_files:
     - file1
 - file2
@gMagicScott
gMagicScott / README.md
Last active March 23, 2021 09:56
Install CrashPlan for Linux without the hassle of all the interactive prompts. This uses all the defaults, except opening the GUI interface at the end.

CrashPlan Simple Install

CrashPlan is a great backup service allowing local, remote, and premium hosted backups. They even support Windows, Mac, and Linux.

While I can't speak to the install experience for Windows or Mac, on Linux, it's horrible.

It's an interactive install that doesn't take any flags to accept defaults. As a Ubuntu user, there is a new version every 6 months and to make the upgrade process easier, I bash script the installation of all my core programs so I can reformat and be back up an running with ease.

This bash script will download a recent version, untar it, and install it with all the defaults.

@gMagicScott
gMagicScott / caps-lock-remap.ahk
Created April 24, 2020 20:31
Using AutoHotKey, remap Caps Lock to be <Esc> when tapped (under 400ms), acts as <Ctrl> when used in combo shortcuts
*CapsLock::
Send {Blind}{Ctrl Down}
cDown := A_TickCount
Return
*CapsLock up::
If ((A_TickCount-cDown)<400) ; Modify press time as needed (milliseconds)
Send {Blind}{Ctrl Up}{Esc}
Else
Send {Blind}{Ctrl Up}
@gMagicScott
gMagicScott / vagrant-box-update-all.sh
Last active August 9, 2018 15:40 — forked from thom8/vagrant-box-update-all.sh
Update all your vagrant base boxes
#!/bin/bash
# Find all boxes which have updates
AVAILABLE_UPDATES=`vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2`
if [ ! ${#AVAILABLE_UPDATES[@]} -eq 0 ]; then
for box in $AVAILABLE_UPDATES ; do
echo "Found an update for $box"
@gMagicScott
gMagicScott / install-cgr.sh
Last active July 18, 2017 02:14
Migrate Composer Globals to CGR
#!/usr/bin/env bash
# Helper script to help migrate Composer (https://getcomposer.org/)
# global scripts to being managed by CGR (https://github.com/consolidation/cgr)
#
# Copyright (c) 2017 Scott Lesovic
# Released under the MIT License
# Sanity check Composer
which composer
<?php
//* Do NOT include the opening php tag
//* Add JS to allow elements to be faux anchors
add_action( 'wp_footer', 'bg_script_clickable' );
function bg_script_clickable() {
echo '<script type="text/javascript">jQuery(document).ready(function($){$(".content .entry").click(function(){window.open($("a",this).attr("href"), "_blank");});});</script>';
}
@gMagicScott
gMagicScott / gist:8107042
Last active January 1, 2016 06:49
Decoding PHP injection on WordPress files. **!! Do NOT run this code on your machine !!**
<?php
/**
* There are layers of protection to check a few things
* - Only run this code once
* - Only run when accessed by Google, MSN, or Yahoo!
*
* I removed those checks to make this more readable
*/
# Only *annotated* tags
git describe --exact-match HEAD
# All tags, including lightweight
git describe --exact-match --tags HEAD
#!/usr/bin/env bash
for remote in `git branch -r | grep -v master `; do git checkout --track $remote ; done
<?php
//* ======================
// Turn Developer Mode On
// ======================
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);