This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime.Now.ToString("yyyy-MM-dd HH:mm zzz") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
commit_message_file="$1" | |
commit_type="$2" | |
commit_hash="$3" # This is empty if an existing commit is not being amended | |
diff_cached_output=$(git diff --cached) | |
diff_cached_output=$(echo "$diff_cached_output" | sed 's/^/# /') | |
diff_cached_message="# \`git diff --cached\` output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print variables | |
# | |
# From [this answer](http://unix.stackexchange.com/a/118050/56148) to the Unix & Linux SE question: | |
# - [How to print only defined variables (shell and/or environment variables) in bash - Unix & Linux Stack Exchange](http://unix.stackexchange.com/questions/3510/how-to-print-only-defined-variables-shell-and-or-environment-variables-in-bash) | |
(set -o posix; set) | |
# Open Vim with a new buffer containing the output of a command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Template block to execute a test stored procedure | |
-- a: | |
EXEC tSQLt.Run ''; | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Git merge conflict markers | |
^<<<<<<<\|^=======\|^>>>>>>> | |
" Git merge conflict markers for ViEmu in SQL Server Management Studio | |
^<<<<<<<\|=======\|>>>>>>> | |
" "WARNING" or "ERROR" | |
\<WARNING\>\|\<ERROR\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head /dev/urandom | tr -dc 'A-Za-z0-9!@#$%^&*()' | head -c 32 && echo | |
# With all of the OWASP password special characters, based on [this comment](http://unix.stackexchange.com/questions/230673/how-to-generate-a-random-string/230676#comment525492_230676) from the U&L SE question answer referenced below: | |
head /dev/urandom | tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 32 && echo | |
# This was adapted from [this answer](http://unix.stackexchange.com/a/230676/56148) to the Unix & Linux Stack Exchange question [password - How to generate a random string? - Unix & Linux Stack Exchange](http://unix.stackexchange.com/questions/230673/how-to-generate-a-random-string). | |
# The original command: | |
head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter the following line at a Bash command prompt | |
stage_ours () { git checkout --ours "$1" && git add "$1"; } | |
# Note that the trailing `;` above is required for function definitions on a single line. | |
# See [Bash Reference Manual - Shell Functions](https://www.gnu.org/software/bash/manual/bash.html#Shell-Functions) for more info. | |
# Run the function like `stage_ours Stored\ Procedures/dbo.Batch_Detail_GL_Journal_Export_bak.sql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Because Git has really good Bash completion support, naming the alias `save-ours-theirs` is just as easy to type but a *lot* more readable. | |
# Add to Git config file, e.g. *~/.gitconfig* | |
# Example: `git sot Static\ Data/dbo.TABLE.sql` | |
[alias] | |
sot = "!f(){ git show :2:\"$1\" > ours && git show :3:\"$1\" > theirs; }; f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
group_name="$1" | |
var_name="$2" | |
var_value="$3" | |
./create_dynamic_vars_db.py | |
sqlite3 dynamic_vars.db "INSERT OR REPLACE INTO group_vars ( group_name, var_name, var_value ) VALUES ( '${group_name}', '${var_name}', '${var_value}' );" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the first instance of text like "[something]" on each line in a visual selection and replace each line with "something" | |
'<,'>s/^\s\+\[\(\w\+\)\].\+$/\1/g | |
# Replace `div` tags with `p` tags | |
%s/<\(\/\=\)div>/<\1p>/g | |
# On Mac OS X, the default Vim when run from Terminal can't access the clipboard ("pasteboard"). This command will run the `pbcopy` program to copy the current visual selection: | |
w !pbcopy | |
# Generate a 32 character password by calling `pwgen`: |