Skip to content

Instantly share code, notes, and snippets.

@til
til / init.el
Created October 29, 2014 21:10
(defun grep-project (q)
"Search using git grep"
(interactive (list
(read-from-minibuffer "git grep: "
(if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(current-word))
nil nil 'grep-project)))
(let ((command
(concat
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require 'rspec'
require 'set'
class Traverser
attr_reader :elements, :satisfied
def initialize(elements, satisfied:)
@elements = elements
@satisfied = satisfied
end
(defun downcase-word-with-camelcase ()
"This works similar to downcase-word, but additionally inserts
an underscore before upper case chars within camel cased words, so that:
FooBar => foo_bar"
(interactive)
(progn
(if (looking-at-p "\\>") (search-forward-regexp "\\<"))
(let ((start (point)))
(search-forward-regexp "\\>")
(let ((end (point)))
@til
til / projects.org
Created March 23, 2014 15:44
notmuch for emacs-berlin

notmuch

notmuch is a search engine and emacs frontend for locally stored email. The name implies that it is efficient:

“You have 200k emails? That’s not much!”

Features

Fast local search

(custom-set-variables
'(notmuch-fcc-dirs "archive")
'(notmuch-message-headers (quote ("Subject" "To" "Cc" "Date")))
'(notmuch-poll-script "notmuch-rsync")
'(notmuch-search-oldest-first nil)
'(notmuch-show-all-multipart/alternative-parts nil)
'(notmuch-show-indent-messages-width 0)
'(notmuch-show-logo t)
'(notmuch-show-part-button-default-action (quote notmuch-show-view-part))
)
@til
til / self_returning.rb
Created February 24, 2014 12:44
Ruby server script that returns itself, with comment function
#!/usr/bin/env ruby
#
# Leave a comment if you can ...
%w[ rubygems socket syntax/convertors/html ].each { |lib| require lib }
def header(*args)
args.join("\r\n") + "\r\n" + "\r\n"
end
#!/usr/bin/env ruby
#
# Reads input given in key=value log format and outputs it as CSV.
# Specify the keys as arguments in the order that they should be
# output. Without arguments, it outputs all values.
#
# E.g.
# cat /tmp/production.log | keyvalue2csv time controller action
# 2014-01-14 13:02:04 +0100,products,index,195.87
# 2014-01-14 13:02:04 +0100,products,index,25.82
@til
til / .bashrc
Last active December 27, 2015 19:19
My favourite radio stations, ready to be played from the command line
alias radio.oe1="mplayer mms://apasf.apa.at/oe1_live_worldwide"
alias radio.fm4="mplayer http://mp3stream1.apasf.apa.at:8000/"
alias radio.wfmu="mplayer http://mp3stream.wfmu.org"
alias radio.o94="mplayer http://orange-01.live.sil.at:8000"
alias radio.88vier="mplayer http://ice.rosebud-media.de:8000/88vier"
alias radio.dradio="mplayer http://dradio-ogg-dlf-l.akacast.akamaistream.net/7/629/135496/v1/gnl.akacast.akamaistream.net/dradio_ogg_dlf_l"
alias radio.funkhauseuropa="mplayer http://fhe-ogg.akacast.akamaistream.net/7/933/199785/v1/gnl.akacast.akamaistream.net/fhe-ogg"
alias radio.fluxfm="mplayer http://fluxfm.hoerradar.de/fluxfm-berlin"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.