Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Carman carmanchris31

  • McGraw-Hill Education
  • United States
View GitHub Profile
View typedContainer.ts
// Inspired by https://medium.com/@magnusjt/ioc-container-in-nodejs-e7aea8a89600
class UserModel {
isUser(): boolean {
return true
}
}
class UserService {
constructor(private model: UserModel) {}
@carmanchris31
carmanchris31 / undelete-s3.sh
Last active January 28, 2021 21:00
Undelete S3 files in bulk
View undelete-s3.sh
#!/bin/bash
#
# Undeletes S3 files in bulk for a provided bucket/prefix/date deleted
#
# Author: Christopher Carman
# Based on https://stackoverflow.com/a/64352685/4175944
set -e
Bucket=$1
@carmanchris31
carmanchris31 / settings.json
Last active August 30, 2019 20:34
Recommended VSCode Settings
View settings.json
{
"editor.renderControlCharacters": true,
"editor.renderLineHighlight": "all",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/*.bundle.js": true,
},
@carmanchris31
carmanchris31 / .gitconfig
Last active May 20, 2019 18:44
Git base config
View .gitconfig
[alias]
fix-head = remote set-head origin --auto
[core]
excludesfile = ~/.gitignore_global
[fetch]
prune = true
[rebase]
autosquash = true
@carmanchris31
carmanchris31 / git-clean.zsh
Last active March 24, 2021 02:20
Git Utility (ZSH) - Clean merged branches
View git-clean.zsh
# Git Helper: Clean merged branches
# Checks for merged branches against the currently checkout branch. Lists and confirms for deletion.
# To protect branches from ever being deleted, add them to DO_NOT_DELETE. Protected branches will be skipped.
# usage: git-clean
function git-clean() {
local DO_NOT_DELETE=(
master
develop
)
local mergedBranches=()
@carmanchris31
carmanchris31 / qgit.sh
Last active December 2, 2016 00:52
Git Branch Helpers (ZSH)
View qgit.sh
# Git Helper: Search branch
# usage: qbranch keyword
# Example: git checkout $(qbranch branch-keyword)
# If keyword not
function qbranch() {
if [ -z "$1" ]; then
branches=`git branch`
else
branches=`git branch | grep $1`
fi
@carmanchris31
carmanchris31 / zsh-helper-docker-exec-snippet.sh
Last active November 17, 2016 21:20
Docker Helper: Exec into container using part of container name
View zsh-helper-docker-exec-snippet.sh
# Docker Helper: Exec into container using part of container name
# usage: docker-exec {keyword} {command}
# If keyword not specified, prompts with current containers
# If command not specified, prompts with default of bash
function docker-exec() {
if [ -z "$1" ]; then
echo "Select a container: ('q' to cancel)"
containers=`docker ps --format '{{.Names}}'`
select d in `echo $containers`
do
@carmanchris31
carmanchris31 / zsh-helper-git-quick-checkout-snippet.sh
Last active November 17, 2016 21:21
Git Helper: Quickly checkout branch using part of name
View zsh-helper-git-quick-checkout-snippet.sh
# Git Helper: Quickly checkout branch using part of name
# usage: qcheckout keyword
# If keyword not
function qcheckout() {
if [ -z "$1" ]; then
branches=`git branch`
else
branches=`git branch | grep $1`
fi