brew install softhsm opensc
import sys | |
import requests | |
from flatten_json import flatten | |
content = [] | |
# System Info | |
system_info = requests.get('http://localhost:3333/system/info') | |
flat_system_info = flatten(system_info.json()) |
First a little background info. The Berkeley DB Java Edition library used by the pools (if so configured) uses a log structured file format. What this means is that the files of the database (called log segments) are only ever appended to. Once they reach a certain size (10 MB by default), a new log segment is created and the previous log segments are never modified. If existing data is modified or deleted, this leaves unused fragments in these these database files. Once the utilization (amount of data still in use) falls under a certain level, remaining data is copied to the end of the last segment and the original segment is deleted (this is all text book log structured database).
Berkeley DB uses a btree structure, i.e. it is structured as a tree, with the actual data at the leafs and the internal nodes allowing fast search of the data.
Berkeley DB internally maintains a cache of the files. The default in dCache is to use 20% of the maximum heap size as a cache for Berkeley DB. It is a recommendation fr
defmodule HerokuName do | |
def generate() do | |
adjectives = [ | |
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", | |
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", | |
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", | |
"billowing", "broken", "cold", "damp", "falling", "frosty", "green", | |
"long", "late", "bold", "little", "morning", "muddy", | |
"red", "rough", "still", "small", "sparkling", "shy", |
I hereby claim:
- I am stuartbain on github.
- I am stuartbain (https://keybase.io/stuartbain) on keybase.
- I have a public key ASAmMdt8iwTT9VLCcuCJhxAyfFccWPpZL3aTB-qQy50z3Ao
To claim this, I am signing this object:
# https://coderwall.com/p/suyeew | |
# /app/helpers/devise_helper.rb | |
module DeviseHelper | |
def devise_error_messages! | |
return '' if resource.errors.empty? | |
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t('errors.messages.not_saved', |
MyApp::Application.config.session_store :cookie_store, key: '_my_app_session', domain: { | |
production: '.example.com', | |
development: '.example.dev' | |
}.fetch(Rails.env.to_sym, :all) |
class SubdomainValidator < ActiveModel::EachValidator | |
# http://matthewhutchinson.net/2010/10/27/rails-3-subdomain-validation-activemodeleachvalidator | |
def validate_each(object, attribute, value) | |
return unless value.present? | |
reserved_names = %w(www ftp mail pop smtp admin ssl sftp) | |
reserved_names = options[:reserved] if options[:reserved] | |
if reserved_names.include?(value) | |
object.errors[attribute] << 'cannot be a reserved name' | |
end |
module CheckDigit | |
class SEDOL | |
SEDOL_WEIGHTS = [1,3,1,7,3,9] | |
SEDOL_PATTERN = /[B-Db-dF-Hf-hJ-Nj-nP-Tp-tV-Xv-xYyZz\d]{6}/ # http://regexlib.com/REDetails.aspx?regexp_id=1044 | |
def self.calculate(sedol) | |
raise 'Invalid pattern' unless sedol =~ SEDOL_PATTERN |