Skip to content

Instantly share code, notes, and snippets.

View k4gdw's full-sized avatar

Bryan Johns k4gdw

  • Montgomery, AL
View GitHub Profile
@k4gdw
k4gdw / git-diffmerge.sh
Last active December 17, 2015 11:09
Run this from your git BASH prompt. You will also need to make sure that the path to SourceGear's DiffMerge program, "sgdm.exe" in the current version, is included in the PATH environment variable. On 32bit versions of Windows that path defaults to, "C:\Program Files\SourceGear\Common\DiffMerge". On 64bit versions it'll default to, "C:\Program F…
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "sgdm.exe --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
git config --global mergetool.diffmerge.trustExitCode true
# If you want to disable git's backup file creation uncomment the following line.
# Otherwise you might need to add *.orig into your .gitignore to prevent them
# being added to your repository.
@k4gdw
k4gdw / restoreDBs.ps1
Last active December 22, 2015 16:59
Powershell 2 script to restore a bunch of Sql Server databases.
<# restoreDBs.ps1
.SYNOPSIS
A script to restore multiple databases on SqlServer from this
Winsmarts.com afticle: http://bit.ly/17lTl6t
.DESCRIPTION
The script enumerates the .bak files in the current directory
and restores each file to a separate database named the same
as the file, minus the ".bak" extension. For example, this
file, "AuthDB.bak" will yield a database named "AuthDB"
.NOTES
@k4gdw
k4gdw / UnderscoreToSpaceInFileName.cmd
Last active August 29, 2015 14:25
A batch file (.cmd) to rename files to change underscores in the file name to spaces.
@echo off
REM I found this code here: http://k4gdw.us/1CSwWRX (StackOverflow)
setlocal enabledelayedexpansion
for %%a in (*_*) do (
set file=%%a
ren "!file!" "!file:_= !"
)
@k4gdw
k4gdw / ReduceThatDB.sql
Created October 29, 2015 17:56 — forked from ferventcoder/ReduceThatDB.sql
D to the B to the A - Reducing the size of a SQL Server database
/*
* Scripts to remove data you don't need here
*/
/*
* Now let's clean that DB up!
*/
DECLARE @DBName VarChar(25)
@k4gdw
k4gdw / .gitconfig
Created January 27, 2016 22:54 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@k4gdw
k4gdw / gitcreate.sh
Created April 8, 2016 20:07 — forked from robwierzbowski/gitcreate.sh
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
@k4gdw
k4gdw / git-remove-file.sh
Last active September 22, 2016 17:32 — forked from bartlomiejdanek/git-remove-file.sh
remove file from git history
#!/bin/bash
#-------------------------------------------------------------------------------
# Name : git-remove-file.sh
# Written By: David Underhill, with modifications by, Bryan K. Johns, K4GDW
# Purpose : Script to permanently delete files / folders from your git
# : repository. To use it, cd to the root of your repository and then
# : run the script as shown.
# Calls : ./git-sanitize.sh path1 path2...
# Comments : This is my version of the git-delete-history script found here:
@k4gdw
k4gdw / instructions.sh
Last active August 24, 2017 16:00 — forked from nachocab/instructions.sh
How to make git diff work perfectly with .docx files in Mac OS X (it even colors by word)
# Execute the following commands one at a time from a bash prompt.
# download docx2txt by Sandeep Kumar
wget -O docx2txt.pl http://www.cs.indiana.edu/~kinzler/home/binp/docx2txt
# make a wrapper
echo '#!/bin/bash
docx2txt.pl $1 -' > docx2txt
chmod +x docx2txt
# make sure docx2txt.pl and docx2txt are your current PATH. Here's a guide