This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:26:in `update_attributes': undefined method `each_pair' for :ams1:Symbol (NoMethodError) | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:22:in `initialize' | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/associations.rb:14:in `new' | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/associations.rb:14:in `block in has_one' | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:52:in `instance_exec' | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:52:in `_cast_value' | |
| from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:28:in `block in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # getting this: | |
| # /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/client.rb:59:in `fail_on_error': {"errors"=>["#<Packet::Plan:0x007fb5e3946df8> is not a valid plan"]} (Packet::Error) | |
| # from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/client.rb:24:in `block (2 levels) in <class:Client>' | |
| require 'packet' | |
| API_KEY='' | |
| PROJECT_ID='' | |
| FACILITY_CODE='' | |
| OS_SLUG='' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| _foo_complete() { | |
| COMPREPLY=() | |
| if [ "$ZSH_VERSION" == "" ]; then | |
| local src="${BASH_SOURCE[0]}" | |
| else | |
| local src="${(%):-%x}" | |
| fi | |
| local dir=$( cd "$( dirname "$src" )" && pwd ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| for ruby in $(which -a ruby); do | |
| if $ruby -e "exit 1 if RUBY_VERSION < '2.1'"; then | |
| exec $ruby -x "$0" "$@" | |
| fi | |
| done | |
| echo "No suitable ruby 2.1+ interpreter found" >&2 | |
| exit 1 | |
| #!ruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rvm: | |
| - 2.1.10 | |
| - 2.2.6 | |
| - 2.3.3 | |
| - 2.4.1 | |
| env: | |
| - secure: "abcd1234" | |
| - secure: "defg4567" | |
| matrix: | |
| exclude: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stream = Class.new(Queue) { alias_method :write, :push }.new | |
| orig_stdout = $stdout | |
| $stdout = stream | |
| Thread.new do | |
| loop do | |
| puts Time.now | |
| sleep 0.5 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Recipe | |
| Version = Class.new(Gem::Version) | |
| class Definition | |
| attr_reader :options | |
| def initialize(recipe_name, options = {}) | |
| @options = options | |
| recipe recipe_name | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_message "SensorReport" do | |
| optional :device_id, :uint32, 1 | |
| optional :sensor_id, :uint32, 2 | |
| optional :timestamp, :uint32, 3 | |
| oneof :value do | |
| optional :f, :float, 4 | |
| optional :percentage, :uint32, 5 | |
| optional :val, :int32, 6 | |
| optional :b, :bool, 7 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SensorReport message = SensorReport_init_zero; | |
| pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); | |
| message.device_id = 1; | |
| message.sensor_id = (uint32_t)2; | |
| message.which_value = SensorReport_f_tag; | |
| message.value.f = currTemp; | |
| status = pb_encode(&stream, SensorReport_fields, &message); | |
| message_length = stream.bytes_written; | |
| if (!status) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| message SensorReport { | |
| uint32 device_id = 1; | |
| uint32 sensor_id = 2; | |
| uint32 timestamp = 3; | |
| oneof value { | |
| float f = 4; | |
| uint32 percentage = 5; | |
| int32 val = 6; |