Skip to content

Instantly share code, notes, and snippets.

@scottjacobsen
scottjacobsen / ruby-flymake.el
Created Aug 27, 2012
Emacs flymake mode for ruby
View ruby-flymake.el
(require 'flymake)
;; I don't like the default colors :)
(set-face-background 'flymake-errline "red4")
(set-face-background 'flymake-warnline "dark slate blue")
;; Invoke ruby with '-c' to get syntax checking
(defun flymake-ruby-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
View hsb.txt
The following paragraphs describe how bash executes
its startup files. If any of the files exist but
cannot be read, bash reports an error. Tildes are
expanded in file names as described below under
Tilde Expansion in the EXPANSION section.
When bash is invoked as an interactive login shell,
or as a non-interactive shell with the --login
option, it first reads and executes commands from
@scottjacobsen
scottjacobsen / post_gis_1204.txt
Created Nov 20, 2012
Install postgis on ubuntu 12.04
View post_gis_1204.txt
* aptitude purge postgresql-9.1-postgis2
* aptitude purge libgeos-3.3.3
* sudo aptitude install postgresql-server-dev-9.1
* sudo aptitude install checkinstall
* sudo aptitude install libproj-dev
@scottjacobsen
scottjacobsen / git+clone+ssh+agent+forward+sudo
Created Dec 14, 2012
Git clone using ssh agent forwarding and sudo
View git+clone+ssh+agent+forward+sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
@scottjacobsen
scottjacobsen / backup.sh
Created Dec 20, 2012
sort of time machine like backup using rdiff-backup
View backup.sh
#!/bin/bash
if [[ -d /mnt/yavin/hoth ]]; then
nice -n15 /usr/bin/rdiff-backup --exclude=/boot --exclude=/dev --exclude=/**/.gvfs --exclude=/media --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lib/udev --exclude=/tmp --exclude=/home/scott/.mozilla/firefox/jxg17tdp.default/Cache --exclude=/usr/portage/distfiles --exclude=/var/tmp/portage --exclude=/var/run --exclude=/home/scott/.VirtualBox/HardDisks/SQLData.vdi / /mnt/yavin/hoth/current
fi
@scottjacobsen
scottjacobsen / git-grep.el
Last active Jan 24, 2020
A more convenient git-grep. By default this will grep all files in the repository from the root of the git repository. I find these defaults more convenient than those used by vc-git-grep in the emacs version control library.
View git-grep.el
;; derived from rails-project:root from
;; https://github.com/remvee/emacs-rails
(defun git-root ()
"Return GIT_ROOT if this file is a part of a git repo,
else return nil"
(let ((curdir default-directory)
(max 10)
(found nil))
(while (and (not found) (> max 0))
(progn
@scottjacobsen
scottjacobsen / dervied_private.rb
Created Feb 13, 2013
Derived classes can call a private method on a base class.
View dervied_private.rb
class MyBase
private
def priv
puts "private"
end
end
class MyDerived < MyBase
def foo
priv
View backup.sh
#!/bin/bash
if [[ -d /mnt/yavin/hoth ]]; then
nice -n15 /usr/bin/rdiff-backup --exclude=/boot --exclude=/dev --exclude=/**/.gvfs --exclude=/media --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lib/udev --exclude=/tmp --exclude=/home/scott/.mozilla/firefox/jxg17tdp.default/Cache --exclude=/usr/portage/distfiles --exclude=/var/tmp/portage --exclude=/var/run --exclude=/home/scott/.VirtualBox/HardDisks/SQLData.vdi / /mnt/yavin/hoth/current
fi
View twitter_sub.rb
url.sub /_normal(\.[[:alnum:]]+)?$/, '\\1'
View make.conf
ACCEPT_KEYWORDS="~amd64"
INPUT_DEVICES="evdev synaptics"
FEATURES="parallel-fetch"
LINGUAS="en_US"
ACCEPT_LICENSE=*
PORTDIR_OVERLAY=/usr/local/portage
APACHE2_MPMS=prefork
EMERGE_DEFAULT_OPTS="--quiet-build=y"
RUBY_TARGETS="ruby19"
USE="mmx sse sse2 -esd -swat -gnome -qt -qt3 -qt4 -kde laptop quicktime \