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 / 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 / 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 / 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'
{
"key": "ctrl+alt+w",
"command": "workbench.action.closeAllEditors"
},
{
"key": "ctrl+alt+q",
"command": "workbench.files.action.collapseExplorerFolders"
},
{
"key": "ctrl+shift+t",
@rydurham
rydurham / .php_cs
Last active May 1, 2019 02:47
Laravel PHP CS config
<?php
$finder = Symfony\Component\Finder\Finder::create()
->exclude('vendor')
->exclude('bootstrap')
->exclude('storage')
->in(__DIR__)
->name('*.php')
->notName('*.blade.php');
@rydurham
rydurham / .bashrc
Last active April 15, 2019 21:31
bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac