Skip to content

Instantly share code, notes, and snippets.

View ruyrocha's full-sized avatar

Ruy Rocha ruyrocha

  • Somewhere over the rainbow
View GitHub Profile
@ruyrocha
ruyrocha / javascript.rb
Last active October 28, 2018 01:46
Capybara with headless Chrome
Capybara.register_driver :chrome do |app|
# Ensure a reasonable amount of time for Read/Open timeouts
http_client = Selenium::WebDriver::Remote::Http::Default.new(
read_timeout: 30,
open_timeout: 30
)
# Explicitly set the Chrome capabilities
browser_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {
@ruyrocha
ruyrocha / no_animations.rb
Created October 24, 2018 13:49 — forked from keithtom/no_animations.rb
Rack Middleware to disable Disable CSS3/jQuery Animations for Capybara
module Rack
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues.
# Usage for Rails:
# in config/environments/test.rb
# config.middleware.use Rack::NoAnimations
class NoAnimations
def initialize(app, options = {})
@app = app
end
@ruyrocha
ruyrocha / docker-cleanup-resources.md
Created April 3, 2018 19:00 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

Hetzner Online AG http://www.hetzner.de/
SoftLayer http://www.softlayer.com/
UA Servers https://itldc.com/
webexxpurts.com http://webexxpurts.com/
Host Europe http://www.hosteurope.de/
OVH http://www.ovh.co.uk/
HostKey http://www.hostkey.com/
PEER 1 http://www.peer1.com/
3NT UK http://3nt.com/
eukhost.com http://eukhost.com/
@ruyrocha
ruyrocha / osx-10.9-setup.md
Created July 29, 2016 12:37 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@ruyrocha
ruyrocha / set_dns_on_boot2docker.sh
Created November 24, 2015 13:32
Set a __good__ DNS when you cannot download images on Docker (while using boot2docker)
➜ ~ boot2docker ssh
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
~ # redis-benchmark -s /var/run/redis/redis.sock -q -n 10000
PING_INLINE: 156250.00 requests per second
PING_BULK: 196078.44 requests per second
SET: 212765.97 requests per second
GET: 185185.19 requests per second
INCR: 217391.30 requests per second
LPUSH: 200000.00 requests per second
LPOP: 222222.22 requests per second
SADD: 204081.64 requests per second
SPOP: 217391.30 requests per second
@ruyrocha
ruyrocha / .irbrc
Created February 5, 2014 12:34 — forked from amokan/.irbrc
# Info/code for this file were borrowed from the following places:
# http://bit.ly/174dkWL
# https://gist.github.com/adamcrown/932231
# https://gist.github.com/patmcnally/893833
begin
# ansi colors
ANSI = {}
ANSI[:RESET] = "\e[0m"
@ruyrocha
ruyrocha / CustomEventHandler
Last active December 26, 2015 10:49
This version of CustomEventHandler.pm will throw debug output for API calls into /usr/local/cpanel/logs/error_log
package Cpanel::CustomEventHandler;
# cpanel12 - CustomEventHandler.pm Copyright(c) 2008 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
#
# VERSION 1.0
#
@ruyrocha
ruyrocha / sql-client-patch
Created July 14, 2013 04:57
MariaDB client patch to prevent local command execution as root user
--- mariadb-5.5.31/client/mysql.cc 2013-07-14 01:13:16.594865591 -0300
+++ mariadb-5.5.31-safe-client/client/mysql.cc 2013-07-14 01:13:19.358678907 -0300
@@ -93,6 +93,11 @@
#define HAVE_READLINE
#define USE_POPEN
#endif
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif /* HAVE_PWD_H */