Skip to content

Instantly share code, notes, and snippets.

@haxney
haxney / assembly.diff
Created August 11, 2010 15:17
The speed differences between registers and memory
--- memory.s 2010-08-11 11:14:35.503392530 -0400
+++ register.s 2010-08-11 11:14:29.988393279 -0400
@@ -1,19 +1,20 @@
- .file "memory.c"
+ .file "register.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
(defun find-file-as-root ()
"Find a file as root."
(interactive)
(let* ((parsed (when (tramp-tramp-file-p default-directory)
(coerce (tramp-dissect-file-name default-directory)
'list)))
(default-directory
(if parsed
(apply 'tramp-make-tramp-file-name
(append '("sudo" "root") (cddr parsed)))
File Sizes
2949
2597
3312
2337
3149
package org.haxney.aspectj.sbt
import _root_.sbt._
import org.aspectj.tools.ajc.Main
import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
trait AspectJ extends BasicScalaProject with FileTasks with MavenStyleScalaPaths {
lazy val aspectjTools = "org.aspectj" % "aspectjtools" % "1.6.11.M2" % "aspectj"
lazy val aspectjRt = "org.aspectj" % "aspectjrt" % "1.6.11.M2" % "aspectj"
@haxney
haxney / system.module.patch
Created April 13, 2011 15:21
Apply this to system.module
diff --git a/modules/system/system.module b/modules/system/system.module
index 383dc8a..0625e48 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1850,6 +1850,14 @@ function system_filetransfer_info() {
);
}
+ $backends['file'] = array(
+ 'title' => t('Local file'),
@haxney
haxney / commands_run
Created August 18, 2011 01:52
Rabl error in Rails specs
rails new rabl-test
rails generate scaffold task name:string
rails generate rspec:install
@haxney
haxney / tramp-mod.el
Created August 19, 2011 01:48
Allow "/sudo:host:/etc/stuff" to sudo on a remote host
(eval-after-load 'tramp
'(progn
(add-to-list 'tramp-default-proxies-alist
'(nil "\\`root\\'" "/ssh:%h:"))
(add-to-list 'tramp-default-proxies-alist
'((regexp-quote (system-name)) nil nil))))
@haxney
haxney / .classpath
Created August 22, 2011 00:53
Scala on Android with Eclipse support
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_managed"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@haxney
haxney / _form.html.haml
Created August 22, 2011 02:07
Genericizing Rails views
= semantic_form_for entry do |f|
= f.inputs
= f.buttons
@haxney
haxney / gist:1841325
Created February 16, 2012 03:04
Python hash collision resolution
# Find an entry for the given key, probing to a free location if the default is
# taken
#
# table - set object
# key - the item we are looking for
# hash_val - the hash of key
def lookup_entry(table, key, hash_val):
index = hash_val & table.mask
entry = table[index]