Skip to content

Instantly share code, notes, and snippets.

View lovingawareness's full-sized avatar

Nicholas Bennett lovingawareness

  • Chicago, IL
View GitHub Profile
Ugotsta /
Last active December 22, 2022 05:28
The ultimate cheatsheet for Amazon Alexa. See
bmarkwalder /
Created May 12, 2017 17:55
Decide if a Sudoku solution is valid or not.
import java.util.HashMap;
* Created by Brandon Markwalder on 5/11/2017.
* Write a function done_or_not passing a board (list[list_lines]) as parameter.
* If the board is valid return 'Finished!', otherwise return 'Try again!'
* Sudoku rules:
scottopell /
Last active September 27, 2023 12:26
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
noelboss /
Last active September 21, 2023 17:37
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like or and pull or export it to a production server. Or you use a service like to act upon a Web-Hook that's triggered that service.

JeffBelback /
Last active September 2, 2022 16:23
Destroy all Docker Containers and Images
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
chrismdp /
Last active July 27, 2023 02:35
Uploading to S3 in 18 lines of Shell (used to upload builds for
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
rnagle / delete_blog_users.sql
Last active August 29, 2015 14:18
Prepare a standalone WP blog for migration to multisite install
View delete_blog_users.sql
-- This SQL file will remove all users for a specific blog from the network tables (`wp_users` and `wp_usermeta`)
-- Set the value of `@newBlogID` to the ID of the blog for which you want to remove all users.
-- Useful for reimporting content and users/rerunning a migration.
@newBlogID = TKTK;
CREATE TEMPORARY TABLE IF NOT EXISTS temp_user_ids SELECT user_id as ID FROM wp_usermeta WHERE meta_key = CONCAT('wp_', @newBlogID, '_capabilities');
DELETE FROM wp_users WHERE ID in (SELECT ID from temp_user_ids);
DELETE FROM wp_usermeta WHERE user_id in (SELECT ID from temp_user_ids);
benlk /
Last active September 9, 2018 03:52
For when you need to rebuild curl
# copied from
mkdir /tmp/curl
cd /tmp/curl
sudo apt-get update
sudo apt-get install build-essential debhelper libssh2-1-dev
apt-get source curl
sudo apt-get build-dep curl
cd curl-*
benlk /
Last active August 29, 2015 14:13
Accessing multisite WordPress from a database dump on Vagrant.


  • A WordPress multisite database loaded on your Vagrant box, accessible at with the IP address (See your Vagrantfile and /etc/hosts)
  • WordPress already installed and configured on your Vagrant box
  • WP-CLI installed on your Vagrant box
  • The main site of your network is and the project site is
  • If you do not possess admin credentials for the network, we will create a new admin, whose username is admin and whose password is password.
  • If you want to be able to undo this, run vagrant plugin install vagrant-vbox-snapshot from the Vagrant host. To take a snapshot, run vagrant snapshot take default [optional-name-for-snapshot]. Take one before starting, and then at the start of every major section here.

Getting multisite set up:

davetannenbaum / Qualtrics JS.js
Last active December 12, 2017 05:36
Javascript Qualtrics code to pass previous response to a textbox
View Qualtrics JS.js
/* Removes 0s from Text Boxes */
var inputs = $(this.questionContainer).select('input');
inputs.each(function(el) {if (el.value == 0) el.value='';});
/* Creating variable to pass previous response to text fields */
var selectedChoice = "${q://QID5/ChoiceNumericEntryValue/1}";
var selectedChoice = parseInt(selectedChoice);