Skip to content

Instantly share code, notes, and snippets.

View etagwerker's full-sized avatar
🏠
Working from home

Ernesto Tagwerker etagwerker

🏠
Working from home
View GitHub Profile
@etagwerker
etagwerker / assets.rb
Created July 8, 2011 12:31 — forked from juggy/assets.rb
env["REQUEST_PATH"] may be nil
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"] && request.env["REQUEST_PATH"].include?(".pdf")
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}
@etagwerker
etagwerker / minimum_rights_policy.json
Created May 10, 2017 14:30 — forked from clemens/minimum_rights_policy.json
Minimum rights policy for S3 that works just fine with CarrierWave/Fog
{
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:ListBucket" ],
"Resource": [ "arn:aws:s3:::BUCKETNAME" ]
},
{
"Effect": "Allow",
"Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:PutObjectAcl"],
@etagwerker
etagwerker / curl_to_ab.py
Last active April 11, 2020 11:15 — forked from ctolsen/curl_to_ab.py
"Copy to cURL" in Chrome to Apache Bench command -- Script for Python3
#!/usr/bin/env python3
import sys
import os
def curl_to_ab(curl_cmd: list, num: int=200, cur: int=4) -> str:
"""
Translate a cURL command created by Chrome's developer tools into a
command for ``ab``, the ApacheBench HTTP benchmarking tool.