New approach:
-
spawn('sh', ...)
Find the
-c
arg.Parse, and split up by
&&
and||
and|
and;
, expanding each bit.Then spawn the exploded command line. When we explode it, we need to do the same thing with looking up env and shebang results.
daemon off; | |
# Heroku dynos have at least 4 cores. | |
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; | |
events { | |
use epoll; | |
accept_mutex on; | |
worker_connections 1024; | |
} |
for i in $(seq 1 1000); do bash -c "time dig @8.8.8.8 redhat.com>/dev/null &"; done 2>&1 | grep "^real" | grep -v "0m0" |
#!/usr/bin/env ruby | |
require "codeclimate-test-reporter" | |
branch = ENV['CIRCLE_BRANCH'] | |
node_index = ENV['CIRCLE_NODE_INDEX'].to_i | |
node_total = ENV['CIRCLE_NODE_TOTAL'].to_i | |
artifacts_dir = ENV['CIRCLE_ARTIFACTS'] | |
coverage_dir = File.join("..", "..", "..", ENV['CIRCLE_ARTIFACTS'], "coverage") | |
filename = '.resultset.json' |
require 'digest' | |
require 'net/http' | |
gem_file = 'rubygems-update-2.4.8.gem' | |
# Reference: https://rubygems.org/gems/rubygems-update/versions/2.4.8 | |
sha256hash = "dbed858db605923d9cc77080de1a5f1ce6ac3c68924877c78665e0d85d7b3e73" | |
################################################## | |
# Download the Gem from RubyGems.org (over HTTPS) |
require 'securerandom' | |
require 'benchmark' | |
# written to allow 65,536 unique array items | |
array_of_x = lambda {|x| SecureRandom.hex(x*2).scan(/..../) } | |
module Refinements | |
module BooleanUniqWithDupUniqBang | |
refine Array do | |
def uniq? |
#require 'rack/request' | |
# Rack middleware to decode a `Transfer-Encoding: chunked` HTTP request. | |
# | |
# USAGE NOTE: | |
# | |
# Some HTTP servers (Webrick and Unicorn/Rabinbows/Zbatery) already decode the | |
# chunked stream, but they leave the 'Transfer-Encoding' header and don't bother | |
# to add a 'Content-Length' header, which causes rails ActionDispatch::Request | |
# to not parse the whole request body. |
#!/bin/bash | |
# Copied from http://willwarren.com/2014/07/03/roll-dynamic-dns-service-using-amazon-route53/ | |
# Externalizing the zone ID and CNAME | |
if [ -z "$1" ] | |
then | |
echo "The first argument needs to be the Hosted Zone ID, i.e. BJBK35SKMM9OE" | |
exit 1 | |
fi |
require 'net/http' | |
require 'json' | |
def rubygems_get(gem_name: "", endpoint: "") | |
path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json" | |
JSON.parse(Net::HTTP.get("rubygems.org", path)) | |
end | |
results = rubygems_get(gem_name: "mime-types", endpoint: "reverse_dependencies") |
New approach:
spawn('sh', ...)
Find the -c
arg.
Parse, and split up by &&
and ||
and |
and ;
, expanding each bit.
Then spawn the exploded command line. When we explode it, we need to do the same thing with looking up env and shebang results.