Skip to content

Instantly share code, notes, and snippets.

View pnkfelix's full-sized avatar
🍩
re-pat; ex-🥐

Felix S Klock II pnkfelix

🍩
re-pat; ex-🥐
View GitHub Profile
#!/bin/bash
# Exuberant ctags, installed via homebrew on OS X
CTAGS=/usr/local/bin/ctags
#CTAGS_ARGS="-e -a --extra=+qf"
CTAGS_ARGS="-e -a --extra=+f"
# May want to investigate options like --c++-kinds=... (see --list-kinds=c++)
if hg root >& /dev/null ; then
ROOT=$(hg root)
@pnkfelix
pnkfelix / gist:5364904
Created April 11, 2013 16:29
show utf-8-unix entry in safe-local-variable-values
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(comint-completion-fignore nil)
'(comint-password-prompt-regexp "\\(^ *\\|\\( SMB\\|'s\\|Bad\\|CVS\\|Enter\\(?: \\(?:\\(?:sam\\|th\\)e\\)\\)?\\|Kerberos\\|LDAP\\|New\\|Old\\|Repeat\\|UNIX\\|\\[sudo]\\|enter\\(?: \\(?:\\(?:sam\\|th\\)e\\)\\)?\\|login\\|new\\|old\\) +\\)\\(?:Pass\\(?: phrase\\|phrase\\|word\\)\\|Response\\|pass\\(?: phrase\\|phrase\\|word\\)\\)\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\\(?: for \\(?:'[^']*'\\|[^:]+\\)\\)?:\\s *\\'")
'(completion-ignored-extensions (quote (".svn/" "CVS/" ".o" "~" ".bin" ".lbin" ".so" ".a" ".ln" ".blg" ".bbl" ".elc" ".lof" ".glo" ".idx" ".lot" ".dvi" ".fmt" ".tfm" ".pdf" ".class" ".fas" ".lib" ".mem" ".x86f" ".sparcf" ".fasl" ".ufsl" ".fsl" ".dxl" ".pfsl" ".dfsl" ".lo" ".la" ".gmo" ".mo" ".t
@pnkfelix
pnkfelix / gist:5376416
Created April 13, 2013 01:21
Explanation of why buffer switching in emacs is filtering out candidates that are already visible in the frame
;; OTHER-BUFFER is the one that is screwing things up for us,
;; through the call-chain:
;; SWITCH-TO-BUFFER ->
;; READ-BUFFER-TO-SWITCH ->
;; OTHER-BUFFER
;;
;; Do M-x help f other-buffer
;; to see the help text explaining the interface for OTHER-BUFFER
;; which tells us why the fix I offer below fixes things.
Compiling debug-default-methods.rs yields segfault from rustc.
Attempting to remove hack that may be unsound in rustc.
For background on reason I think this hack is causing unsoundness, see
below stack trace, along with the input source that exposes the bug.
% rustc debug-default-methods.rs
Stack trace:
diff --git a/js/src/builtin/ParallelArray.js b/js/src/builtin/ParallelArray.js
index da5402e..fdec070 100644
--- a/js/src/builtin/ParallelArray.js
+++ b/js/src/builtin/ParallelArray.js
@@ -1399,13 +1399,14 @@ function ParallelMatrixConstructFromGrainFunctionMode(arg0, arg1, arg2, arg3) {
case 1:
computefunc = isLeaf ? fill1_leaf : fill1_subm;
break;
-
+/*
@pnkfelix
pnkfelix / gist:5416585
Created April 18, 2013 21:59
strange ComputeIndices issue (with debug instrumentation activated via mode parameter).
% ./js
js> print(new ParallelMatrix([2,3], (i,j,k) => k+10*(j+10*i) +1, {print:function(x) { print(JSON.stringify(x)); }}))
{"called":"ParallelMatrixConstruct","shape":[2,3],"frame":[2,3],"grain":[],"valtype":"any","mode":{}}
{"called":"ParallelMatrixConstruct prior parallel"}
{"called":"ParallelMatrixConstruct seq fallback"}
{"called":"fillN_leaf","indexStart":0,"indexEnd":6,"frame":[2,3]}
typein:1:0 ReferenceError: ComputeIndices is not defined
js>
@pnkfelix
pnkfelix / gist:5420717
Created April 19, 2013 14:29
variant of yank
(defun yank-removing-newlines ()
"Yanks the last stretch of killed text, removing newlines.
See also `yank' (\\[yank])."
(interactive)
(insert-for-yank (replace-regexp-in-string "\n" "" (current-kill 0))))
@pnkfelix
pnkfelix / gist:5420850
Created April 19, 2013 14:53
Make emacs say when compilations are finished.
(defun terminal-notify (msg &optional title subtitle group)
"Sends a message to the Mac OS X message center"
(let ((infile nil)
(buffer "*terminal-notifier*")
(display t))
(apply 'call-process
"terminal-notifier" infile buffer display
"-message" msg
(append (if title (list "-title" title) nil)
(if subtitle (list "-subtitle" subtitle) nil)
@pnkfelix
pnkfelix / gist:5453865
Created April 24, 2013 17:20
PJS ParallelMatrix: examples at js shell repl
js> print(new ParallelMatrix([5,5], (i,j) => i+j))
[[0, 1, 2, 3, 4],
[1, 2, 3, 4, 5],
[2, 3, 4, 5, 6],
[3, 4, 5, 6, 7],
[4, 5, 6, 7, 8]]
js> print(new ParallelMatrix([5,5], (i,j) => i+j).map((n) => 10+n))
[[10, 11, 12, 13, 14],
[11, 12, 13, 14, 15],
[12, 13, 14, 15, 16],
@pnkfelix
pnkfelix / gist:5481736
Created April 29, 2013 14:01
example showing when rustc encourages uninitalized variable.
// CODE:
static s : int = 3;
static t : *int = &s as *int;
fn main() {
let mut x = 3;
unsafe {
x = *t;
}
io::println(fmt!("Hello World %d", x));