Skip to content

Instantly share code, notes, and snippets.

@chrismarksus
chrismarksus / remove hs_err_pid logs
Created October 8, 2013 16:07
These are Java crash (core) dump log files. Identify which Java process creates them by tracing and monitoring the PID.
$ rm ~/hs_err_pid*.log
@chrismarksus
chrismarksus / reportScreenColors.sh
Created October 24, 2013 13:17
Print out the screen colors in bash.
#!/bin/bash
echo -e "\033[0mCOLOR_NC (No color)"
echo -e "\033[1;37mCOLOR_WHITE\t\033[0;30mCOLOR_BLACK"
echo -e "\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_LIGHT_BLUE"
echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
echo -e "\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_LIGHT_CYAN"
echo -e "\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_LIGHT_RED"
echo -e "\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_LIGHT_PURPLE"
echo -e "\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_LIGHT_YELLOW"
@chrismarksus
chrismarksus / git_tags
Last active August 29, 2015 14:01
git commits between tags
git log tagA..tagB --pretty="%Cgreen%h%Creset %C(yellow)(%an)%Creset %s" --no-merges
@chrismarksus
chrismarksus / png_filename_to_uppercase
Created October 31, 2014 17:41
Convert png file name to uppercase
for f in *.png; do; mv "$f" "`tr [:lower:] [:upper:] <<< "${f%.*}"`.png"; done
@chrismarksus
chrismarksus / create_merge_branch.sh
Created April 8, 2015 19:00
Create a merge branch and merge master to feature branch script
#!/bin/bash
LOCAL=$1
REMOTE=$2
MERGE=origin/master
echo -e "\n\e[1;37mCreate new merge branch \e[1;34m$LOCAL\e[1;37m from '\e[0;32m$REMOTE\e[0m'\n"
git checkout -b $LOCAL $REMOTE
# get local and remote hashes
echo -e "\033[0mCOLOR_NC (No color)\n\033[1;37mCOLOR_WHITE\t\033[0;30mCOLOR_BLACK\n\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_LIGHT_BLUE\n\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN\n\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_LIGHT_CYAN\n\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_LIGHT_RED\n\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_LIGHT_PURPLE\n\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_LIGHT_YELLOW\n\033[1;30mCOLOR_GRAY\t\033[0;37mCOLOR_LIGHT_GRAY"
VERSION=${VERSION}
LOCAL=/path/to/ff/folder
FILE=firefox-{VERSION}.tar.bz2
#URL=ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/{VERSION}/linux-x86_64/en-US/{FILE}
URL=https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/{VERSION}/linux-x86_64/en-US/{FILE}
## change this
PATH=/path/to/browsers/{VERSION}/firefox/firefox-bin
cd {LOCAL}
wget {URL}
@chrismarksus
chrismarksus / gist:7d4257e81a8512492c98
Created April 17, 2015 15:44
bash function for getting the total commit for a user on a branch for a project
your_total_commits_on_branch_and_project() {
total=$(git log --author="$1" --pretty=oneline --no-merges | wc -l)
branch=$(git rev-parse --abbrev-ref HEAD)
project=$(git remote -v | head -n1 | sed -e 's/^[a-z]*.[http|ftp|ssh]*\:\/\/[a-Z]*\///' | sed -e 's/ ([fetch]*)//')
echo -e "\033[1;32m$1\033[0;32m has \033[1;32m$total\033[0;32m commits, on branch \033[1;32m$branch\033[0;32m, for project \033[1;32m$project\033[0m"
}
@chrismarksus
chrismarksus / git_commit_scoreboard.sh
Created April 17, 2015 15:47
git commit scoreboard
git log --format='%an' --no-merges ./ | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -rn | less
@chrismarksus
chrismarksus / git_status_s
Created April 17, 2015 15:53
Git aliases
s = status -s