This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NB: Attachment#save seems to produce 0 byte files, probably would be resolved via rewind below | |
require 'mapi/msg' | |
msg = Mapi::Msg.open '/tmp/email.msg' | |
# view body | |
puts msg.properties.body | |
# save attachments | |
msg.attachments.each_with_index do |a, idx| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \ | |
-dNOPAUSE -dBATCH -dColorImageResolution=150 \ | |
-sOutputFile=output.pdf original.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"terminal.integrated.env.linux": { | |
"PROMPT_COMMAND": "history -a", | |
"HISTFILE":"${workspaceFolder}/.sh_history" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM crystallang/crystal:0.33.0-alpine-build as builder | |
WORKDIR /app | |
COPY . /app | |
RUN shards build --static --release --no-debug | |
FROM scratch | |
WORKDIR /app | |
COPY --from=builder /app/bin /bin | |
ENTRYPOINT ["/bin/<YOUR_BINARY_NAME"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hack to avoid segfault during compilation of statically-linked binary on Alpine | |
{% if flag?(:static) %} | |
require "llvm/lib_llvm" | |
require "llvm/enums" | |
{% end %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ORIGINAL | |
Time to queue remotely: 00:00:00.236023892 | |
Time to queue remotely: 00:00:00.123225651 | |
Time to queue remotely: 00:00:00.136234454 | |
Time to queue remotely: 00:00:00.140092191 | |
Time to queue remotely: 00:00:00.120226790 | |
Time to queue remotely: 00:00:00.120232020 | |
Time to queue remotely: 00:00:00.123584921 | |
Time to queue remotely: 00:00:00.148454025 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RUBY | |
1564181439.071863 [0 99.99.99.99:43608] "multi" | |
1564181439.131934 [0 99.99.99.99:43608] "sadd" "queues" "from_sk_ruby" | |
1564181439.131955 [0 99.99.99.99:43608] "lpush" "queue:from_sk_ruby" "{\"queue\":\"from_sk_ruby\",\"class\":\"Sample::MyWorker\",\"args\":[{\"test\":\"payload\",\"activity_id\":15838549}],\"retry\":true,\"jid\":\"ab8ed2a13e41756c5a4dde89\",\"created_at\":1564181430.3014073,\"enqueued_at\":1564181439.043673}" | |
1564181439.132031 [0 99.99.99.99:43608] "exec" | |
1564181439.180776 [0 99.99.99.99:43608] "multi" | |
1564181439.223040 [0 99.99.99.99:43608] "sadd" "queues" "from_sk_ruby" | |
1564181439.223064 [0 99.99.99.99:43608] "lpush" "queue:from_sk_ruby" "{\"queue\":\"from_sk_ruby\",\"class\":\"Sample::MyWorker\",\"args\":[{\"test\":\"payload\",\"activity_id\":15838549}],\"retry\":true,\"jid\":\"ab8ed2a13e41756c5a4dde89\",\"created_at\":1564181430.3014073,\"enqueued_at\":1564181439.1471574}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
require 'bigdecimal' | |
Benchmark.ips do |x| | |
x.report('Rational from String') { '214.04'.to_r - '74.79'.to_r + '74.79'.to_r > '214.04'.to_r } | |
x.report('Rational from Float') { 214.04.to_r - 74.79.to_r + 74.79.to_r > 214.04.to_r } | |
x.report('BigDecimal from String') { BigDecimal.new('214.04') - BigDecimal.new('74.79') + BigDecimal.new('74.79') > BigDecimal.new('214.04') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimpleForm | |
module Inputs | |
class StaticInput < SimpleForm::Inputs::StringInput | |
def input | |
template.content_tag(:p, object.send(attribute_name), class: 'form-control-static') | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['MEMORY_PROFILING'] | |
require 'benchmark' | |
def require(file) | |
puts `pmap #{Process.pid} | grep 'total'` | |
puts Benchmark.measure('') { super }.format("%t require #{file}") | |
end | |
end |
NewerOlder