save_and_open_page
have_button(locator)
#!/usr/bin/env python | |
# mypy: allow-untyped-defs | |
""" | |
This script is used for applying affinity settings for various hardware devices. | |
Script originally based on Intel's [set_irq_affinity.sh](https://gist.github.com/SaveTheRbtz/8875474). | |
Over the years it was updated with heuristics based on the shape of Dropbox infrastructure. | |
Currently, this script can manage IRQ affinities, RPS, XPS, and RXQS. For the description of |
use std::process::{Command}; | |
fn main() { | |
let output = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").output(); | |
println!("{:?}", output.unwrap().stdout.len()); | |
} | |
~/stuff ❯❯❯ time ./dwl | |
104857600 | |
./dwl 16.22s user 1.80s system 23% cpu 1:15.24 total |
class RangedHash | |
def initialize(hash={}) | |
@ranged_hash = hash | |
end | |
def []=(key, value) | |
@ranged_hash[key] = value | |
end | |
def [](key) |
(ns phrase | |
(:require [clojure.string :as str])) | |
(defn- strip-punctuation [phrase] | |
(str/replace phrase #"[^\w\s]" "") | |
) | |
(defn word-count [phrase] | |
(frequencies (str/split(str/lower-case (strip-punctuation phrase)) #"\s+")) | |
) |
require "benchmark/ips" | |
Benchmark.ips do |x| | |
x.report("double quote assignment:") {a = "yo man"} | |
x.report("double quote +:") {|i| a = "yo man" + i.to_s} | |
x.report("double quote <<:") {|i| a = "yo man" << i.to_s} | |
x.report("double quote interpolation:") {|i| a = "yo man #{i}"} | |
x.report("single quote assignment:") {a = 'yo man'} | |
x.report("single quote +:") {|i| a = 'yo man' + i.to_s} |
# Any difference between: | |
[:db_create, :db_drop, :db_list].each do |cmd| | |
#THIS: | |
define_method(cmd) do |*args| | |
NoBrainer.run { RethinkDB::RQL.send(cmd, *args) } | |
end | |
# OR THIS |
let(:date) do | |
Time.now | |
end | |
it "converts the elements properly" do | |
p date.zone | |
mongoized.first.should eq(date) | |
p date.zone | |
end |
# 2. Include Sweeping module in your controller(s) to have cache_sweeper | |
# method to be avaliable, or right in ApplicationController so it will be | |
# available in all controllers inheriting from it. | |
class ApplicationController < ActionController::Base | |
include ActionController::Caching::Sweeping | |
# ... | |
end |
require 'celluloid' | |
class Yo | |
include Celluloid | |
end | |
puts Celluloid::Actor.all.length |