Skip to content

Instantly share code, notes, and snippets.

root@dokku:~# wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh|DOKKU_BRANCH=master bash
Hit http://security.debian.org jessie/updates InRelease
Hit http://ftp.de.debian.org jessie InRelease
Hit http://security.debian.org jessie/updates/main Sources
Hit http://ftp.de.debian.org jessie-updates InRelease
Hit http://security.debian.org jessie/updates/main amd64 Packages
Hit http://security.debian.org jessie/updates/main Translation-en
Hit http://ftp.de.debian.org jessie/main Sources
Hit http://ftp.de.debian.org jessie/main amd64 Packages
Hit http://ftp.de.debian.org jessie/main Translation-en
@eljojo
eljojo / rant.md
Created April 9, 2015 10:14
little rant

My problem is mainly when, because of sofware, database (or anything related to IT) architecture impose its way into how the real world works.

For example, imagine Deutsche Telekom. If you have a contract for both mobile phone and internet at home with them, it's completely reasonable that they have different internal systems and thus your name is stored in different locations.

Let's say you change your name. You call Deutsche Telekom (mobile) and tell them that you changed your name, the lady tells you that she updated your name in the computer and all is good. Next month you get the invoice and it shows your old name.

My question is: is this acceptable?

@eljojo
eljojo / internet_poetry.mail
Created February 23, 2015 10:08
Every now and then I receive this weird emails with seemingly random content.
Delivered-To: 5baa711a@eljojo.net
Received: by 10.70.42.72 with SMTP id m8csp1076269pdl;
Mon, 23 Feb 2015 01:36:13 -0800 (PST)
X-Received: by 10.68.237.165 with SMTP id vd5mr17877560pbc.44.1424684173209;
Mon, 23 Feb 2015 01:36:13 -0800 (PST)
Return-Path: <Jane4b5@almaraya-uae.com>
Received: from node-ah4.pool-125-27.dynamic.totbb.net ([115.31.129.114])
by mx.google.com with ESMTP id su9si8855158pab.162.2015.02.23.01.36.12
for <5baa711a@eljojo.net>;
Mon, 23 Feb 2015 01:36:12 -0800 (PST)

Keybase proof

I hereby claim:

  • I am eljojo on github.
  • I am eljojo (https://keybase.io/eljojo) on keybase.
  • I have a public key whose fingerprint is 85DE C355 32D7 551C 39D7 F35E 7342 F862 59B0 A5D0

To claim this, I am signing this object:

@eljojo
eljojo / callback_example.rb
Created September 23, 2014 16:58
example of what a callback is using active record
class User < ActiveRecord::Base
# here we set tha callback to be executed before saving the user
before_save :create_username
def create_username
if username.blank?
self.username = "example username"
end
end
@eljojo
eljojo / callback_example.js
Last active August 29, 2015 14:06
example of what a callback is
function loadTweets() {
// first we start loading the tweets with ajax and set the callback to tweetsLoaded
$.get("/tweets", tweetsLoaded)
// then, we show a message stating that we're loading the tweets
$("#status").text("loading tweets")
}
function tweetsLoaded(tweets) {
@eljojo
eljojo / almost_rbx.rb
Last active August 29, 2015 14:04
Almost Rubinius
module Rules
class Processor
def initialize(context)
require 'parser/current'
@context = context
end
def process(command)
node = node_for_command(command)
process_node(node)
@eljojo
eljojo / using_ast_tree.rb
Last active August 29, 2015 14:04
Using the information extracted from an AST Tree, so we can do something meaningful with it.
# Using the information extracted from an AST Tree, so we can do something meaningful with it.
# this needs https://github.com/whitequark/parser
require 'parser/current'
op = "(a > 3) or (a == b) or ((b > 3.months) and (c =~ 'd')) or jojo?"
parsed = Parser::CurrentRuby.parse(op)
def clean_begin(node)
return node unless node.type == :begin
raise "begin has more than one children!" if node.children.length > 1
@eljojo
eljojo / savings_per_second.rb
Created July 8, 2014 11:09
savings per year
$savings_per_year = 300.0
seconds_in_a_year = 3600 * 24 * 365
$money = $savings_per_year/seconds_in_a_year
elapsed_seconds = 0.0
loop do
puts("you just lost %.9f euros by not switching your electricity company" % ((elapsed_seconds += 1) * $money))
sleep 1
end
@eljojo
eljojo / simple_queue.rb
Created April 29, 2014 11:11
simple redis queue. it might have bugs.
class SimpleQueue
def initialize(name)
@name = name.to_sym
end
def push(items)
return unless items.present?
items = [items] unless items.is_a?(Array)
with_redis do |redis|
redis.sadd(redis_key, items.map(&:to_s))