This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# split_ver | |
# Description: | |
# splits a version number ($1) into three numbers delimited by a space | |
# | |
# Notes: | |
# Assumes the format of the version number will be: | |
# <any # of digits>.<any # of digits>.<any # of digits> | |
# | |
# Usage: | |
# split_ver 6.31.140 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# change-pma-passwords.sh | |
# | |
# Description: | |
# changes passwords for phpmyadmin from the defaults in version control to the values set in .starter.env | |
# Author: Apolo Pena | |
# | |
# NOTE: | |
# This script should be always run at least once by the user as an mandatory additional layer of security |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get_env_value | |
# Description: | |
# Get the value of a key ($1) value pair as set in a env style file ($2) | |
# If no file ($2) argument is given then the file .starter.env will be used | |
# | |
# Exit codes: | |
# 3 --> File ($2 or the default .starter.env) does not exist | |
# 4 --> Variable ($1) does not exist in file ($2 or the default .starter.env) | |
# 5 --> Value for the variable ($2) was not set or contained only whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creates a new project from a branch of the repo https://github.com/apolopena/gitpod-laravel8-starter | |
# Assumes that you already have a blank repo created for this new project in your github account | |
# Assumes that you want to use https instead of ssh | |
# $1: new repo name to clone into and push to remote (the default branch will be called main) | |
# $2: GitHub username | |
# new repo name must match the name of the blank repo you have created in github for this project. | |
__new_repo_project_name="$1"; __github_username="$2"; mkdir "$__new_repo_project_name" && cd "$__new_repo_project_name" && git clone https://github.com/apolopena/gitpod-laravel8-starter.git . && rm -rf .git && git init && git add -A && git commit -m "initial commit built from https://github.com/apolopena/gitpod-laravel8-starter" && git remote add origin "https://github.com/$__github_username/$__new_repo_project_name.git" && git branch -m main && git push -u origin main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creates a new project from a branch of the repo https://github.com/apolopena/gitpod-laravel8-starter | |
# Assumes that you already have a blank repo for this project created in your github account | |
# Assumes that you want to use https instead of ssh | |
# $1: branch name to clone from | |
# $2: new repo name to clone into and push to remote (the default branch will be called main) | |
# new repo name must match the name of the blank repo you have created in github for this project. | |
# $3: GitHub username | |
__branch="$1"; __new_repo_project_name="$2"; __github_username="$3"; mkdir "$__new_repo_project_name" && cd "$__new_repo_project_name" && git clone https://github.com/apolopena/gitpod-laravel8-starter.git -b "$__branch" --single-branch . && rm -rf .git && git init && git add -A && git commit -m "initial commit built from the $__branch branch of https://github.com/apolopena/gitpod-laravel8-starter" && git remote add origin "https://github.com/$__github_username/$__new_repo_project_name.git" && git branch -m main && git pu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scenario: | |
# When deleting a tag or a branch both have the same name v0.0.1a will result in the error: | |
# "dst refspec v0.0.1a matches more than one" | |
# Here is how to delete the branch | |
git push origin :heads/v0.0.1a | |
# Here is how to delete the tag | |
git push origin :tags/v0.0.1a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @See https://git-scm.com/book/en/v2/Git-Basics-Tagging | |
# Offical docs @see https://git-scm.com/docs/git-tag | |
# Output a list of all tags | |
git tag | |
# Create a local (annotated) tag for the last commit where v1.4 is the tag name and "ver 1.4 stable" is the tag description | |
git tag -a v1.4 -m "ver 1.4 stable" | |
# Create local (annotated) tag from a previous commit where 9fceb02 is the checksum for that commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert line breaks to newline characters | |
$ awk -v ORS='\\n' '1' file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set environment vars from an .env file | |
export $(grep -v '^#' .myenvfile | xargs) | |
# unset environment vars from an .env file | |
unset $(grep -v '^#' .myenvfile | awk 'BEGIN { FS = "=" } ; { print $1 }') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #1 Easy to read? | |
const colorStrings = (palette = pastelOne, c = chalk) => { | |
let r = {} | |
for (const key in palette) { | |
r[key] = c.hex(palette[key]) | |
} | |
return r | |
} | |
// #2 Easier to read? |