Skip to content

Instantly share code, notes, and snippets.

emacs --batch -l '/home/dburger/.emacs' --eval '(c-indent-file "/home/dburger/test.c")'
#!/usr/bin/env bash
USER=$1
PASSWD=$2
AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.45 Safari/534.13"
function bail {
echo $1
exit $2
(global-set-key "\C-ct" 'toggle-test)
(defun toggle-test ()
(interactive)
(let* ((file-name (buffer-file-name))
(toggle-file-name
(cond ((string-match "\\(.*\\)/javatests/\\(.*\\)\\(/[^/]*\\)Test.java$" file-name)
(concat (match-string 1 file-name)
"/java/"
(match-string 2 file-name)
(match-string 3 file-name)
(defun c-indent-file (filename)
(interactive)
(find-file filename)
(mark-whole-buffer)
(c-indent-line-or-region)
(save-buffer))
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t)
;; effectively turn off its auto searches
(setq ido-auto-merge-delay-time 99999)
(defvar my-project-file-regex "\\(.*?\\)\\([^/]+?\\)$")
(defvar my-project-file-replace "\\2")
(defvar my-project-find
(concat "find -H %s"
# put the window controls where they are supposed to be
gconftool -s /apps/metacity/general/button_layout -t string "menu:minimize,maximize,close"
# get emacs keybindings
gconftool -s /desktop/gnome/interface/gtk_key_theme -t string Emacs
# don't let menus intercept keystrokes, emacs style keystrokes, in gnome-terminal
gconftool -s /apps/gnome-terminal/global/use_mnemonics -t bool false
# turn off sounds for events
gconftool -s /desktop/gnome/sound/event_sounds -t bool false
# standard desktop background
gconftool -s /desktop/gnome/background/picture_filename -t string "/usr/share/backgrounds/BusquedaNocturna.jpg"
#!/usr/bin/env bash
usage() {
echo "\
Usage: $0 -u username -d database [-h host] [-o port)] \\
[[-p] | [-P password]]
host defaults to localhost
port defaults to 3306
-p will cause mysql to prompt for the password, good
-P password will show the password in your ps list, evil" >&2
public enum Foo {
BAR(DEFAULT_VALUE), BAZ(44);
private static final int DEFAULT_VALUE = 42;
private int value;
Foo(int value) {
this.value = value;
method:function() {
// convert the implicit arguments parameter to a real array
var args = Array.prototype.call(arguments);
// the query object is the first parameter
var query = args.shift();
query.state.operator = "||";
// call the repeat method on the query object with the remaining arguments
query.repeat.apply(query, args);
}
-- mysql has an default escape character \
SELECT * FROM people WHERE symbol LIKE 'hello\_world';
-- or you can specify the escape character
SELECT * FROM people WHERE symbol LIKE 'hello|_world' ESCAPE '|';
-- tsql has no default but you can go with a single character class
SELECT * FROM people WHERE symbol LIKE 'hello[_]world';
-- or you can specify an escape character
SELECT * FROM people WHERE symbol LIKE 'hello|_world' ESCAPE '|';