( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
#!/usr/bin/env dtrace -s | |
/* | |
* DTrace script to observe UNIX socket reads/writes for RubyMotion apps running | |
* in the iOS Simulator. | |
* | |
* Usage: sudo dtrace_rubymotion_repl <pid of running RubyMotion iOS app> | |
* | |
*/ | |
syscall::sendto:entry |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#!/usr/bin/env ruby | |
recipe_path = ARGV[0] | |
if recipe_path.nil? | |
STDERR.puts "usage: chef-apply RECIPE_FILE" | |
exit 1 | |
end | |
recipe_path = File.expand_path(recipe_path) |
#!/usr/bin/env ruby -I ../lib -I lib | |
# coding: utf-8 | |
require 'rtoken' | |
require 'json' | |
require 'sinatra/base' | |
require 'thin' | |
class Chat < Sinatra::Base |
#!/bin/sh | |
# | |
# Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c | |
RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" | |
posixregex -r "^(${RE_IPV4})$" \ | |
127.0.0.1 \ | |
10.0.0.1 \ | |
192.168.1.1 \ |
user www-data; | |
worker_processes 1; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
sendfile on; |
# As sudo | |
ceph osd crush remove osd.{osd-num} | |
ceph auth del osd.{osd-num} | |
ceph osd rm {osd-num} | |
ceph osd crush remove {host} |
// Copyright (c) 2017 Ismael Celis | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// The above copyright notice and this permission notice shall be included in all |
package main | |
import ( | |
"log" | |
"os" | |
"strings" | |
gq "github.com/PuerkitoBio/goquery" | |
) |