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
require "zlib" | |
File.open("test/fixtures/ruby-progressbar-1.13.0.gem.data.tar.gz", "rb") do |file| | |
Zlib::GzipReader.wrap(file) do |gzio| | |
loop do | |
break if gzio.eof? | |
puts gzio.readpartial(16_384).size | |
puts "not eof" unless gzio.eof? | |
end | |
end |
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
commit e123c71f6b614b694c6efb1c07c3ba86e974a510 | |
Author: Martin Emde <martin.emde@gmail.com> | |
Date: Thu Mar 16 14:01:43 2023 -0700 | |
Trigger the bug | |
diff --git a/Gemfile b/Gemfile | |
index 4f9b666..e7f485d 100644 | |
--- a/Gemfile | |
+++ b/Gemfile |
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
104aa09a6f450996c4a25b11d214d9060b9c5b18 History.rdoc | |
c95ae329fc7b2e1ddae43c9a690f5dcc21e8d5a5 MIT-LICENSE | |
50f9b5771ab55600bd4c7f00ffa9936b797be596 README.rdoc | |
19b6b9b33031d4fd1567fb334d162c4fd3c82a32 doc/command_line_usage.rdoc | |
5acb0fc9d5fa34ca1ad149a1ff2eed5be85e1864 doc/example/Rakefile1 | |
aaf916075123108234a2d4ef40cb77db93ae92fe doc/example/Rakefile2 | |
46456e92c15ef4c3d2bd2ad190404fc4988642f5 doc/example/a.c | |
d2906ce3ae7db5229af52c84ef84736f56128d18 doc/example/b.c | |
7a042fdfeeb7316feca1cf5fd020fed7bd4c0aec doc/example/main.c | |
d81309b30330f1d227256d202d403ab786d85a57 doc/glossary.rdoc |
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
def process_abuser_flags(user, params) | |
user_flags = user.abuser_flags | |
AbuserFlag.abuse_types.keys.each do |abuse_type| | |
strikes = params[abuse_type + "_strikes"].to_i | |
next unless strikes != 0 | |
current_flag = user_flags.find { |flag| flag.abuse_type == abuse_type } | |
if current_flag.nil? && strikes != 0 |
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
# encoding:ascii-8bit | |
require 'bacon/colored_output' | |
require 'rack/utf8_sanitizer' | |
require 'memory_profiler' | |
report = MemoryProfiler.report(allow_files: "lib/rack/utf8_sanitizer") do | |
describe Rack::UTF8Sanitizer do | |
# ... SNIP ... |
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
require 'benchmark/ips' | |
require 'securerandom' | |
Benchmark.ips do |x| | |
C = 'C'.freeze | |
DATA = (1..1_000_000).map { SecureRandom.hex(1) } | |
x.report("hex.chr") do |times| | |
i = 0 | |
while i < times |
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
Rack::UTF8Sanitizer | |
with invalid UTF-8 input | |
- sanitizes plaintext entity (HTTP_USER_AGENT) | |
- sanitizes URI-like entity (REQUEST_PATH) | |
with invalid, incorrectly percent-encoded UTF-8 URI input | |
- sanitizes URI-like entity (REQUEST_PATH) | |
with invalid ASCII-8BIT input | |
- sanitizes plaintext entity (HTTP_USER_AGENT) | |
- sanitizes URI-like entity (REQUEST_PATH) | |
with invalid, incorrectly percent-encoded ASCII-8BIT URI input |
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
~: rvm install 1.9.3 | |
Installing Ruby from source to: /Users/martinemde/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... | |
ruby-1.9.3-p0 - #fetching | |
ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection... | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 9330k 100 9330k 0 0 1337k 0 0:00:06 0:00:06 --:--:-- 1869k | |
ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/martinemde/.rvm/src/ruby-1.9.3-p0 | |
ruby-1.9.3-p0 - #extracted to /Users/martinemde/.rvm/src/ruby-1.9.3-p0 |
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 | |
# encoding: UTF-8 | |
require 'net/ssh' | |
# This example script should output: ☃ | |
# | |
# | |
hostname = 'ec2-184-73-243-165.compute-1.amazonaws.com' | |
username = 'deploy' | |
command = "echo ' ☃ '" |
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
class Object | |
def self.required_attr_accessor(meth, default) | |
class_eval <<-END | |
def #{meth}=(var) | |
raise NilError unless var | |
@#{meth} = var | |
end | |
def #{meth} | |
@#{meth} || #{meth}_default | |
end |
NewerOlder