Skip to content

Instantly share code, notes, and snippets.

Don't worry about what anybody else is going to do. The best way to
predict the future is to invent it.
-- Alan Kay
Premature optimization is the root of all evil (or at least most of it)
in programming.
-- Donald Knuth
Lisp has jokingly been called "the most intelligent way to misuse a
computer". I think that description is a great compliment because it
function executeShellCommand (program) {
//use arguments.shift to implement a complete shell bridge
var executable = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
executable.followLinks = true;
executable.initWithPath(program);
if (executable.exists()) {
try {
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
@erickedji
erickedji / cygwinBashrc.sh
Created March 24, 2009 06:36
Cygwin .bashrc goodies
#Copied from http://blog.athulacharya.com/2009/03/cygwin-bashrc-goodness.html
# Open a CMD shell under Cygwin, optionally specifying a working directory
function winsh() {
if [ "x${1}" != "x" ]; then
P=${1}
else
P=.
fi
cmd /c start cmd /k "cd `cygpath -aw ${P}`"
@erickedji
erickedji / dosrc.bat
Created April 3, 2009 19:16
cmd.exe startup script for the linux refugee
doskey m=mule -config $*
doskey q=exit
doskey e=cd c:\eric
doskey c=cls
doskey ls=dir
doskey sl=dir
doskey quit=exit
doskey ws=cd c:\eric\workspace
doskey s=cd c:\eric\soft
doskey kill=taskkill /f /im $*
@erickedji
erickedji / OptimisationByComputationRegrouping.txt
Created April 6, 2009 04:47
Computation regrouping - Restructuring programs for temporal data cache locality
#Eric KEDJI <eric.kedji@gmail.com>
Computation regrouping - Restructuring programs for temporal data cache locality
===
This paper explores how to optimize programs so that they can effectively leverage the cache. It identifies four techniques:
Early Execution
---
Whenever you have a chunk of data near you (that is, in a local variable, available in the cache), do not only do the current, but also the maximum of *future* computations you can do with that data.
@erickedji
erickedji / wvdial.conf
Created April 6, 2009 05:15
wvdial.conf for IAM (Alcatel OT 020), Meditel and Wana
[Dialer Defaults]
Modem = /dev/ttyUSB0
Modem Type = Analog Modem
Baud = 9600
ISDN = 0
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+COPS=3,2
Init4 = AT+CGDCONT=1,"IP","www.iamgprs1.ma"
Phone = *99#
package ma.neoxia.soa.mulepatterns;
import java.util.Properties;
import javax.mail.URLName;
/**
* This class just sets some extra SMTP properties so it works with GMail.
* ERIC: I copied this from Mule BookStore example.
*/
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ page import="com.liferay.portal.kernel.portlet.LiferayWindowState" %>
<div id="<portlet:namespace />soaPortletDiv">
<form
action="<portlet:actionURL/>"
method="post"
name="<portlet:namespace />fm"
@erickedji
erickedji / ubiquitySyntaxHighlight.js
Created April 8, 2009 23:57
ubiquity: syntax-highlight selection
/*
* Syntax-highlighting verb for Ubiquity, using the online service at
* quickhighlighter.com.
* Eric KEDJI <eric.kedji@gmail.com>
*/
noun_type_programmingLanguage = new CmdUtils.NounType( "Programming language",
['abap', 'actionscript', 'actionscript3', 'ada', 'apache', 'applescript', 'asm', 'asp', 'autoit', 'bash', 'basic4gl', 'blitzbasic', 'bnf', 'c', 'c_mac', 'caddcl', 'cadlisp', 'cfdg', 'cfm', 'cpp', 'cpp-qt', 'csharp', 'css', 'd', 'delphi', 'diff', 'div', 'dos', 'dot', 'eiffel', 'fortran', 'freebasic', 'genero', 'gettext', 'glsl', 'gml', 'groovy', 'haskell', 'html4strict', 'idl', 'ini', 'inno', 'io', 'java', 'java5', 'javascript', 'kixtart', 'latex', 'lisp', 'lotusformulas', 'lotusscript', 'lua', 'm68k', 'matlab', 'mirc', 'mpasm', 'mxml', 'mysql', 'nsis', 'objc', 'ocaml', 'ocaml-brief', 'oobas', 'oracle8', 'pascal', 'per', 'perl', 'php', 'php-brief', 'plsql', 'python', 'qbasic', 'rails', 'reg', 'robots', 'ruby', 'sas', 'scala', 'scheme', 'sdlbasic', 'smalltalk', 'smarty', 'sql', 'tcl', 'text', '
@erickedji
erickedji / stripShellPrompt.js
Created April 9, 2009 00:43
ubiquity: strip '$' in shell snippets
/*
* Strip the characters of the modifier in the input
* This was motivated by the desire to strip '$'s in shell snippets,
* so as to copy and paste in a running terminal.
* TODO: Add support for stripping 'eric@schemer$ ' for example.
*
* Eric KEDJI <eric.kedji@gmail.com>
*/
CmdUtils.CreateCommand({
name: "strip",