Skip to content

Instantly share code, notes, and snippets.

View rydurham's full-sized avatar

Ryan Durham rydurham

View GitHub Profile
@rydurham
rydurham / git.sh
Created January 18, 2024 17:08
Purge Git Branches
list_all_branches() {
for k in `git branch -a | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r
}
git_purge() {
# have any arguments been passed?
if [ $# -gt 0 ];then
BRANCH=$1
echo $BRANCH
@rydurham
rydurham / git-purge.sh
Created December 21, 2023 16:56
Git - Purge Old Branches
# https://stevenharman.net/git-clean-delete-already-merged-branches
git_purge() {
# have any arguments been passed?
if [ $# -gt 0 ];then
BRANCH=$1
echo $BRANCH
git checkout $BRANCH
git branch --merged $BRANCH | grep -v "\* $BRANCH" | xargs -n 1 git branch -d
@rydurham
rydurham / alias.sh
Last active April 20, 2023 16:07
Local Docker Ops Helper Example
# Put this in your .bashrc file (or wherever you register aliases)
# Modify the path to point to your local dockerfile; you must use an absolute path
# The name of the function can be changed to suit your local setup
eoa_ops() {
cd /home/ryan/Workbench/firebrand/eoa
./ops.sh ${*:-ps}
cd $OLDPWD
}
alias eoa=eoa_ops
@rydurham
rydurham / provisioning.sh
Last active February 9, 2021 16:38
Ubuntu Provisioning
# /home partition
# https://help.ubuntu.com/community/Partitioning/Home/Moving
# Basics
sudo apt update
sudo apt install curl vim git libpng-dev
sudo apt remove apache2
# Remove snapd
# https://askubuntu.com/questions/1035915/how-to-remove-snap-store-from-ubuntu
@rydurham
rydurham / deployment.sh
Last active December 18, 2020 18:08
Forge Deployment Script for Elixir Applications
cd /home/forge/www.example.com
# Fetch the latest version of the code
git pull origin deploy
# Ensure we have access to mix
if ! [ -x "$(command -v mix)" ]; then
echo 'Error: Elixir is not installed.' >&2
exit 1
fi
@rydurham
rydurham / Model.php
Last active August 11, 2020 18:43
Eloquent Model Stub
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The table associated with the model.
@rydurham
rydurham / print_array.php
Last active May 28, 2020 18:57
Print a PHP array so that it can be copied into source code
<?
foreach($this->parser->getRecords() as $ref => $record) {
echo "'{$ref}' => [\n";
foreach($record as $key => $value) {
if (is_float($value)) {
echo " '{$key}' => {$value},\n";
} else {
echo " '{$key}' => '{$value}',\n";
@rydurham
rydurham / part1.exs
Created December 13, 2019 23:00
Advent Day 8 - Part 1 - WIP
defmodule Day8 do
@input "22022222022220021222222102222222222222222202012220222121222012222212222122222222222222222222202222222221222220222222222212220222222222221222200222222222222222222222022222222122222222222222222212002220222021222222222202222222222222222222222222212222222222222222222222222202221222222222220222202222222222012222022222021222222202222222222222222212012221222221222202222202222222222222222222222222212222222222222221222222222202222222222222222222200222222222112222122220220222222022222222222222222202212221222122222202222202222122222222222222222222212222222222222220222222222212222222222222220222202222222222222222122221020222222202222222222222222222212222222121222202222222222122222222222222222222212222222220222220222222222202222222222222221222211222222222212222122221020222222212222222222222222210122222222220222012222202222222222222220222222222202222222221222220222222222222220222222222222222222222222222012222122221020222222122222222022222222211012220222020222202222222222122222222221222222222202
@rydurham
rydurham / gist:1fd7ac4154e6a18865fd
Last active September 4, 2019 07:45
Installing Gulp on Homestead
Via http://christoph-rumpel.com/2014/02/how-to-laravel-series-lets-talk-gulp/
$ node -v
v0.10.28
$ npm -v
1.4.24
@rydurham
rydurham / Gemfile
Created August 11, 2019 20:24
Rake with AWS Glacier
source 'https://rubygems.org'
gem 'aws-sdk', '3.0.1'
gem 'irb', '1.0.0'
gem 'rake', '12.3.1'
gem 'tilt', '2.0.8'