Skip to content

Instantly share code, notes, and snippets.

View rofc's full-sized avatar
💬
how can I help?

Roberto O. Fernández Crisial rofc

💬
how can I help?
View GitHub Profile
@rofc
rofc / git_svn_bash_prompt.sh
Last active August 15, 2018 19:47 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to git/svn branch, and return status of last command.
#!/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:
# Based on https://baymard.com/checkout-usability/credit-card-patterns
ALL TOGETHER
============
(?:4[0-9]{3}(?:[\ -]?[0-9]{4}){3})|(?:4(?:026|405|508|844|913|917)[-\ ]?[0-9]{4}|4175[-\ ]?00[0-9]{2})(?:[-\ ]?[0-9]{4}){2}|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)(?:[-\ ]?[0-9]{4}){3}|3[47][0-9]{2}[-\ ]?[0-9]{6}[-\ ]?[0-9]{5}|62[0-9]{2}[-\ ]?(?:[-\ ]?[0-9]{4}){3}|62[0-9]{4}[-\ ]?[0-9]{13}|(?:5[0678][0-9]{2}|6[0-9]{3})[-\ ]?[0-9]{4}[-\ ]?[0-9]{5}|(?:5[0678][0-9]{2}|6[0-9]{3})[-\ ]?[0-9]{6}[-\ ]?[0-9]{5}|(?:5[0678][0-9]{2}|6[0-9]{3})(?:[-\ ]?[0-9]{4}){3}|(?:5[0678][0-9]{2}|6[0-9]{3})(?:[-\ ]?[0-9]{4}){3}[-\ ]?[0-9]{3}|(?:30[0123459][0-9]|3[689][0-9]{2})[-\ ]?[0-9]{6}[-\ ]?[0-9]{4}|5[45][0-9]{2}(?:[-\ ]?[0-9]{4}){3}|(?:6011[-\ ]?[0-9]{4}|6221[-\ ]?2[6-9][0-9]{2}|6221[-\ ]?[3-9][0-9]{3}|622[2-8][-\ ]?[0-9]{4}|6229[-\ ]?[01][0-9]{3}|6229[-\ ]?2[0-5][0-9]{2})(?:[-\ ]?[0-9]{4}){2}|(?:352[89]|35[3-7][0-9]|358[0-9])(?:[-\ ]?[0-9]{4}){3}|1[0-9]{3}[-\ ]?[0-9]{5}[-\ ]?[0-9]{6}|5019(?:[-\ ]?[