Skip to content

Instantly share code, notes, and snippets.

View AustinWinstanley's full-sized avatar

AustinWinstanley

View GitHub Profile
@AustinWinstanley
AustinWinstanley / install-glassfish-4-1.sh
Created April 5, 2017 02:56
Install Glassfish 4.1 Script #Java #Glassfish
#! /bin/sh
GLASSFISH_PATH=/opt/glassfish
# Install Dependencies
add-apt-repository -y ppa:webupd8team/java
apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get install oracle-java8-installer
apt-get install unzip
@AustinWinstanley
AustinWinstanley / list-ms-sql-table-sizes.sql
Created April 5, 2017 02:54
List Table Sizes #MicrosoftSQL
-- Script to analyze table space usage using the
-- output from the sp_spaceused stored procedure
-- Works with SQL 7.0, 2000, and 2005
set nocount on
print 'Show Size, Space Used, Unused Space, Type, and Name of all database files'
select
[FileSizeMB] =
@AustinWinstanley
AustinWinstanley / var-dump-to-error-log.php
Created April 5, 2017 02:53
Var dump to error log #PHP
$x = "My string";
ob_start();
var_dump( $x );
$contents = ob_get_contents();
ob_end_clean();
@AustinWinstanley
AustinWinstanley / create-mysql-database-with-user.sql
Last active October 25, 2024 11:52
Create database with user #MySql
CREATE DATABASE _DATABASE_;
GRANT ALL PRIVILEGES ON _DATABASE_.* TO _USER_@localhost IDENTIFIED BY '_PASSWORD_';
FLUSH PRIVILEGES;
@AustinWinstanley
AustinWinstanley / create-empty-git-branch.sh
Last active April 5, 2017 03:03
Create Empty Branch #Git
#!/bin/bash
git checkout --orphan NEWBRANCH
git rm -rf .
@AustinWinstanley
AustinWinstanley / replace-master-branch.sh
Last active April 5, 2017 02:50
Replace master branch with other branch #Git
#!/bin/bash
git checkout NEWBRANCH
git merge -s ours master
git checkout master
git merge NEWBRANCH
/**
* Redirect wp-login.php to custom login page.
*/
function custom_login(){
global $pagenow;
if( 'wp-login.php' === $pagenow ) {
$site_url = get_bloginfo( 'url' );
$redirect_to = "$site_url/login";
@AustinWinstanley
AustinWinstanley / wp-cli-windows-install.bat
Last active July 8, 2017 03:03
WP-CLI Install in Windows #WordPress
mkdir C:\bin
C:\bin
composer create-project wp-cli/wp-cli --no-dev
# Copy wp-cli\bin to path
@AustinWinstanley
AustinWinstanley / is-base64-string.php
Last active April 1, 2017 22:42
Is Base64 String #PHP
if (false === base64_decode($str, true)) {
echo 'Not a Base64-encoded string';
}
@AustinWinstanley
AustinWinstanley / mysql-more-random-uuid.sql
Last active April 1, 2017 22:42
More random UUID #MySql
(SELECT INSERT(INSERT(INSERT(INSERT(MD5(UUID()), 9, 0, '-'), 14, 0, '-'), 19, 0, '-'), 24, 0, '-'))