Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff King peff

View GitHub Profile
@peff
peff / Makefile
Last active Sep 10, 2021
timing of a simple git command versus an in-process read
View Makefile
CFLAGS = -Wall -Werror -O2
all: foo
View keybase.md

Keybase proof

I hereby claim:

  • I am peff on github.
  • I am peff (https://keybase.io/peff) on keybase.
  • I have a public key ASBUTdmbqRWiZXxKC56hC7t8_6Mvdb5_gs-53B3u9hFoqAo

To claim this, I am signing this object:

@peff
peff / sdl
Last active Dec 16, 2018
Hacky perl script to grep for Microsoft's SDL-banned functions.
View sdl
#!/usr/bin/perl
#
# Usage: git grep -E "$(./sdl banned)" -- '*.c' '*.h'
my @TABLE = (
# Table 1. Banned string copy functions and replacements
BANNED => [qw(
strcpy
strcpyA
strcpyW
@peff
peff / git-du
Last active May 17, 2019
git-du script
View git-du
#!/usr/bin/perl
#
# Generate a listing of all paths ever used in the repository, along with the
# disk space used by the path throughout the entire history. Note that sizes
# for trees are cumulative; they include the sizes of all of the paths below
# them, in addition to the tree storage itself. All sizes are in bytes, and
# reflect git's delta and zlib compression.
#
# One caveat is that this is just the _current_ on-disk size. The on-disk size
# of each object may change if git repacks and chooses different delta bases,
@peff
peff / ghpath.sh
Last active Mar 2, 2017
convert <file>:<line> into github permalink
View ghpath.sh
#!/bin/sh
#
# Turn a file/line combination into a link to github.com.
# I use this from vim with:
#
# command! Link :exec "!ghpath %:p " . line(".")
#
# Running ":Link" anywhere will get you a link to the current file and
# line number. Remember to drop this as "ghpath" into your PATH, and
# to turn on the executable bit.
@peff
peff / README.md
Last active Aug 29, 2015
deadlocked http-backend/apache strace output
@peff
peff / README.md
Last active Aug 29, 2015
explanation of merge versus rebase
View README.md

Rebase conflicts can sometimes be harder than merge conflicts. This is because merges look only at the end points (what you have, and they have, and the merge base). But the rebase will look through each commit of the rebased topic. This can manifest itself in two ways:

  1. You'll get more conflicts in two stretches of code that reach similar endpoints, but get there through differing paths. For example, consider this trivial example:

      $ echo base >file && git add file && git commit -m base
    
View keybase.md

Keybase proof

I hereby claim:

  • I am peff on github.
  • I am peff (https://keybase.io/peff) on keybase.
  • I have a public key whose fingerprint is 22BE 8EED C3C8 C7FC 74A3 CF21 CEF7 0F9B 90F6 F6B8

To claim this, I am signing this object:

@peff
peff / README.md
Created May 22, 2012
many-ref repo
View README.md

This repository has a very large number of refs, which shows some slow-down on certain git operations.

@peff
peff / README.md
Created Apr 28, 2012
git gc --aggressive case
View README.md

This is a repository that has been packed over time with "git gc", but repacks from ~245M to ~145M with "git gc --aggressive". To narrow it down, I tried different packing options. With each of the following commands, I get these resulting pack sizes:

  • git repack -ad: 246M
  • git repack -ad -f: 376M
  • git repack -ad --window=250: 246M
  • git repack -ad -f --window=250: 145M