Skip to content

Instantly share code, notes, and snippets.

View acodeninja's full-sized avatar

Lawrence acodeninja

View GitHub Profile
@acodeninja
acodeninja / git-fix-author.sh
Created January 10, 2018 08:32
Rename author on all commits
#!/usr/bin/env bash
if [[ "$1" == "" ]] || [[ "$2" == "" ]] || [[ "$3" == "" ]]; then echo "Usage ./fix-git-author.sh \"old@email\" \"new@email\" \"New Name\""; exit 1; fi
git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "$1" ]; then
GIT_AUTHOR_EMAIL=$2;
GIT_AUTHOR_NAME="$3";
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all
@acodeninja
acodeninja / spacing-utils.css
Created April 14, 2018 11:16
Copy of the bs4 spacing utils
.m-0 {
margin: 0 !important;
}
.mt-0,
.my-0 {
margin-top: 0 !important;
}
@acodeninja
acodeninja / GenerateResponsiveImages.php
Created August 13, 2018 10:22
Generate responsive images for medialibrary post upgrade
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class GenerateResponsiveImages extends Command
{
/**
* The name and signature of the console command.
@acodeninja
acodeninja / switch-php-version.sh
Created August 18, 2018 18:51
A small script to switch php versions inside of homestead
VERSION=$1
if [ "$(which php${VERSION})" != "" ]; then
sudo update-alternatives --set php /usr/bin/php$VERSION
sudo update-alternatives --set phar /usr/bin/phar$VERSION
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$VERSION
sudo update-alternatives --set phpize /usr/bin/phpize$VERSION
sudo update-alternatives --set php-config /usr/bin/php-config$VERSION
echo "Switched to php$VERSION successfully"
else
@acodeninja
acodeninja / blog-deploy-playbook.yml
Created August 23, 2018 10:36
A playbook for deploying my jekyll based blog
---
- hosts: all
vars:
location: /var/www/acodeninja.github.io
tasks:
- name: get codebase
git:
repo: https://github.com/acodeninja/acodeninja.github.io.git
dest: "{{ location }}"
- name: ensure binary dependancies are installed

Keybase proof

I hereby claim:

  • I am acodeninja on github.
  • I am acodeninja (https://keybase.io/acodeninja) on keybase.
  • I have a public key ASCPh9WoWfYQ_4qlVPcDztJVEBsJC0ObOOKMRzWngzoumwo

To claim this, I am signing this object:

@acodeninja
acodeninja / Dockerfile
Last active January 29, 2019 16:13
Symfony Docker Composer Setup
FROM php:fpm-alpine
# Install XDebug
RUN apk add g++ gcc make autoconf && \
pecl install xdebug-2.6.1 && \
docker-php-ext-enable xdebug && \
apk del g++ gcc make autoconf
# Install MySQL driver
RUN docker-php-ext-install pdo_mysql
@acodeninja
acodeninja / Vagrantfile
Last active September 24, 2018 10:17
A drop in `Vagrantfile` for Symfony3
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.190.#{2 + rand(255)}"
config.vm.hostname = "symfony-app.test"
config.hostmanager.enabled = true
@acodeninja
acodeninja / sourcerer-repo-scan.sh
Created March 26, 2019 21:03
Add any repositories from the local directory (recursively) to sourcerer cli app
#!/usr/bin/env bash
echo "Scanning, this might take a while, especially if you have lots of vendor directories"
while read d; do
echo "Adding directory $d to sourcerer"
sourcerer add $d
done < $(find . -type d \
-exec sh -c 'cd "{}"; git rev-parse --git-dir 2> /dev/null 1>&2' \; \
-prune \
@acodeninja
acodeninja / tmp-image-cleanup.sh
Created April 12, 2019 09:49
Clean out temporary image files from a directory of your choosing.
#!/usr/bin/env bash
FILE_AGE=$1
FILE_COUNT=$2
FILE_LOCATION=$3
if [ -z "$FILE_AGE" ] || [ -z "$FILE_COUNT" ] || [ -z "$FILE_LOCATION" ]; then
echo "Usage: $(basename $0) [file age in days] [file count] [directory location]"
exit 1
fi