Skip to content

Instantly share code, notes, and snippets.

View artagnon's full-sized avatar

Ramkumar Ramachandra artagnon

View GitHub Profile
@artagnon
artagnon / emacs-bug.sh
Last active December 20, 2015 08:09
Emacs bug in expand-file-name
#!/bin/sh
cd /tmp
rm -rf z b
mkdir z z/a z/b
ln -s z/b
cd b
emacs -Q --batch --eval='(error (expand-file-name "../a"))' # /tmp/a
realpath "../a" # /tmp/z/a
@artagnon
artagnon / laptop-review-jul-2013.txt
Last active December 20, 2015 01:29
The state of laptops, as on July 2013
Macbook Air Mid-2012, Chromebook Pixel, and Lenovo X1 Carbon use the
tried-and-tested i5-3427U low-power dual-core Ivybridge.
Some notable exceptions:
- Macbook Air Mid-2013 jumped to a low-power Haswell i5-4250U.
Optionally, you can get it with i7-4650U.
- Some ultrabooks are experimenting with i7 dual-cores: notably, the
ASUS Zenbook Prime UX21A uses the 3517U Ivybridge.
- Some laptops like the Lenovo Y410p are running a quad-core i7
Haswell. Unfortunately, this means that you can expect absolutely
@artagnon
artagnon / from_str2.rs
Created June 6, 2013 11:40
How is false_str.from_str() an unconstrained type?
trait FromStr2<T> {
fn from_str(&self) -> Option<T>;
}
impl<bool> FromStr2<bool> for ~str {
fn from_str(&self) -> Option<bool> {
match *self {
~"true" => Some(true),
~"false" => Some(false),
_ => None,
@artagnon
artagnon / ruby.sh
Last active December 17, 2015 07:48
rbenv ruby shim
#!/usr/bin/env bash
set -e
[ -n "$RBENV_DEBUG" ] && set -x
program="${0##*/}"
if [ "$program" = "ruby" ]; then
for arg; do
case "$arg" in
-e* | -- ) break ;;
*/* )
@artagnon
artagnon / git-gsoc-stats.txt
Last active December 17, 2015 03:39 — forked from trast/gist:5543140
Git GSoC statistics
2007 git Carlos Rica authored builtin/{tag.c, reset.c}; 26 total
2007 git Capitulino 11 trivial
2007 git Srijak zero contributions
2008 git Joshua Roys zero contributions
2008 git Sverre gitstats abandoned; 39 total (retained for a bit)
2008 git Lea Wiemann authored t9700-perl-git.sh; 19 total
2008 egit Marek Zawirski (?)
2008 git Miklos Vajna extensive work on git-merge; 171 total (retained)
2008 git Stephan Beyer sequencer abandoned; 53 total
2009 git Jeff Brantley zero contributions
@artagnon
artagnon / define-new-sh-style.el
Last active December 16, 2015 11:19
define-new-sh-style
(defmacro define-new-sh-style (indentation basic-offset match-path)
`(add-hook 'sh-mode-hook
(lambda ()
(let ((filename (buffer-file-name)))
(when (and filename
(string-match (expand-file-name ,match-path) filename))
(setq sh-indetnation ,indentation)
(setq sh-basic-offset ,basic-offset))))))
@artagnon
artagnon / git-submodule-wrong.txt
Created March 27, 2013 18:18
What's wrong with git submodules
In essence, git commands are built to act on pure worktrees. It's
trivially Correct to pretend that an object store present in the
toplevel directory (as .git/) of the worktree doesn't exist, but it's
quite non-trivial to handle a .git directory anywhere else in the
worktree. Since we built git ground-up to act on a single
repository's worktree, embedding one repository inside another is a
hack: as a "workaround", we simply relocate the object store of the
submodule repository. Even then, working with one worktree embedded
inside another is something git never designed for: it explains why I
have to literally fight with git when using submodules.
@artagnon
artagnon / recursive-submodules.txt
Created March 25, 2013 20:03
Recursive submodules in git are broken
1. git clone gh:artagnon/dotfiles, a repository with submodules.
2. git submodule update --init .elisp/auto-complete, a repository that
contains submodules.
3. .elisp/auto-complete/.gitmodules lists the submodules (lib/fuzzy,
lib/ert, and lib/popup). Let's try to initialize them from that
directory ... No! go back to toplevel.
4. Fine. Where are those submodules? git submodule status doesn't
@artagnon
artagnon / gmail-filters.txt
Created March 23, 2013 06:40
GMail filters for high-volume lists
# I use two rules for the git list. Note: don't use "from:me", because that matches email addresses with a "me" in them.
Match: (from:artagnon@gmail.com, to:git@vger.kernel.org OR cc:git@vger.kernel.org)
Do: Apply label "git"
Match: list:"<git.vger.kernel.org>" -{to:artagnon@gmail.com, cc:artagnon@gmail.com, from:artagnon@gmail.com}
Do: Skip Inbox, Apply label "git"
@artagnon
artagnon / emacs-init.el
Created March 12, 2013 09:31
Speed up macro execution in Emacs, by disabling font-lock-mode before starting out and re-enabling it after the execution is done.
(defun kmacro-end-and-call-macro (arg &optional no-repeat)
"Call last keyboard macro, ending it first if currently being defined.
With numeric prefix ARG, repeat macro that many times.
Zero argument means repeat until there is an error.
To give a macro a permanent name, so you can call it
even after defining other macros, use \\[kmacro-name-last-macro]."
(interactive "P")
(if defining-kbd-macro
(kmacro-end-macro nil))