Skip to content

Instantly share code, notes, and snippets.

:electron:
learning

Eliran Malka eliranmal

:electron:
learning
Block or report user

Report or block eliranmal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eliranmal
eliranmal / git-fork-update.sh
Created Jun 17, 2019
politely updates a fork repository from the upstream repository, by excluding merge commits so they will not appear on pull-requests to the upstream.
View git-fork-update.sh
git fetch upstream
git checkout master
git rebase upstream/master
git push -f origin master
@eliranmal
eliranmal / json.sh
Last active Jun 11, 2019
a bash json parser via node js
View json.sh
#!/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 Jun 6, 2019
changes the computer/host name in all relevant entries of the scutil
View compname.sh
#!/usr/bin/env bash
function main() {
validate "$@"
set_name "$@"
if [[ "$2" == '-p' ]]; then
update_policy
fi
}
View github-enterprise-fetch-raw.sh
#
# 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 / colors
Last active Nov 30, 2018 — forked from twerth/colors
List colors in shell
View colors
#!/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 / show-ansi-colors.sh
Last active Oct 25, 2018
spits N ansi colors to the terminal
View show-ansi-colors.sh
#!/usr/bin/env sh
usage() {
echo "show-ansi-colors <n>"
exit 0
}
(( $# < 1 )) && usage
show_ansi_colors() {
@eliranmal
eliranmal / teamcity-auto-run.js
Last active Aug 8, 2018
periodically triggers teamcity builds. just stuff it in the dev console (but don't forget it running!)
View teamcity-auto-run.js
(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...');
View themes.css
/* - - - space - - - */
.space {
background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
color: #fff !important;
}
/* put stars elements behind everything else */
.space > :not([class^=stars]) {
View git-flux-config-migration.sh
#!/usr/bin/env bash
if [[ $HELP = true ]]; then
less << 'EOF'
overview
--------
migrates git-flux configurations from global to local context.
@eliranmal
eliranmal / webpack-first-error.sh
Created Mar 21, 2017
shows how to only output the first webpack-compiler error to the console
View webpack-first-error.sh
webpack | awk '/ERROR/{f=1} f{print; if (/@/) exit}'
You can’t perform that action at this time.