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
function parse_git_branch() { | |
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
} | |
COLOR_DEF=$'\e[0m' | |
COLOR_USR=$'\e[38;5;243m' | |
COLOR_DIR=$'\e[38;5;197m' | |
COLOR_GIT=$'\e[38;5;39m' | |
setopt PROMPT_SUBST | |
export PROMPT='${COLOR_USR}%n ${COLOR_DIR}%~ ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF} $ ' |
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
#!/usr/bin/bash | |
# Clone | |
# Build | |
# Deploy | |
# Notes: | |
# # Save the shell script with a '.sh' extension |
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 linenumbers | |
set tabsize 4 | |
set autoindent | |
set tabstospaces |
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
# Usage: --filters "Name=string,Values=string,string..." | |
# Example using `tag` key-value pairs: | |
aws ec2 describe-instances --filters "Name=tag:<tag_name>,Values=<value1>,<value2>..." | |
# Example using `tag-key` name: | |
# Note: This only looks at the key name(s), not the value of the key(s). | |
aws ec2 describe-instances --filters "Name=tag-key,Values=<tag-key1>,<tag-key2>..." |
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 | |
# For CA certs. | |
curl -so /dev/null -w "%{http_code}" https://google.com/ | |
# For self-signed certs: | |
curl --insecure -so /dev/null -w "%{http_code}" https://somesite.com/ |
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
# Range of commits | |
# git revert --no-edit <first_bad_commit_hash>..<last_bad_commit_hash> | |
git revert --no-edit 1abeb478e11..e272b5a3680 | |
# Single commit | |
# git revert --no-edit <bad_commit_hash> | |
git refert --no-edit e272b5a3680 |
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
# The following will create an DST offset in the US. Obviously, if you're in an area that doesn't | |
# observe DST (Arizona, etc.), this doesn't apply. To tweak it for your specific TZ, change the last value to | |
# your UTC offset during the summer months. A chart is below. I threw this together pretty quick, | |
# so it may need a bit of tweaking. It's a modified version of the PromQL found on Medium, here: | |
# https://link.medium.com/vcfRGNuYv0 | |
# 4 - Eastern | |
# 5 - Central | |
# 6 - Mountain | |
# 7 - Pacific |
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
# Use root/example as user/password credentials | |
version: '3.1' | |
services: | |
mongo: | |
image: mongo | |
restart: always | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: root |
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
#Using Notepad as an example. | |
$target = "notepad" | |
#Get the process | |
$process = Get-Process -Name $target -ErrorAction SilentlyContinue | |
#Get the execution state of the thread. | |
$threads=$process.Threads | |
$threads | select Id,ThreadState,WaitReason |
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
/***** "Remote" server first *****/ | |
-- Note: Unless the object you are trying to gain access to is in the same DATABASE, it's a remote datebase. Even if it's | |
-- on the same node! | |
-- 1. create the role and assign it a password. Note: CREATE USER is an alias for CREATE ROLE. Either one is fine | |
CREATE ROLE new_user WITH PASSWORD 'somepassword'; | |
-- 2. Grant the required permissions. This grants select, insert, update, and delete on all tables in the public schema. | |
-- I also gave execute to all functions in the public schema as well. | |
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO new_user; | |
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO new_user; |
NewerOlder