~/Code/discourse$ for i in {1..5}; do (rm -rf tmp/cache && time bundle exec rails r 'puts "Save cache"' && time bundle exec rails r 'puts "Load Cache"'; du -hs tmp/cache/bootsnap-compile-cache); done
Save cache
real 0m3.007s
user 0m2.768s
sys 0m0.196s
Load Cache
This file contains 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
# Repro case of https://bugs.ruby-lang.org/issues/13882. | |
# A thread in the middle of reading GZip-encoded content with Net::HTTP | |
# will stop a Ruby process from exiting. | |
require 'net/http' | |
PORT = 5678 | |
SLEEP = 1 | |
# Server |
This file contains 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
Description: Create a variable number of EC2 instance resources. | |
Parameters: | |
InstanceCount: | |
Description: Number of EC2 instances (must be between 1 and 10). | |
Type: Number | |
Default: 1 | |
MinValue: 1 | |
MaxValue: 10 | |
ConstraintDescription: Must be a number between 1 and 10. | |
ImageId: |
This file contains 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 ubuntu:14.04 | |
USER root | |
# set timezone to UTC by default | |
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime | |
# use unicode | |
RUN locale-gen C.UTF-8 || true | |
ENV LANG=C.UTF-8 |
This file contains 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
Started POST "/milestone/0/3021" for 127.0.0.1 at 2017-05-19 14:09:16 -0700 | |
Processing by ActivitiesController#milestone as HTML | |
Parameters: {"lines"=>"20", "attempt"=>"1", "result"=>"true", "testResult"=>"100", "time"=>"1000", "app"=>"test", "program"=>"<hey>", "user_id"=>"0", "script_level_id"=>"3021"} | |
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`deleted_at` IS NULL AND `users`.`id` = 944 ORDER BY `users`.`id` ASC LIMIT 1 | |
Query Trace > app/controllers/application_controller.rb:227:in `current_user' | |
from app/controllers/activities_controller.rb:72:in `milestone' | |
from app/controllers/application_controller.rb:143:in `block in with_locale' | |
from app/controllers/application_controller.rb:142:in `with_locale' | |
(0.4ms) SELECT `user_permissions`.`permission` FROM `user_permissions` WHERE `user_permissions`.`user_id` = 944 | |
Query Trace > app/models/user.rb:226:in `permission?' |
This file contains 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
$ dig code.org | |
; <<>> DiG 9.10.3-P4-Ubuntu <<>> code.org | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48448 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1 | |
;; OPT PSEUDOSECTION: | |
; EDNS: version: 0, flags:; udp: 65494 |
This file contains 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
#!/usr/bin/env ruby | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
# Rails master | |
gem 'rails', '5.0.0' | |
gem 'sqlite3' | |
gem 'ransack' |
(from original author) For a project I am on I need to use a key-value store to converts file-paths to fixnum IDs. The dataset will typically be in the range of 100 000 to 1 000 000. These tests use 305 000 file paths to fixnum IDs.
The Different Key-Value stores tested are:
Daybreak: "Daybreak is a simple and very fast key value store for ruby" GDBM: GNU dbm. "a simple database engine for storing key-value pairs on disk." DBM: "The DBM class provides a wrapper to a Unix-style dbm or Database Manager library" PStore: "PStore implements a file based persistence mechanism based on a Hash. "
This file contains 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
{ | |
"Resources": { | |
"LambdaTestRes": { | |
"Type": "AWS::Lambda::Function", | |
"Properties": { | |
"Description": "Testing AWS cloud formation", | |
"FunctionName": "LambdaTest", | |
"Handler": "lambda_handler.lambda_handler", | |
"MemorySize": 128, | |
"Role": "arn:aws:iam::[account]:role/[role]", |
This file contains 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
#!/bin/bash -x | |
yum -y update --security | |
########################## | |
## ENABLE SSH RECORDING ## | |
########################## | |
# Create a new folder for the log files | |
mkdir /var/log/bastion |
NewerOlder