Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@henrik
henrik / .bashrc
Created December 3, 2008 17:56
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@jonspeicher
jonspeicher / gist:285486
Created January 24, 2010 22:30
Add colored status to your bash prompt while in a Mercurial repo.
# Define a few colors for later use. The escaped brackets tell bash that they
# are non-printable and keep word-wrapping sane.
TXT_RED='\['`tput setaf 1`'\]'
TXT_GREEN='\['`tput setaf 2`'\]'
TXT_RESET='\['`tput sgr0`'\]'
# Build a prompt decorator if we're in a hg repo. The branch name is included
# in green if the branch is default, red otherwise. A symbol appears if the
# working directory is not clean. This uses Steve Losh's excellent hg-prompt
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@jstangroome
jstangroome / CLR4PowerShell.psm1
Created March 23, 2011 02:51
Execute individual PowerShell v2 commands using .NET Framework CLR 4
function Invoke-CLR4PowerShellCommand {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[ScriptBlock]
$ScriptBlock,
[Parameter(ValueFromRemainingArguments=$true)]
[Alias('Args')]
[object[]]
@jonah-williams
jonah-williams / build.sh
Created April 30, 2011 17:46
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@dvhthomas
dvhthomas / Markdown.sublime-build
Created May 3, 2011 22:58
Pandoc powered Sublime Text 2 build provider for Markdown files: HTML the easy way
{
"cmd": ["pandoc.exe", "--to=html", "--output=$file.html", "$file"],
"selector": "source.md"
}
@ferventcoder
ferventcoder / RoundhousEMigrate.cs
Created May 18, 2011 04:28
RoundhousE - Migrations with new semi-fluent interface
new Migrate().Set(p =>
{
p.ConnectionString = connectionString;
p.SqlFilesDirectory = scriptsLocation;
p.EnvironmentName = environmentName;
p.Drop = dropDatabase;
p.RecoveryModeSimple = useSimpleRecoveryMode;
p.Restore = restore;
p.RestoreFromPath = restorePath;
p.RepositoryPath = repositoryPath;
@kaimallea
kaimallea / gobot.go
Created August 3, 2011 18:09
GoBot, a useless IRC bot in Go
package main
import (
"fmt"
"net/textproto"
"regexp"
"strings"
"os"
)
@derekgreer
derekgreer / findDeadProjects.sh
Created November 1, 2011 23:39
Bash script to find dead projects
#!/bin/bash
declare -a SOLUTIONS=$(find . -name "*.sln")
declare -a PROJECTS=$(find . -name "*.csproj")
for PROJECT in ${PROJECTS[*]}
do
PROJECT_NAME=$(basename $PROJECT)
USED=0
@vmihailenco
vmihailenco / proxy.go
Created November 20, 2011 15:22
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"