Skip to content

Instantly share code, notes, and snippets.

(define-test test-hash-table-equality
(let ((h1 (make-hash-table :test #'equal))
(h2 (make-hash-table :test #'equal)))
(setf (gethash "one" h1) "yat")
(setf (gethash "one" h2) "yat")
(setf (gethash "two" h1) "yi")
(setf (gethash "two" h2) "yi")
(true-or-false? nil (eq h1 h2))
(true-or-false? nil (equal h1 h2))
(true-or-false? t (equalp h1 h2))))
# cat /etc/init/docker-postgres.conf
description "Docker container for PostgreSQL"
author "Louis Kottmann"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
respawn limit 5 30
(require 'smooth-scroll)
(smooth-scroll-mode 1)
(defadvice smooth-scroll-mode (around my-smooth-scroll-mode-turn-on-maybe)
(unless (memq major-mode
(list 'ecb-major-mode))
ad-do-it))
(ad-activate 'smooth-scroll-mode)
start: 11,
start_risk: 22,
start_soon: 33,
restart: 44,
recording: 55,
recording_errors: 66,
restart__: 77,
error: 88,
done: 99,
done_: 10,
test = {
lorem: 'ipsum',
dolor: 'sit',
amet: ', consectetur',
adipiscing: 'elit',
donec : 'a',
diam : 'lectus.'
}
@LouisKottmann
LouisKottmann / test data
Last active December 30, 2015 17:29
test data for align-regexp-lefty
test = {
lorem: 'ipsum',
dolor: 'sit',
amet: ', consectetur',
adipiscing: 'elit',
donec: 'a',
diam: 'lectus.'
}
(defun align-regexp-lefty(beg end)
"After using align-regexp, this will move spaces to the left."
(interactive "*r")
(save-restriction
(narrow-to-region beg end)
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp "\(\w+\)\ \(\ *\)" nil t)
(replace-match "\2\1" nil nil)))))
(defun align-regexp-lefty ()
"After using align-regexp, this will move spaces to the left."
(interactive)
(let (pos1 pos2)
(if (region-active-p)
((setq pos1 (region-beginning) pos2 (region-end))
(save-restriction
(narrow-to-region pos1 pos2)
(goto-char (point-min))
(while (re-search-forward "\(\w+\)\ \(\ *\)" nil t)
@LouisKottmann
LouisKottmann / baboon-packages.el
Created December 5, 2013 10:51
Emacs package sync
(require 'cl)
;; Install missing packages
(require 'package)
(defvar baboon-packages
'(w3 solarized-theme haml-mode
slime ecb tabbar
powerline auto-complete
twittering-mode emms hackernews
rinari markdown-mode web-mode)
@LouisKottmann
LouisKottmann / CloudFlare's IPs for NGinx HttpRealipModule
Last active December 19, 2015 12:38
Fetches CloudFlare's official IPv4 and IPv6 addresses and formats them for use from NGinx's HttpRealipModule
# File name: cf_nginx_realip.rb
if ARGV.first == "--help"
puts "Fetches CloudFlare's official IPv4 and IPv6 addresses and formats them for use from NGinx's HttpRealipModule"
puts "Usage:\n\truby cf_nginx_realip.rb > cf_realip.conf\n\n"
puts 'Then add "include cf_realip.conf" in a http|server|location block of your nginx config'
exit
end
ips = []