Skip to content

Instantly share code, notes, and snippets.

View brianwebb01's full-sized avatar

Brian Webb brianwebb01

View GitHub Profile
@brianwebb01
brianwebb01 / .bashrc
Last active June 4, 2020 17:00
.bashrc aliases
alias vg="vagrant"
alias phpd="sudo docker-compose exec app php"
alias composerd="sudo docker run --rm -v $(pwd):/app composer/composer"
alias gpn="git push --set-upstream origin $(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3)"
alias pu="rm storage/test.sqlite && cp storage/testForCopy.sqlite storage/test.sqlite && ./vendor/bin/phpunit"
alias pufresh="./bin/php-test --fresh && phpunit -d memory_limit=2048M"
alias mfs="find ./storage/app/public -type d -regex \".*/[0-9]*\" -print0 | xargs -0 rm -r && phpd artisan migrate:fresh --seed"
alias mfst="rm -f ./storage/test.sqlite && touch ./storage/test.sqlite && php artisan migrate --seed --env=testing && cp ./storage/test.sqlite ./storage/testForCopy.sqlite"
alias vp="./vendor/bin/vapor"
@brianwebb01
brianwebb01 / AppServiceProvider.php
Created August 14, 2019 18:05
Log full DB SQL in Laravel
<?php
//put this in app service provider
DB::listen(
function ($sql) {
// $sql is an object with the properties:
// sql: The query
// bindings: the sql query variables
// time: The execution time for the query
@brianwebb01
brianwebb01 / sms_msg_link.php
Last active August 12, 2019 19:01
How to make a link click open a native SMS message on android or ios
@brianwebb01
brianwebb01 / README.md
Created July 12, 2017 15:27
bash script to remove data from mysql databases to prep for seeding

Overview

This bash script will create a backup of all databases on the given mysql server with structure only (NO DATA). It will save that into a backup file, then restore to the same server dropping, then creating each databse from the backup schema. Effectivley this will remove all data from all databases on the mysql server while leaving all mysql system databases alone.

USAGE

Replace the quoted values of the variables YOUR_HOST, YOUR_USER, and YOUR_PASS with your connection

@brianwebb01
brianwebb01 / ipGeolocation.php
Created January 30, 2017 02:02
IP geolocation in PHP
<?php
$ip = "8.8.8.8";
$r = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
print_r($r);
/**************
stdClass Object
(
[ip] => 8.8.8.8
[hostname] => google-public-dns-a.google.com
@brianwebb01
brianwebb01 / README.MD
Last active December 3, 2016 18:48
Ottomatik dependencies configuration

Run the dependency installation script on your server with the following command:

curl -sSL https://gist.githubusercontent.com/brianwebb01/3757a485ce7b8bef60e7e75567caaeea/raw/b0755cbbb2d9543802f819ebdd435d86a27e4975/ottomatik_deps.sh | sudo bash
@brianwebb01
brianwebb01 / CVE-2016-6662.sql
Created September 29, 2016 16:24
MySQL CVE-2016-6662. Remove SUPER and FILE privileges from users that are in the results of the following query.
SELECT user, host FROM mysql.user WHERE Super_priv='Y' AND File_priv='Y' AND host NOT IN ('localhost','127.0.0.1', '::1');
@brianwebb01
brianwebb01 / main.py
Last active March 15, 2016 16:06
Python script to watch a Docker Cloud service for redeployment
#!/usr/bin/python
import dockercloud
import logging
import json
import signal
import sys
import os
# To use this script you'll need to set the following environment variables
@brianwebb01
brianwebb01 / get_mysql_db_size.sql
Created October 21, 2015 12:38
SQL to find how big mysql report the database data to be.
SELECT table_schema "YOUR_DB_NAME", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert