Skip to content

Instantly share code, notes, and snippets.

View nrrb's full-sized avatar
:shipit:
Learning

Nicholas Bennett nrrb

:shipit:
Learning
View GitHub Profile
@rnagle
rnagle / ipinfo
Created August 29, 2014 16:47
A command line interface for the services provided by http://ipinfo.io
#!/bin/bash
function print_help() {
echo "A command line interface for the services provided by http://ipinfo.io
Example usage:
ipinfo [ADDRESS] [ip | hostname | loc | org | city | region | country | phone | geo]
ipinfo 8.8.8.8 geo
{ "ip": "8.8.8.8", "city": null, "region": null, "country": "US", "loc": "38.0000,-97.0000" }
@A
A / byobu-cheatsheet.md
Last active August 29, 2015 14:09
byobu window manager cheatsheet http://byobu.co/
  • F2 Create a new window
  • F3 Move to the previous window
  • F4 Move to the next window
  • F5 Refresh all status notifications
  • F6 Detach from the session and logout
  • Shift-F6 Detach from the session, but do not logout
  • F7 Enter scrollback/search mode
  • F8 Rename the current window
  • F9 Launch the Byobu Configuration Menu
  • F12 GNU Screen's Escape Key
@wildekek
wildekek / README.md
Last active December 8, 2017 15:55
Memegenerator dashing job
@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);
@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:

@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
@narirou
narirou / easings.js
Last active June 25, 2025 21:21
Cubic-Bezier Easing Collections for Velocity.js
module.exports = {
easeIn: 'ease-in',
easeOut: 'ease-out',
easeInOut: 'ease-in-out',
snap: [0.000, 1.000, 0.500, 1.000],
linear: [0.250, 0.250, 0.750, 0.750],
easeInQuad: [0.550, 0.085, 0.680, 0.530],
easeInCubic: [0.550, 0.055, 0.675, 0.190],
easeInQuart: [0.895, 0.030, 0.685, 0.220],
easeInQuint: [0.755, 0.050, 0.855, 0.060],
@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);
@chrismdp
chrismdp / s3.sh
Last active January 23, 2025 09:26
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
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active June 12, 2025 15:08
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