Skip to content

Instantly share code, notes, and snippets.

View lonnen's full-sized avatar
:shipit:

Lonnen lonnen

:shipit:
View GitHub Profile
@lonnen
lonnen / gist:3101795
Created July 12, 2012 23:24
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@lonnen
lonnen / stats.sh
Created December 28, 2011 17:57
quarterly git stats
# detailed stats for an individual
git log --shortstat --author=AUTHOR --since=10-1-2011 | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "\nlines inserted: ", inserted, "\nlines deleted: ", deleted}'
# commit numbers by author for the repo
git log --pretty=format:%an --since=10-1-2011 | awk '{ ++c[$0]; } END { for(cc in c) printf "%5d %s\n",c[cc],cc; }' | sort -r
# detailed stats per author, including contribution to the total change
git log --numstat --since=10-1-2011 | awk '
function printStats(author) {
printf "%s:\n", author
@lonnen
lonnen / fizzbuzz.py
Created January 17, 2023 23:46
my favorite implementation of fizzbuzz
#!/usr/bin/env python3
import itertools
fizzes = itertools.cycle(["", "", "Fizz"])
buzzes = itertools.cycle(["", "", "", "", "Buzz"])
fizzbuzzes = map(lambda x: "".join(x), zip(fizzes, buzzes))
def fizzbuzz(n):
return list(itertools.islice(fizzbuzzes, n))
@lonnen
lonnen / keybase.md
Last active January 2, 2020 22:44
keybase.md

Keybase proof

I hereby claim:

  • I am lonnen on github.
  • I am lonnen (https://keybase.io/lonnen) on keybase.
  • I have a public key ASD6EwG016GSrl1Lo7eTkPdMaQ-Ck6hXv7KOflhUMv2o2Qo

To claim this, I am signing this object:

@lonnen
lonnen / autoconf213.rb
Created January 4, 2011 22:15
Homebrew recipe for autoconf213
require 'formula'
class Autoconf213 <Formula
url 'http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.13.tar.gz'
md5 '9de56d4a161a723228220b0f425dc711'
homepage 'http://www.gnu.org/software/autoconf/'
def keg_only?
:provided_by_osx
end
~/repos/socorro master
[17:39:48] $ tokei .
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Autoconf 2 1536 227 881 428
C Header 12 2195 1259 614 322
C++ 11 7342 6055 470 817
C++ Header 3 1347 1085 80 182
CSS 10 1036 937 55 44
@lonnen
lonnen / logz.txt
Created June 20, 2011 21:41
#Processing irc partial log from 04 - 25 - 11
The topic for #processing is: P5 - processing.org - [Algorithmic Art] / [Generative Art] / [Art from Code] / [Design Interfaces] (10:21:20 AM)
cardamon [~mute@wn-0-22-43-57-13-41.wifi.gsu.edu] entered the room. (10:23:15 AM)
atrowbri left the room (quit: Quit: atrowbri). (10:24:18 AM)
10:32:49 AM abielins: \o
10:33:20 AM lonnen: clever
10:33:32 AM lonnen: aberry: just throw out the questions
10:33:40 AM lonnen: er.. abielins just throw out the question
10:33:55 AM aberry: OK
10:34:46 AM abielins: lonnen: What is the air speed velocity of an unladen swallow?
10:34:49 AM aberry: how can i get my manager to let me work on processing projects at my day job? :D
@lonnen
lonnen / serve
Created February 6, 2018 19:15
serve the local directory in python
#!/usr/bin/env python
import sys, os
import SimpleHTTPServer
args = sys.argv[1:]
if len(args) and (args[0] == "-h" or args[0] == "--help"):
print """
Serve a file (or the current directory)
http://benalman.com/
@lonnen
lonnen / search.txt
Last active December 19, 2017 20:57
socorro rules that modify the raw_crash -- raw_crash\[(.*?)\]
# raw_transform ruleset
mozilla_transform_rules
ProductRewrite
ESRVersionRewrite
PluginContentURL
PluginUserComment
processor_app.py
:115 if 'uuid' not in raw_crash:
:116 raw_crash.uuid = uuid
@lonnen
lonnen / parens.py
Created November 19, 2010 16:02
Algorithm P from Knuth's the Art of Computer Programming v.4 implemented in python.
'''Parens
Enumerate nested parenthesis.
Implements Algorithm P from Knuth's the Art of Computer Programming v. 4
directly with minimal optimizations for python.
Usage: python parens.py number
'''
import sys