Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Bair njbair

View GitHub Profile
@njbair
njbair / bootstrap-sail.sh
Last active May 31, 2021
Install Laravel Sail into an existing project without PHP & Composer
View bootstrap-sail.sh
#!/bin/sh
# Installs Laravel Sail into an existing project
# The official Laravel Sail docs[1] provide instructions for installing Sail
# into an existing PHP application. But the official method requires invoking
# Composer locally. Part of Sail's appeal is that it removes the need to
# install PHP on your host machine.
# This script is lifted from laravel.build[2], and thus uses the same method
@njbair
njbair / add-composer-to-path.sh
Last active Apr 30, 2020
Unused Forge recipes
View add-composer-to-path.sh
# run this recipe as the user, not root.
if [ ! $( grep "\.config\/composer\/vendor\/bin" ~/.bashrc) ]; then
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
fi
@njbair
njbair / yourls-plugin-users-in-database.php
Created Feb 13, 2020
YOURLS Store Users in Database
View yourls-plugin-users-in-database.php
<?php
/*
Plugin Name: Users in Database
Plugin URI:
Description: Puts users in the database
Version: 1.0
Author: Nick Bair
Author URI: https://github.com/njbair
*/
@njbair
njbair / docker-compose.yml
Created Mar 14, 2019
WordPress, MySQL 5.7, Adminer for Local Dev
View docker-compose.yml
version: '3.1'
services:
wordpress:
image: wordpress
ports:
- 80:80
environment:
WORDPRESS_DB_HOST: db
@njbair
njbair / amd_A8-5600K_cpuids.sh
Last active Apr 4, 2019
Use these CPUID flags to trick your Windows 7 VirtualBox VM into thinking your AMD Ryzen is an AMD A8-5600K.
View amd_A8-5600K_cpuids.sh
#!/bin/sh
vboxmanage modifyvm "Windows 7" --cpuidset 00000000 0000000d 68747541 444d4163 69746e65
vboxmanage modifyvm "Windows 7" --cpuidset 00000001 00610f01 01040800 3e98320b 178bfbff
vboxmanage modifyvm "Windows 7" --cpuidset 00000002 00000000 00000000 00000000 00000000
vboxmanage modifyvm "Windows 7" --cpuidset 00000003 00000000 00000000 00000000 00000000
vboxmanage modifyvm "Windows 7" --cpuidset 00000004 00000000 00000000 00000000 00000000
vboxmanage modifyvm "Windows 7" --cpuidset 00000005 00000040 00000040 00000003 00000000
vboxmanage modifyvm "Windows 7" --cpuidset 00000006 00000000 00000000 00000001 00000000
vboxmanage modifyvm "Windows 7" --cpuidset 00000007 00000000 00000008 00000000 00000000
@njbair
njbair / HOWTO-debian-build-box.md
Last active Sep 11, 2015
Setting up a base Debian installation as a generic build environment
View HOWTO-debian-build-box.md

HOWTO: Debian Build Box

This is a quick how-to on setting up a fresh Debian installation as a multi-purpose build environment. By fresh installation, we're talking about a bare-bones netinst with all installation tasks unchecked. If you choose to install standard system utilities, many of these packages will already be installed.

First, login as a standard user, then issue the su command to elevate to root:

$ su
Password:

Install Some Software

@njbair
njbair / html-markup-shortcodes.php
Created Feb 21, 2015
Custom HTML WordPress Shortcode - add any HTML tag in the WYSIWYG editor!
View html-markup-shortcodes.php
/**
* HTML MARKUP SHORTCODES
* by Nick Bair
*
* This is a nice little cheater shortcode for devs who don't want the WordPress
* WYSIWYG editor to strip out their HTML tags.
*
*
*
* USAGE
@njbair
njbair / s3cachecontrol.py
Created Nov 29, 2013
Sets a Cache-Control HTTP header on all matching objects in an Amazon S3 bucket
View s3cachecontrol.py
#!/usr/bin/python
# Amazon S3 Cache-Control Processor
#
# Programmatically applies the specified Cache-Control metadata to all
# matching objects (files) in an S3 bucket
#
# Uses the excellent boto library <http://docs.pythonboto.org>