Skip to content

Instantly share code, notes, and snippets.

View rsaporta's full-sized avatar

Rick Saporta rsaporta

View GitHub Profile
@rsaporta
rsaporta / comments.r
Created December 1, 2012 18:31 — forked from hadley/comments.r
Time each line of execution in R
comments <- function(refs) {
srcfile <- attr(refs[[1]], "srcfile")
# first_line, first_byte, last_line, last_byte
com <- vector("list", length(refs))
for(i in seq_along(refs)) {
# Comments begin after last line of last block, and continue to
# first line of this block
if (i == 1) {
first_byte <- 1
# Requirements
#sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux
#install.packages('RCurl')
#install.packages('RJSONIO')
library('RCurl')
library('RJSONIO')
query <- function(querystring) {
h = basicTextGatherer()
## --------------------------------------------------------------------------------------------------- ##
## AUTHOR: Rick Saporta ##
## ##
## This code accompanies the medium article ##
## https://medium.com/@RickSaporta/git-when-dangling-branches-become-pesky-open-loops-697931b65118 ##
## ##
## --------------------------------------------------------------------------------------------------- ##
## these are all of the branches you have identified as stale
@rsaporta
rsaporta / gitcheats.txt
Created April 16, 2018 14:13 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get a list of all commit messages for a repo
git log --pretty=format:'%s'
# find the nearest parent branch of the current git branch
git show-branch -a | grep '\*' | grep -v `git rev-parse --abbrev-ref HEAD` | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# push changes to an empty git repository for the first time
@rsaporta
rsaporta / largestFiles.py
Created January 11, 2019 23:42 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#