Skip to content

Instantly share code, notes, and snippets.

View depressiveRobot's full-sized avatar

Marvin Frommhold depressiveRobot

View GitHub Profile
@depressiveRobot
depressiveRobot / shell_script_template.sh
Created October 16, 2014 10:02
A template for shell-based command-line scripts
#!/bin/bash
set -e
# credits: http://agateau.com/2014/template-for-shell-based-command-line-scripts/
PROGNAME=$(basename $0)
foo=""
bar=""
delete=0
output="-"
@depressiveRobot
depressiveRobot / git-email-prompt.sh
Last active June 6, 2020 13:21
prompt for email address to use for current git repository
#!/bin/bash
# bash prompt which asks for email address
# to configure for current git repository
# set your available emails
MAILS=([email protected] [email protected] [email protected])
# prompt for email
echo
@depressiveRobot
depressiveRobot / git-function.sh
Last active June 6, 2020 13:21
bash function to override git init/clone commands
function git() {
for i do
lastArgument=$i # last argument can be the directory or the repository url
done
/usr/local/bin/git $@
if [[ $? -eq 0 ]] # only show prompt if git command was successful
then
@depressiveRobot
depressiveRobot / Makefile
Last active October 17, 2017 16:07 — forked from rcmachado/Makefile
Help target for self-documentation of a Makefile
.PHONY: # add tasks here to avoid timestamp checks
default: help
# Based on https://gist.github.com/prwhite/8168133#comment-1313022
## Another dummy task
dummy-task:
echo dummy
## This help screen
@depressiveRobot
depressiveRobot / open_url_in_chrome.txt
Created March 3, 2015 18:53
Open URL in Google Chrome. Switches to tab if already open or creates a new one.
# source: http://superuser.com/a/692131/424541
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set chromeRunning to is_running("Google Chrome")
if chromeRunning then
tell application "Google Chrome"
set i to 0
@depressiveRobot
depressiveRobot / osx-intellij-set-path.sh
Last active April 30, 2019 20:36
Modifies the app package to start IntelliJ IDEA inside a shell with a custom PATH environment variable
#!/bin/sh
if [ "$#" -lt 2 ]; then
echo "Too few arguments\n"
echo "Usage: $0 'PATH TO INTELLIJ IDEA APP' 'PATH_VALUE'" >&2
exit 1
fi
if [ "$#" -gt 2 ]; then
echo "Too many arguments\n"
echo "Usage: $0 'PATH TO INTELLIJ IDEA APP' 'PATH_VALUE'" >&2