Skip to content

Instantly share code, notes, and snippets.

View njbair's full-sized avatar

Nick Bair njbair

View GitHub Profile
@njbair
njbair / Dockerfile
Created September 16, 2022 18:18
Docker PHP Template
###############################
# ./docker/php/Dockerfile #
###############################
FROM php:8.1-apache
# update packages
RUN apt-get clean
RUN apt-get update
@njbair
njbair / bootstrap-sail.sh
Last active April 10, 2024 14:32
Install Laravel Sail into an existing project without PHP & Composer
#!/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 April 30, 2020 15:51
Unused Forge recipes
# 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 February 13, 2020 16:15
YOURLS Store Users in Database
<?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 March 14, 2019 01:13
WordPress, MySQL 5.7, Adminer for Local Dev
version: '3.1'
services:
wordpress:
image: wordpress
ports:
- 80:80
environment:
WORDPRESS_DB_HOST: db
@njbair
njbair / fluent-design-calendar-ui.markdown
Created April 11, 2018 01:21
Fluent Design Calendar UI
@njbair
njbair / amd_A8-5600K_cpuids.sh
Last active April 4, 2019 23:29
Use these CPUID flags to trick your Windows 7 VirtualBox VM into thinking your AMD Ryzen is an AMD A8-5600K.
#!/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 September 11, 2015 18:22
Setting up a base Debian installation as a generic build environment

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 February 21, 2015 04:38
Custom HTML WordPress Shortcode - add any HTML tag in the WYSIWYG editor!
/**
* 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 November 29, 2013 19:27
Sets a Cache-Control HTTP header on all matching objects in an Amazon S3 bucket
#!/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>