Skip to content

Instantly share code, notes, and snippets.

#
# a one-liner to get raw content from github enterprise, relying on basic authentication.
# eliminates the need to create an access token and incorporate it in the url.
#
#
# fill in the blanks:
#
# USER your login user name for authentication (you'll be prompted for password on the terminal)
# GHE_DOMAIN the github enterprise custom domain
@eliranmal
eliranmal / show-ansi-colors.sh
Last active November 7, 2022 07:30
spits N ansi colors to the terminal
#!/usr/bin/env sh
usage() {
echo "show-ansi-colors <n>"
exit 0
}
(( $# < 1 )) && usage
show_ansi_colors() {
@eliranmal
eliranmal / check-links.sh
Last active March 21, 2022 18:58
takes a list of links as input, and checks each for a successful response
@eliranmal
eliranmal / gitlab-mr-links-check.md
Last active March 16, 2022 12:03
a how-to on checking for broken links on GitLab merge requests
@eliranmal
eliranmal / redhat-bash-prompt.md
Last active December 13, 2021 05:21
customize your prompt line to match your fedora

redhat bash prompt

customize your prompt line to match your fedora

how to

  • add this somewhere in your .bash_profile (or .bashrc)
@eliranmal
eliranmal / colors
Last active December 17, 2019 16:31 — forked from twerth/colors
List colors in shell
#!/usr/bin/env bash
echo -e "\033[0mNC (No color)"
echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
@eliranmal
eliranmal / git-fork-update.sh
Created June 17, 2019 12:40
politely updates a fork repository from the upstream repository, by excluding merge commits so they will not appear on pull-requests to the upstream.
git fetch upstream
git checkout master
git rebase upstream/master
git push -f origin master
@eliranmal
eliranmal / json.sh
Last active June 11, 2019 16:56
a bash json parser via node js
#!/usr/bin/env bash
# example usage:
#
# json_response="$(curl --flag http://whatever.man)" # -> { "status": 22, "errors": [ { "message": "oh no!" } ] }
# errors="$(echo "$json_response" | json_get "errors")"
# [[ $errors ]] && {
# msg="$(echo "$errors" | json_get "0" | json_get "message")"
# }
json_get() {
@eliranmal
eliranmal / compname.sh
Created June 6, 2019 20:37
changes the computer/host name in all relevant entries of the scutil
#!/usr/bin/env bash
function main() {
validate "$@"
set_name "$@"
if [[ "$2" == '-p' ]]; then
update_policy
fi
}
@eliranmal
eliranmal / teamcity-auto-run.js
Last active August 8, 2018 22:59
periodically triggers teamcity builds. just stuff it in the dev console (but don't forget it running!)
(function (triggerIntervalSeconds) {
triggerIntervalSeconds = triggerIntervalSeconds || (60 * 5);
var runInterval = triggerIntervalSeconds * 1000;
var runBuildTimeout = 300;
function runBuild(done) {
var runBtn = jQuery("button:contains(Run)")[0];
console.log('opening build run dialog...');