Skip to content

Instantly share code, notes, and snippets.

View vergenzt's full-sized avatar

Tim Vergenz vergenzt

  • Jacksonville, FL
  • 18:29 (UTC -04:00)
View GitHub Profile
@vergenzt
vergenzt / test.c
Created June 8, 2012 13:25
Git Diff with Section Comments
int main() {
/***************************************************************************
** Section header 1, with short description
**************************************************************************/
// some code here, implementing section 1
/***************************************************************************
** New section header 2, with short description
@vergenzt
vergenzt / .bashrc
Created June 19, 2012 16:00
git ps1 with modification marker
alias ls='ls -F'
#alias grep='grep --color=auto'
# Git completion stuff
# Credit to bronson on Github
# https://raw.github.com/bronson/dotfiles/731bfd951be68f395247982ba1fb745fbed2455c/.bashrc
__define_git_completion () {
eval "
_git_$2_shortcut () {
COMP_LINE=\"git $2\${COMP_LINE#$1}\"
@vergenzt
vergenzt / lastDays.sh
Created June 25, 2012 14:42 — forked from juanpabloaj/lastDays.sh
git: latest changes grouped by day
#!/bin/bash
for i in $(seq 0 10)
do
date=$(date --date="$i days ago" +%D)
first=$(git log --format="%h" --after="$date 00:00" --before="$date 23:59" | tail -n1)
last=$(git log --format="%h" --after="$date 00:00" --before="$date 23:59" | head -n1)
if [ -n "$first" ] && [ -n "$last" ]; then
diff=$(git diff --shortstat $first^..$last)
echo "$(date --date=$date): $diff"
else
@vergenzt
vergenzt / gist:3004498
Created June 27, 2012 14:42
reflog example
3beca26 HEAD@{0}: commit: test
803f48e HEAD@{1}: reset: moving to HEAD^
929730f HEAD@{2}: reset: moving to 929730f
6d45432 HEAD@{3}: checkout: moving from master to temp
6d45432 HEAD@{4}: commit (amend): update: correct bug in deletion checking
6cc3850 HEAD@{5}: commit: update: correct bug in deletion checking
78fd620 HEAD@{6}: reset: moving to HEAD^
0602db4 HEAD@{7}: revert: Revert "update: add debug output"
@vergenzt
vergenzt / main.py
Created August 8, 2012 20:28
Write a number spiral
from spiral import write_spiral
write_spiral(7)
# Prints:
# 37 36 35 34 33 32 31
# 38 17 16 15 14 13 30
# 39 18 5 4 3 12 29
# 40 19 6 1 2 11 28
# 41 20 7 8 9 10 27
#!/usr/bin/env python
# A simple Python script to convert csv files to sqlite (with type guessing)
#
# @author: Rufus Pollock
# Placed in the Public Domain
import csv
import sqlite3
def convert(filepath_or_fileobj, dbpath, table='data'):
if isinstance(filepath_or_fileobj, basestring):
#!/bin/bash
# Georgia Tech Printer Setup Script
# Compatible with most Linux-based systems
# Requires a recent version of CUPS
# Written by Siddu Duddikunta <siddu@siddu.me>
fail()
{
echo '[FAILED]'
@vergenzt
vergenzt / zsh_theme_git_prompt.md
Created July 22, 2015 15:17
Zsh: Available ZSH_THEME_GIT_PROMPT_* variables
$ grep -o "ZSH_THEME_GIT_[A-Z_]\+" lib/git.zsh| sort | uniq
ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX
ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX
ZSH_THEME_GIT_PROMPT_ADDED
ZSH_THEME_GIT_PROMPT_AHEAD
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR
ZSH_THEME_GIT_PROMPT_BEHIND
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE
@vergenzt
vergenzt / GameOfLife.scala
Last active April 1, 2016 18:38
Purely functional Game of Life
/**
* Given "w h" on the first line of stdin, then `h` lines of grid with '0's for
* dead cells and '1's for live cells, output the next generation according to
* the rules of the Game of Life.
*/
object GameOfLife extends App {
val Array(width, height) = readLine.split(" ").map(_.toInt)
val lines = for(i <- 0 until height) yield readLine
lines
@vergenzt
vergenzt / .rubocop.yml
Last active August 9, 2016 17:28
Rubocop --auto-gen-config Metrics/ClassLength example
Metrics/ClassLength:
Max: 10