Skip to content

Instantly share code, notes, and snippets.

View jnevelson's full-sized avatar

Jonathan Nevelson jnevelson

View GitHub Profile
@jnevelson
jnevelson / chef.rb
Last active August 29, 2017 17:18
chef lazy evaluation
# download current file
execute 'get current' do
command "s3cmd get s3://bucket/current /tmp/"
end
# read current file
ruby_block 'read current' do
block do
current = ::File.read('/tmp/current').chomp
node.run_state['current'] = current
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
)
var data = `
@jnevelson
jnevelson / ohai-errors
Created April 9, 2014 00:00
chef 11.12 ohai nginx error
[2014-04-08T23:15:30+00:00] WARN: [DEPRECATION] Plugin at /etc/chef/ohai_plugins/nginx.rb is a version 6 plugin. Version 6 plugins will not be supported in future releases of Ohai. Please upgrade your plugin to version 7 plugin syntax. For more information visit here: docs.opscode.com/ohai_custom.html
[2014-04-08T23:15:30+00:00] ERROR: Encountered error while running plugins: #<Ohai::Exceptions::AttributeNotFound: No such attribute: 'nginx'>
================================================================================
Error executing action `reload` on resource 'ohai[reload_nginx]'
================================================================================
Ohai::Exceptions::AttributeNotFound
-----------------------------------
@jnevelson
jnevelson / gist:10208717
Last active August 29, 2015 13:58
chef nginx error
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.
To fix this issue add an entry like this to your configuration file:
```
# Verify all HTTPS connections (recommended)
ssl_verify_mode :verify_peer

Keybase proof

I hereby claim:

  • I am jnevelson on github.
  • I am jnevelson (https://keybase.io/jnevelson) on keybase.
  • I have the public key with fingerprint 7AF9 D2B7 EA21 0148 55FB  38D7 E7E8 B02E 4CCF 83EA

To claim this, I am signing this object:

@jnevelson
jnevelson / index.html
Created November 6, 2013 01:28
rtc demo
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script src="rtc.js"></script>
</head>
<body>
<video id='video' autoplay></video>
<input id='text' type='text'></input>
@jnevelson
jnevelson / pubnub_listener.rb
Last active December 10, 2015 19:08
pubnub listener
class PubnubListener
def initialize(pubkey, subkey, secretkey)
@pubnub = Pubnub.new(pubkey, subkey, secretkey, false)
end
def listen(channel)
@pubnub.subscribe('channel' => channel, 'callback' => lambda { |msg| puts msg })
end
@jnevelson
jnevelson / gist:2402105
Created April 16, 2012 22:36
Paypal recurring IPN
def paypal_ipn
query = "cmd=_notify-validate"
request.params.each_pair do |key, value|
query = "#{query}&#{key}=#{value}" if key != "register/pay_pal_ipn.html/pay_pal_ipn"
end
if (response = RestClient.post(base_paypal_url(true), query)) && response[/VERIFIED/]
process_paypal
render :text => "OK"
else