Skip to content

Instantly share code, notes, and snippets.

View arthurnn's full-sized avatar
🟢
CI is passing

Arthur Nogueira Neves arthurnn

🟢
CI is passing
View GitHub Profile
@wisq
wisq / gist:0fa021df52a3bd2485ac
Last active June 3, 2023 04:18
Protip: Bisecting a single commit

Situation: Some commit (on master, but not necessarily head of master) has broken things, but it's a big commit and it's not clear what part broke things.

% git checkout master
% git checkout -b bisect-branch
% git revert <offending commit>

(test here to make sure reverting fixed your problem)

% git bisect start
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@dblock
dblock / carrierwave.rb
Created January 31, 2012 13:55
Delayed image processing with CarrierWave
CarrierWave.configure do |config|
...
end
Mongoid::Document::ClassMethods.send(:include, DelayedImageProcessing)
module CarrierWave
# http://sleeplesscoding.blogspot.com/2011/09/recreate-single-version-of.html
# Note: is_processing_delayed should be set before calling recreate_version! if the version depends on it.
@dylanahsmith
dylanahsmith / test.rb
Last active January 15, 2019 12:46
mysql2 EINTR on connect error reproduction
#!/usr/bin/env ruby
require 'mysql2'
trap("USR2") {}
pid = fork do
loop do
client = Mysql2::Client.new
client.close
module ActionControllerRedirectPatch
extend ActiveSupport::Concern
class BadRedirectTo < StandardError; end
included do
config_accessor :allowed_url_protocols
self.allowed_url_protocols = ["http", "https", "mailto"]
end
@xaviershay
xaviershay / ruby_live_gc_stats.rb
Created November 10, 2013 21:17
naive jstat proof-of-concept for ruby
Thread.new do
GC::Profiler.enable
current_message = ""
epoch = Time.now
total_time = 0
gc_events = 0
heap_use = 0
heap_size = 0
fmt = "%7s %5s %15s %15s %10s"
unbind C-b
set -g prefix C-a
bind a send-prefix
unbind ^C
bind ^C new-window
bind c new-window
unbind ^a
bind C-a last-window
anonymous
anonymous / timed_versioning.rb
Created December 17, 2012 12:38
Basic Mongoid versioning extension, where version number is timestamp. This allows to use method version_at to get object at specific time
# encoding: utf-8
module Mongoid
# Include this module to get automatic versioning of root level documents.
# This will add a version field to the +Document+ and a has_many association
# with all the versions contained in it.
module TimedVersioning
extend ActiveSupport::Concern
@olivierlacan
olivierlacan / github_conflict_resolution.md
Created August 29, 2015 19:03
I dream of easier merge conflict resolution on GitHub Pull Requests

Howdy,

It's currently a bit of a hassle (unless I'm doing it wrong) to fix a PR that used to be green but is now unmergeable due to an simple little merge conflict with master.

It would be quite fantabulous if I could access the swanky invisible PR branches from the web interface in order to quickly fix the merge conflict and merge/close the PR without having to:

  • ask & wait for the submitter to fix a conflict they might not understand better than I do (since master likely caused it if the branch is green)
  • tediously add the submitter's repo as a remote and pull their branch, merge master in it to fix the conflict and either submit a PR to their fork or merge it into master directly (which sadly by-passes the existing PR)
  • do the local PR checkout trick (but I'm lazy, don't make me do it!)

A dream solution that would make GitHub even more addictive would be an interactive conflict resolutio

Hi David
I'm impressed with your back ground and your responsibilities at 37signals. When researching your profile I also found that you have 4.8K followers and have been starred 29 times on GitHub. This speaks volumes to your work and your high technical expertise. I'd love the opportunity to speak with you about a Ruby Engineering role I'm currently working on for Heroku. I'd like to share more details about the position and find out if you or anyone you know would be interested.
Heroku is a Platform as a Service (PaaS) that lets you deploy, run and manage applications written in Ruby, Node.js, Java, Python, Clojure and Scala. Heroku is owned by Salesforce however, we operate as a completely separate entity. This allows us to maintain our technology, culture and the formula that has made us so successful.
Anyway, it would be great to set up sometime to chat. I am more than happy to answer any questions that you might have and it would be great for me to hear about what you are looking for in any potentia