Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:
learning

Eliran Malka eliranmal

:electron:
learning
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 / 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
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}'
@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...');
@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 / pull_request.sh
Last active Feb 28, 2017 — forked from devongovett/pull_request.sh
Bash script to make a pull request from the current git repository.
View pull_request.sh
#!/usr/bin/env bash
pull_request() {
local to_branch="$1"
if [ -z $to_branch ]; then
to_branch="master"
fi
local access_token="[some access token with lots of characters]"
@eliranmal
eliranmal / show-ansi-colors.sh
Last active Jan 9, 2020
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() {
You can’t perform that action at this time.