Skip to content

Instantly share code, notes, and snippets.

@lbland94
lbland94 / perfect-circle.sh
Created February 15, 2024 20:15
Basic premise to draw a perfect circle via bash
#!/bin/bash
# Requires xdotool
# cx and cy are the center coordinates around which the circle will be drawn
# r is the radius of the circle
# time is how long the circle will take to draw
# steps is how many steps the circle will be drawn in
r=400
cx=$(echo "2560 + 1920 / 2 + 0.2" | bc -l)
cy="578.5"
function incrementInt(num) {
switch(+num) {
case 0:
return [1, 0];
case 1:
return [2, 0];
case 2:
return [3, 0];
case 3:
return [4, 0];
@lbland94
lbland94 / git_osx_setup.md
Last active July 10, 2020 14:55
Git OSX Setup Steps

Git OSX Setup Steps

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
@lbland94
lbland94 / README.md
Last active December 14, 2018 16:52
A few bash helper functions for development to facilitate running commands across multiple projects. Include in ~/.bashrc .

Example usage:

proj start aem ui pds

  • This will run the start scripts for the aem, ui, and pds projects.

proj checkout develop aem ui pds

  • Checks out the develop branch in the specified projects.

proj checkout -b feature/new-branch aem ui pds

  • Checks out or creates feature/new-branch on the specified projects
@lbland94
lbland94 / git-tag-npm-version.sh
Last active November 16, 2018 23:05
Program to add git tags based on changes to npm package.json version
#!/bin/bash
pattern=:V:
test=0
confirm=0
function print_help() {
echo ""
echo "Usage: git-tag-npm-version <arguments>"
echo ""
@lbland94
lbland94 / aem-server
Last active September 14, 2020 21:06
Scripts to make launching AEM server easier.
#!/bin/bash
## Ensure that java 8 is being used
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
export PATH=$JAVA_HOME/bin:$PATH
function timeout() {
perl -e 'alarm shift; exec @ARGV' "$@"
}
@lbland94
lbland94 / gitf
Created April 14, 2018 04:22
Git tool to search for a branch. If one match for the string it checks out the branch. If more than one, it lists them.
#!/usr/local/bin/bash
str="/$*/"
str=$(echo "$str" | sed 's/ /\/ \&\& \//g')
str="print if $str"
res=$(git branch --all | perl -ne "$str")
res=$(echo $res | tr ' ' '\n' | cut -d/ -f3-)
matches=$(echo $res | tr ' ' '\n' | uniq -u | wc -l)
if (( $matches == 1 )); then
git checkout "$res"
@lbland94
lbland94 / giftool
Created March 24, 2018 01:20
A program to wrap ffmpeg specifically for usage with gifs. Allows speed manipulation and time clipping.
#!/bin/bash
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-b|--begin|-ss)
START="$2"