As configured in my dotfiles.
start new:
tmux
start new with session name:
| # This is the simplest definition, with the addition of a type | |
| input { | |
| udp { | |
| port => 25826 # Must be specified. 25826 is the default for collectd | |
| buffer_size => 1452 # Should be specified. 1452 is the default for recent versions of collectd | |
| codec => collectd { } # This will invoke the default options for the codec | |
| type => "collectd" | |
| } | |
| } |
| <?php | |
| // quick and dirty argument parsing | |
| foreach ($argv as $arg) { | |
| if ($arg == '-f') { | |
| define('FOLLOW', true); | |
| } | |
| if ($arg == '-h') { | |
| define('HISTOGRAM', true); | |
| } |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| require 'net/http' | |
| require 'json' | |
| def rubygems_get(gem_name: "", endpoint: "") | |
| path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json" | |
| JSON.parse(Net::HTTP.get("rubygems.org", path)) | |
| end | |
| results = rubygems_get(gem_name: "mime-types", endpoint: "reverse_dependencies") |
| class Group | |
| module Error | |
| class Standard < StandardError; end | |
| class AlreadyAMember < Standard; end | |
| class NotPermittedToJoin < Standard; end | |
| end | |
| def join user | |
| raise Error::NotPermittedToJoin unless self.permitted?(user) | |
| raise Error::AlreadyAMember if self.member?(user) |
| # In Chef, when a resource is defined all its variables are evaluated during | |
| # compile time and the execution of the resource takes place in converge phase. | |
| # So if the value of a particular attribute is changed in converge | |
| # (and not in compile) the resource will be executed with the old value. | |
| # Example problem: | |
| # Let's consider this situation where there are two steps involved in a recipe | |
| # Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed | |
| # in converge phase | |
| # Step 2 is a Chef resource that makes use of the node attribute that was |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 ipv6only=on default_server; | |
| server_name splunk.net blog.splunk.net www.splunk.net .taddevries.com; | |
| access_log /var/log/nginx/blog.access_log main; | |
| error_log /var/log/nginx/blog.error_log info; | |
| return 301 https://blog.splunk.net; | |
| } | |
| server { |
| curl --header 'Authorization: token INSERTACCESSTOKENHERE' \ | |
| --header 'Accept: application/vnd.github.v3.raw' \ | |
| --remote-name \ | |
| --location https://api.github.com/repos/owner/repo/contents/path | |
| # Example... | |
| TOKEN="INSERTACCESSTOKENHERE" | |
| OWNER="BBC-News" | |
| REPO="responsive-news" |
| require 'json' | |
| def pretty_json(vv, prefix='$') | |
| if vv.is_a?(Array) | |
| vv.each_with_index do |i, v| | |
| pretty_json(v, "#{prefix}[#{i}]") | |
| end | |
| elsif vv.is_a?(Hash) | |
| vv.each do |k, v| | |
| pretty_json(v, "#{prefix}.#{k}") |