Skip to content

Instantly share code, notes, and snippets.

View grocky's full-sized avatar

Rocky Gray grocky

View GitHub Profile
#!/usr/bin/env bash
# The various escape codes that we can use to color our prompt.
export RED="\[\033[0;31m\]"
export YELLOW="\[\033[0;33m\]"
export GREEN="\[\033[0;32m\]"
export BLUE="\[\033[0;34m\]"
export LIGHT_RED="\[\033[1;31m\]"
export LIGHT_GREEN="\[\033[1;32m\]"
export WHITE="\[\033[1;37m\]"
export LIGHT_GRAY="\[\033[0;37m\]"
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
#! /bin/sh
proxy=$PROXY
if [ "$1" == "on" ]; then
echo "exporting proxy"
export http_proxy=$proxy
export https_proxy=$proxy
@grocky
grocky / idea
Last active May 28, 2020 19:13 — forked from chrisdarroch/idea
Open IDEA applications based on project type from the command line!
#!/usr/bin/env bash
IDEA=''
PROJECT_DIR=''
function main() {
openIdea "$@"
}
function openIdea() {
# set the command prefix to `
set -g prefix "`"
unbind-key C-b
bind-key "`" send-prefix
set -g default-shell /bin/bash
set -g default-command bash
set -g status-fg white
set -g status-bg black
@grocky
grocky / IdempotentSQLAlterTableAddColumn.sql
Last active July 16, 2019 17:16 — forked from kmoormann/IdempotentSQLAlterTableAddColumn.sql
Idempotent SQL Alter Table Statements
-- Idempotently add the tasks.id column
SET @table_name = 'tasks';
SET @column_name = 'id';
SET @preparedStatement = (SELECT IF(
(
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = @table_name
AND column_name = @column_name
AND data_type = 'BIGINT'
) > 0,
@grocky
grocky / upload-github-release-asset.sh
Created July 5, 2020 14:47 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner