Skip to content

Instantly share code, notes, and snippets.

View erubboli's full-sized avatar

Enrico Rubboli erubboli

View GitHub Profile
# Example of .jrubyrc
# Set compilaton mode. JIT = at runtime; FORCE = before execution. (JIT, FORCE, OFF, OFFIR)
#compile.mode = JIT
# Dump to console all bytecode generated at runtime.
# compile.dump = true
# Enable verbose JIT logging (reports failed compilation)
# jit.logging.verbose = true
require 'ohm'
require 'ohm/json'
module MyModule
class User < Ohm::Model
set :posts, :Post
attribute :name
def to_hash
super.merge( :name => name)
@erubboli
erubboli / ping.rb
Last active December 11, 2015 21:59
0.upto(255) do |n|
ip = "192.168.2.#{n}"
printf "ping #{ip}"
`ping -c 1 -q -o -t 1 #{ip} 2>/dev/null`
if $?.to_i == 0
printf " ok "
end
printf "\n"
end
Protection methods :
- OAUTH2
- pros:
- already in place
- secure
- cons:
- increase latency because of the bouncing requests (verify)
- very complicated (verify)
q : 20
e : 14
t : 14
o : 10
i : 10
l : 8
a : 8
d : 8
n : 7
@erubboli
erubboli / keybase.md
Last active October 21, 2016 17:50
keybase.md

Keybase proof

I hereby claim:

  • I am erubboli on github.
  • I am dn2k (https://keybase.io/dn2k) on keybase.
  • I have a public key ASAlYiyTHeBhEvu-HKODGBC-4ldpkl9ycqOm6CTzwdLljwo

To claim this, I am signing this object:

@erubboli
erubboli / hosts
Created August 6, 2014 10:18
for a safer facebook experience
# F**k you Facebook
127.0.0.1 www.facebook.com www.facebook.it facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.static.ak.fbcdn.net
127.0.0.1 login.facebook.com www.login.facebook.com
127.0.0.1 fbcdn.net www.fbcdn.net fbcdn.com
127.0.0.1 www.fbcdn.com
127.0.0.1 static.ak.connect.facebook.com
127.0.0.1 www.static.ak.connect.facebook.com
@erubboli
erubboli / archive.sql
Created September 3, 2014 10:33
archiving using CTE (pg)
WITH archive AS (
DELETE FROM arrivals
WHERE created_at < now() - interval '1 hours'
RETURNING *
)
INSERT INTO archived_arrivals
SELECT * FROM archive;
DELETE FROM archived_arrivals
WHERE created_at < now() - interval '3 days';
@erubboli
erubboli / ping_google.txt
Created January 30, 2015 18:08
bad broadband in span
...
64 bytes from 8.8.8.8: icmp_seq=873 ttl=51 time=209.273 ms
64 bytes from 8.8.8.8: icmp_seq=874 ttl=51 time=205.171 ms
64 bytes from 8.8.8.8: icmp_seq=875 ttl=51 time=260.590 ms
64 bytes from 8.8.8.8: icmp_seq=876 ttl=51 time=191.092 ms
64 bytes from 8.8.8.8: icmp_seq=877 ttl=51 time=148.214 ms
64 bytes from 8.8.8.8: icmp_seq=878 ttl=51 time=269.562 ms
64 bytes from 8.8.8.8: icmp_seq=879 ttl=51 time=175.251 ms
64 bytes from 8.8.8.8: icmp_seq=880 ttl=51 time=115.748 ms
64 bytes from 8.8.8.8: icmp_seq=881 ttl=51 time=233.753 ms
/* Box for the udoo 7'' touch screen */
/* Author: Enrico Rubboli */
// box size
box = [180,115,35];
round_size = 2;
inner_box = [box[0]-round_size*2, box[1] - round_size*2, box[2]];
box_color = "white";
// part of the display visible from the outside