I hereby claim:
- I am czj on github.
- I am czj (https://keybase.io/czj) on keybase.
- I have a public key ASA-7J6_QjVmXe6nnNopADEypiIhM1vH2gbdW1hnns-hzAo
To claim this, I am signing this object:
gem "lograge" | |
gem "logstash-event" | |
gem "logstash-logger" |
#!/usr/bin/env ruby | |
require "bundler/inline" | |
gemfile { gem "slack-notifier" } | |
require "slack-notifier" | |
Slack::Notifier.new("https://hooks.slack.com/services/xxxxxxx").ping("• _#{query}_") | |
logs_dir = "~/Documents/work_logs" | |
query = ARGV[0].to_s.delete('\\') |
I hereby claim:
To claim this, I am signing this object:
# Ruby CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-ruby/ for more details | |
# | |
version: 2.1 | |
executors: | |
my-executor: | |
docker: | |
# Main image to be used within this configuration |
class AppConfig | |
class << self | |
# Lookup via | |
# https://www.ultratools.com/tools/ipWhoisLookupResult | |
# https://www.whatismyip.com/ip-whois-lookup/ | |
BLOCKED_IPS = Set.new( | |
[ | |
"6.5.4.3", | |
"5.4.3.2", | |
"4.3.2.1", |
#!/usr/bin/env bash | |
APP_HOME=$( cd ${0%/*} && pwd -P )"/.." | |
REMOTE_SHARED="[email protected]:~/www/railsapp/shared" | |
SPEED_LIMIT="" | |
# Un-comment this line if you want to limit the download speed to un-clog your connexion | |
# SPEED_LIMIT="--bwlimit=500" | |
# -l forces copy of symlinks | |
# |
# Rewrite all commits without a certain directory | |
java -jar ~/Downloads/bfg-1.13.0.jar --delete-folders "vcr_cassettes" | |
# Remove garbage | |
git reflog expire --expire=now --all && git gc --prune=now --aggressive | |
# Push to your repo | |
git remote add origin [email protected]:my-org/my-repo.git | |
git push -u origin master |
require "benchmark/ips" | |
HASH = ("a".."zz").to_a.shuffle.to_h { |e| [e, "#{e}#{e}#{e}"] } | |
KEY = "zz" | |
def key_fast | |
HASH.key? KEY | |
end | |
def key_slow |
before = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
50_000.times { tag.span("hey") } | |
after = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
Rails.logger.debug %(tag.span("hey") } #{after - before}s) | |
before = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
50_000.times { tag.span { "hey" } } | |
after = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
Rails.logger.debug %(tag.span { "hey" } } #{after - before}s) |
# frozen_string_literal: true | |
require "benchmark" | |
array = [4, 5, 6, 11, 12, 20, 40, 64, 65, 66, 81, 83].freeze | |
set = Set.new(array).freeze | |
n = 10_000_000 | |
Benchmark.bm(7) do |x| | |
x.report("array found at position 0") { n.times { array.include?(4) } } |