Skip to content

Instantly share code, notes, and snippets.

Charles Blaxland ampedandwired

  • Sydney, Australia
Block or report user

Report or block ampedandwired

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ampedandwired
ampedandwired / jenkins.conf
Created Sep 25, 2013
Configuring nginx as a Jenkins proxy with SSL
View jenkins.conf
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80 default;
rewrite ^ https://$host$request_uri? permanent;
}
server {
@ampedandwired
ampedandwired / gist:3682627
Created Sep 9, 2012
A simple command line client for JSON (Rails) APIs - basically a curl wrapper
View gist:3682627
#!/bin/bash
baseurl='http://localhost:3000'
output_file=zb.out
rm $output_file
action=`echo $1 | tr '[a-z]' '[A-Z]'`
shift
url=$1.json
shift
@ampedandwired
ampedandwired / gist:3385002
Last active Oct 8, 2017
Zip a directory to memory in Ruby. The rubyzip library is pretty hard to use. I tried for ages to figure out how to zip a directory to a string in memory. So here's an example that zips the given directory to a Ruby StringIO object using rubyzip.
View gist:3385002
require 'zip/zip'
def zip(dir)
Zip::ZipOutputStream::write_buffer do |zos|
Dir["#{dir}/**/**"].each do |file|
path_for_file_in_zip = file.sub(/\A#{dir}\//, '')
if !File.directory?(file)
zip_entry = zos.put_next_entry(path_for_file_in_zip)
zos << IO.read(file)
end
You can’t perform that action at this time.