Skip to content

Instantly share code, notes, and snippets.

def compress(string)
compressed = string.chars.inject([]) do |accu, char|
if accu.empty? || accu.last.first != char
accu << [char, 1]
else
accu[0...-1] << [char, accu.last.last + 1]
end
end.map(&:join).join
[string, compressed].min_by(&:length)
@rlb3
rlb3 / build_openssl_dylib.sh
Last active August 29, 2015 14:10 — forked from bernardotorres/build_openssl_dylib.sh
Build latest OpenSSL Universal Binary on OSX.
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
@rlb3
rlb3 / org-tutorial.org
Created December 4, 2014 20:06
Orgmode Tutorial

Orgmode Tutorial

Todo list

  • State “DONE” from “TODO” [2012-02-15 Wed 08:05]
  • Title
  • Todo
  • Headers
  • Tags
@rlb3
rlb3 / weaving.org
Last active August 29, 2015 14:12 — forked from egh/weaving.org

Weaving a budget with org-mode & ledger

ledger comes with a built in budget system, but I wanted to get an “envelope”, or “YNAB” style budget working. While this was easy to do in theory, in practice it proved more difficult. The theory is pretty simple; enevelope budgeting merely requires you to create some new accounts to keep track of each “envelope” of money. But in practice, it requires a huge amount of duplicate data-entry, because even when using ledger’s automatic transactions, because each month’s budget is mostly the same but not necessarily exactly the same.The following

(setq gnus-select-method '(nnnil))
(setq gnus-secondary-select-methods '((nntp "news.gwene.org")))
@rlb3
rlb3 / org-agendas.el
Created December 31, 2014 18:52
Switch between work and personal agendas
(defun rlb3/work-agenda ()
(interactive)
(let ((org-agenda-files '("~/Dropbox/org-files/gameplan.org" "~/Dropbox/org-files/chaione.org")))
(org-agenda)))
(defun rlb3/personal-agenda ()
(interactive)
(let ((org-agenda-files '( "~/Dropbox/org-files/personal.org")))
(org-agenda)))
@rlb3
rlb3 / init.el
Created January 1, 2015 01:39
Launcher Map
(define-prefix-command 'launcher-map)
(bind-key "C-x l" 'launcher-map)
(bind-keys :map launcher-map
("a" . ansi-term)
("c" . calc)
("C" . calendar)
("d" . ediff-buffers)
("e" . eshell)
("h" . man)

Keybase proof

I hereby claim:

  • I am rlb3 on github.
  • I am rlb3 (https://keybase.io/rlb3) on keybase.
  • I have a public key whose fingerprint is C346 FA6D 431F EF05 C8FE EC1B 1E44 890B 741E 9B56

To claim this, I am signing this object:

require 'openssl'
require 'Base64'
key = "secret-key"
data = "some data to be signed"
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), key, data)).strip()
puts "(•_•)"
puts "( •_•)>⌐■-■"
puts "(⌐■_■)"