Skip to content

Instantly share code, notes, and snippets.

View artagnon's full-sized avatar

Ramkumar Ramachandra artagnon

View GitHub Profile
@artagnon
artagnon / python-vs-ruby.txt
Last active December 14, 2015 04:29
Why I don't like Python
1. Shit slow for being barely dynamic. I can understand the speed hit
if I'm re-opening classes to monkey-patch them, generating missing
methods on-the-fly, or doing some such Ruby magic.
2. Single implementation (that people actually use). JRuby, Rubinius,
and MRI are all great Ruby implementations, and stuff like RVM/
rbenv allow you to switch between them seamlessly.
3. Horrible packaging/ distribution: what the hell are easy_install
and pip? Ruby gems are awesome.
4. Non-evolving language. While 99% of the world is on 2.7, a small
fraction are deciding the 3.x syntax; it'll be vastly different and
@artagnon
artagnon / ff-versus-chrome-pstree.txt
Created February 25, 2013 18:46
Firefox versus Chrome, on the pstree.
init─┬─acpid
├─chrome─┬─chrome
│ ├─chrome───2*[{chrome}]
│ ├─chrome-sandbox───chrome─┬─chrome─┬─17*[chrome───3*[{chrome}]]
│ │ │ ├─chrome───4*[{chrome}]
│ │ │ └─chrome───11*[{chrome}]
│ │ └─nacl_helper_boo
│ └─31*[{chrome}]
├─login───zsh───startx───xinit─┬─Xorg
│ └─xmonad-x86_64-l─┬─emacs─┬─aspell
@artagnon
artagnon / flyte-bt.txt
Created February 26, 2013 12:25
Backtrace from Flyte Download Manager (Ubuntu x86_64)
(gdb) bt
#0 0x00007f2d44349d53 in select () from /usr/lib/libc.so.6
#1 0x0000000000db104f in ?? ()
#2 0x0000000000db51a7 in ?? ()
#3 0x0000000000db55e3 in ?? ()
#4 0x00000000005b3428 in ?? ()
#5 0x0000000000d863e2 in ?? ()
#6 0x0000000000d86637 in ?? ()
#7 0x0000000000d8b372 in ?? ()
#8 0x000000000041024f in ?? ()
@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))
@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 / 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 / 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-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 / 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 / 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,