Skip to content

Instantly share code, notes, and snippets.

#
# Cookbook Name:: download_assets
# Recipe:: default
#
# Copyright 2012, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
remote_file "/home/remote/program-#{node[:version]}.tar.gz" do
source "https://retail.test.com/program-#{node[:version]}.tar.gz"
"GET /nodes/m2164 HTTP/1.1" 406 9406 "-" "Chef Client/0.10.8 (ruby-1.8.7-p352; ohai-0.6.10; i686-linux; +http://opscode.com)"
75.207.121.215 - - [03/May/2012:16:39:58 -0500] "GET /nodes/m2164 HTTP/1.1" 406 9406 "-" "Chef Client/0.10.8 (ruby-1.8.7-p352; ohai-0.6.10; i686-linux; +http://opscode.com)"
192.168.0.67 - - [03/May/2012:16:41:01 -0500] "\x16\x03\x00\x00U\x01\x00\x00Q\x03\x00O���1QZ8�ㅔW.\x02^.9\x05�\x0B͆�E\x07짐�e�\x00\x00*\x00�\x00�\x00�\x009\x008\x00�\x005\x00E\x00D\x00f\x003\x002\x00�\x00A\x00\x04\x00\x05\x00/\x00\x16\x00\x13��\x00" 400 172 "-" "-"
192.168.0.67 - - [03/May/2012:16:41:07 -0500] "GET / HTTP/1.1" 200 638 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19"
192.168.0.67 - - [03/May/2012:16:41:07 -0500] "GET /favicon.ico HTTP/1.1" 404 14 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19"
192.168.0.67 - - [03/May/2012:16:41:18 -0500] "-" 400 0 "-" "-"
192.168.0.67 - - [03
location / {
try_files $uri @backend;
}
location @backend {
proxy_set_header X-Forwarded-Proto 'https';
proxy_set_header Host $server_name;
proxy_pass http://chef-server.newground.com:4000;
}
server
{
listen 80;
server_name xml.newground.com;
access_log /var/log/nginx/xml.newground.com.access.log;
error_log /var/log/nginx/xml.newground.com.error.log;
root /var/www/xml/current/public;
index index.php index.html index.htm;
012/05/09 09:23:14 [emerg] 23889#0: unexpected "}" in /opt/nginx/conf/nginx.conf:98
2012/05/09 10:28:07 [warn] 28194#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /opt/nginx/conf/nginx.conf:1
2012/05/09 10:28:07 [emerg] 28194#0: open() "/opt/nginx/logs/nginx.pid" failed (13: Permission denied)
2012/05/09 10:28:21 [emerg] 28227#0: open() "/opt/nginx/logs/nginx.pid" failed (13: Permission denied)
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
<ArrayOfWeatherData>
<WeatherData>
<LocalTempUnit>Fahrenheit</LocalTempUnit>
<Humidity>38</Humidity>
<HasData>true</HasData>
<DateTime>2012-05-11T12:53:00</DateTime>
<DateTimeUTC>Fri, 11 May 2012 17:53:00 GMT</DateTimeUTC>
<LowTempLocalized>57</LowTempLocalized>
<HighTempLocalized>79</HighTempLocalized>
<CurrentTempLocalized>73</CurrentTempLocalized>
desc "Fetch weather"
task :fetch_weather => :environment do
require 'nokogiri'
require 'open-uri'
@weathers = Weather.all
@weathers.each do |weather|
url = "URL.com/1w.xml?location=#{weather.zip}"
puts url
doc = Nokogiri::HTML(open(url))
def make_purchase(user)
if valid?
amount = (DO YOUR CONVERSION STUFF HERE)
cu = Stripe::Customer.retrieve(user.stripe_customer_token)
cu.card = stripe_card_token # obtained with Stripe.js
cu.save
customer = Stripe::Charge.create(customer: user.stripe_customer_token, description: user.email, amount: 500, currency: 'usd')
save!
end
end
desc "Fetch weather"
task :fetch_weather => :environment do
require 'nokogiri'
require 'open-uri'
@weathers = Weather.all
@weathers.each do |weather|
url = "http://kitchen.screenfeed.com/weather/both/dJlC_W1LY0-DukSjsfJV1w.xml?location=#{weather.zip}"
puts url
doc = Nokogiri::XML(open(url))