Skip to content

Instantly share code, notes, and snippets.

View nrrb's full-sized avatar
🤔

Nicholas Bennett nrrb

🤔
View GitHub Profile
@R3V1Z3
R3V1Z3 / alexa-cheats.md
Last active November 8, 2023 23:29
The ultimate cheatsheet for Amazon Alexa. See https://ugotsta.github.io/alexa-cheats/

Alexa Cheats

Commands, questions and easter eggs for Amazon Alexa enabled devices: https://ugotsta.github.io/alexa-cheats/

General

  • "Alexa, stop."
  • "Alexa, volume one/six/ten."
  • "Alexa, turn up/down the bass/treble."
  • "Alexa, mute."
  • "Alexa, unmute."
  • "Alexa, repeat."
@bmarkwalder
bmarkwalder / SudokuChecker.java
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:
*
* ROWS:
@scottopell
scottopell / fix_exfat_drive.md
Last active May 17, 2024 16:32
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
noelboss / git-deployment.md
Last active May 16, 2024 20:41
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 github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active December 12, 2023 17:47
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# 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 (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@rnagle
rnagle / delete_blog_users.sql
Last active August 29, 2015 14:18
Prepare a standalone WP blog for migration to multisite install
-- 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;
DROP TEMPORARY TABLE IF EXISTS temp_user_ids;
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
benlk / curl-with-sftp.sh
Last active September 9, 2018 03:52
For when you need to rebuild curl
#!/bin/sh
# copied from http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
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-*
dpkg-buildpackage
@benlk
benlk / multisite-on-vagrant.md
Last active August 29, 2015 14:13
Accessing multisite WordPress from a database dump on Vagrant.

Assumptions:

  • A WordPress multisite database loaded on your Vagrant box, accessible at vagrant.dev with the IP address 192.168.33.10 (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 network.org and the project site is project.org
  • 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
davetannenbaum / Qualtrics JS.js
Last active December 12, 2017 05:36
Javascript Qualtrics code to pass previous response to a textbox
Qualtrics.SurveyEngine.addOnload(function()
{
/* 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);