Skip to content

Instantly share code, notes, and snippets.

View alecthegeek's full-sized avatar
🤖
Dem keyboards don't go click click on their own you know

Alec Clews alecthegeek

🤖
Dem keyboards don't go click click on their own you know
View GitHub Profile
@alecthegeek
alecthegeek / bash-git-prompt
Created March 4, 2010 03:36 — forked from elecnix/bash-git-prompt
Displays the current git branch name and the dirty state in your Bash shell
#!/bin/bash
#
# Displays the current git branch name and the dirty state in your Bash shell
# prompt. Add a line like this to your ~/.bashrc file:
#
# . ~/path/to/gist/bash-git-prompt
#
# To use this, you must enable "enable programmable completion features".
# Look at your ~/.bashrc for something like:
#
@alecthegeek
alecthegeek / Generate_GitSHA1_forAfile.sh
Last active September 4, 2020 10:31
Calculate Git sha1 for a file
(echo -en "blob $(wc -c < $file)\00";cat $file)|sha1sum -b | cut -d " " -f 1
or of course
git hash-object $file

GA Git Class Command History

on 2012-07-26

echo STARTING CLASS
git --version
which git
brew update && brew upgrade
ls
clear

pwd

@alecthegeek
alecthegeek / gist:3354044
Created August 15, 2012 00:00 — forked from garann/gist:3353532
Crowdsourced career mentorship for female developers

I was inspired by Selena Deckelmann's list of Career Resources for Women (http://www.chesnok.com/daily/career-resources-for-women/), but couldn't think of much to contribute. So I thought maybe those of us already in the field and in a position to mentor could work on creating more. Please fork or comment and add your own!

Applying for jobs

Interviewing

Professional behavior

Negotiation

@alecthegeek
alecthegeek / fixgitprompt.sh
Created August 21, 2012 05:09
Fix for Git Prompt in Homebrew
# Upgraded git using Homebrew and now your __git_ps1() fails. Try something like this
# NB Still very fragile as had embedded version no
# enable git programmable completion features
if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
. /usr/local/etc/bash_completion.d/git-completion.bash
fi
# enable git prompt
@alecthegeek
alecthegeek / svn.sh
Last active February 5, 2016 01:06
SVN Wrapper Script -- support for standard commit message templates and svn info output
#!/usr/bin/env bash
# A wrapper for SVN. Designed for
# GIt users who need access to command line SVN. Tries to adopt as much information from Git config
# Command Line SVN users who are working with people using TortoiseSVN on Windows
# People who have use build scripts that depend on the outfrom from svn info when they in a Git checkout
@alecthegeek
alecthegeek / gist:4158419
Created November 28, 2012 01:22
Compare two directories when you have an old tool chain (no diff -q)
#!/bin/ksh
# Compare 2 directories for differences (e.g. current release and new release)
CURRENT=$1 ; shift
NEW=$1; shift
CURRENTDIFFFILE=/tmp/$(echo $CURRENT | sed -e 's/[/.][/.]*/_/g')
NEWDIFFFILE=/tmp/$(echo $NEW | sed -e 's/[/.][/.]*/_/g')
@alecthegeek
alecthegeek / gist:4208339
Last active October 13, 2015 14:17
Mount and unmount smb file systems on OS X
#!/bin/sh
# Copyright (C) 2012-15 Alec Clews
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@alecthegeek
alecthegeek / makefile
Created January 3, 2013 06:32
Build an HTML file from POD
# Generate Perl POD (Plain Old Documentation)
#
.SUFFIXES:
.SUFFIXES: .html
@alecthegeek
alecthegeek / gitWrapper
Last active December 17, 2015 09:39
Wraps the git init or git clone commands to double check the users's email address.
#!/usr/bin/env bash
# Wrapper script for git
if [[ -x /usr/local/bin/git ]] ; then
GIT=/usr/local/bin/git #Set for your environment"
elif [[ -x /usr/bin/git ]] ; then
GIT=/usr/bin/git #Set for your environment"
else
echo Git not installed correctly?