Skip to content

Instantly share code, notes, and snippets.

View StuMason's full-sized avatar
🏋️‍♂️
Testing

Stu Mason StuMason

🏋️‍♂️
Testing
  • Folkestone
View GitHub Profile
#!/bin/bash
# Create a NGINX file, index.php and mysql DB for $DOMAIN passed in first argument e.g
# sudo bash create.sh domain.co.uk
# needs /root/.my.conf set up with [client] root user and password to create DB
# needs certbot installed to do certbot
DOMAIN=$1
cp /etc/nginx/sites-available/basic /etc/nginx/sites-available/${DOMAIN}
sed -i "s/:domain/${DOMAIN}/g" /etc/nginx/sites-available/${DOMAIN}
ln -s /etc/nginx/sites-available/${DOMAIN} /etc/nginx/sites-enabled/${DOMAIN}
@StuMason
StuMason / basic_nginx_template
Last active June 1, 2018 10:17
/etc/nginx/sites-available/basic
# replace all mentions of :domain with your domain with the following command:
# sed -i "s/:domain/${DOMAIN}/g" /etc/nginx/sites-available/${DOMAIN}
server {
root /var/www/:domain/public;
index index.php index.html index.htm;
server_name :domain www.:domain;
location / {
try_files $uri $uri/ /index.php?args;
}
@StuMason
StuMason / remove.sh
Created June 1, 2018 10:21
remove.sh
#!/bin/bash
# tars then deletes the NGINX file, /var/www/directory and mysql DB for $DOMAIN passed in first argument e.g
# sudo bash remove.sh domain.co.uk
# needs /root/.my.conf set up with [client] root user and password to create DB
# MAKESURE /root/backup/ exists before running this, haha.
DOMAIN=$1
mysqldump ${DOMAIN//[^a-zA-Z_-]/_} > /root/backup/${DOMAIN}/db/${DOMAIN//[^a-zA-Z_-]/_}
@StuMason
StuMason / pre-commit
Last active May 29, 2019 11:09
dd(), console.log and php-cs-fixer .git pre-commit
#!/bin/bash
# This file is stored here: ~/.githooks/pre-commit
# Makesure the file is executable: chmod +x ~/.githooks/pre-commit
# Needs: git config --global core.hooksPath ~/.githooks
# Needs phpcbf installed (this command installs globally): composer global require squizlabs/php_codesniffer
# Redirect output to stderr and allow user input
exec 1>&2
exec < /dev/tty
@StuMason
StuMason / database.php
Created July 20, 2018 13:29 — forked from andyfleming/database.php
Database config for laravel/lumen
<?php
return [
'default' => 'accounts',
'migrations' => 'migrations',
'connections' => [
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi
# remove unused volumes:
docker volume ls -qf dangling=true | xargs docker volume rm
@StuMason
StuMason / .zshrc
Last active August 17, 2018 13:36
s/__NAME__/stuart
# Path to your oh-my-zsh installation.
export ZSH=/Users/__NAME__/.oh-my-zsh
export XDEBUG_CONFIG="idekey=VSCODE"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"
# Uncomment the following line if you want to change the command execution time
@StuMason
StuMason / AwsV4SignedRequestTrait.php
Last active October 12, 2018 10:26
AWS V4 Signature Request Trait - requires AWS-PHP-SDK. Below example used in a Laravel app. Returns a signed request.
<?php
namespace App\Traits;
use Psr\Http\Message\RequestInterface;
use Aws\Signature\SignatureV4;
use Aws\Credentials\CredentialProvider;
use Aws\Credentials\CredentialsInterface;
/**

Keybase proof

I hereby claim:

  • I am stumason on github.
  • I am stuissecure (https://keybase.io/stuissecure) on keybase.
  • I have a public key ASCSc6RXYvbgdOBz7fDVphqCNdn6hmnqsonQChQI0Ls-9Qo

To claim this, I am signing this object:

@StuMason
StuMason / History|2ade281f|563H.json
Last active October 31, 2022 14:32
Visual Studio Code Settings Sync Gist
{
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,