This is a general-purpose function to ask Yes/No questions in Bash, either with or without a default answer. It keeps repeating the question until it gets a valid answer.
This file contains hidden or 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
| # To use github actions from a private repo, you can clone the action's private repo locally in the workflow and execute it. | |
| # Below is an example workflow for reference! :) | |
| name: Private Action X | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| - release |
This file contains hidden or 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 | |
| set -u -o pipefail | |
| WORKSPACE_DIR=".github-workspace-for-merging-pr" | |
| # export file with list of PRs | |
| LIST_OF_PR_FILE=${LIST_OF_PR_FILE:-"list-of-prs"} | |
| mkdir -p ${WORKSPACE_DIR} |
This file contains hidden or 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
| $ git filter-branch -f --env-filter "GIT_AUTHOR_NAME='<new_username>'; GIT_AUTHOR_EMAIL='<new_email>'; GIT_COMMITTER_NAME='<new_username>'; GIT_COMMITTER_EMAIL='<new_email>';" HEAD | |
| $ git push -f |
This file contains hidden or 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
| # Let's say you've .yaml.j2 files in a directory and | |
| # you want to make copy for each file, for ex: | |
| # files you have : config1.yml.j2 config2.yml.j2 porperties1.yml.j2 setup.yml.j2 | |
| # files you want : config1.yml.j2 config1_new.yml.j2 config2.yml.j2 config2_new.yml.j2 porperties1.yml.j2 porperties1_new.yml.j2 setup.yml.j2 setup_new.yml.j2 | |
| for filename in *.yml.j2; do mv $filename ${filename%.yaml.j2}_new.yml.j2; done |
This file contains hidden or 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
| $ kubectl get po -owide | grep -v Running | awk '{print $3}' | awk '{num[$1]+=1}END{for(i in num){print i, num[i]}}' |
This file contains hidden or 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/sh | |
| ### | |
| # This is a general-purpose function to ask Yes/No questions in Bash, either | |
| # with or without a default answer. It keeps repeating the question until it | |
| # gets a valid answer. | |
| ask() { | |
| # https://gist.github.com/davejamesmiller/1965569 | |
| local prompt default reply |
This file contains hidden or 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
| # Add these below lines to /etc/environment file | |
| LANG=en_US.utf-8 | |
| LC_ALL=en_US.utf-8 |
This file contains hidden or 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 | |
| git_owner="karancode" | |
| git_repo=${1} | |
| if [ -d "${git_repo}" ]; then | |
| cd ${git_repo} | |
| git checkout . | |
| git checkout master | |
| else |