Skip to content

Instantly share code, notes, and snippets.

%% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*-
%%-------------------------------------------------------------------
%% @author Steven Danna <steve@chef.io>
%% Copyright 2017 Chef, Inc. All Rights Reserved.
%%
-module(node_state_tests).
-include_lib("eunit/include/eunit.hrl").
-include_lib("hoax/include/hoax.hrl").
--- /hab/cache/src/mercurial-3.9.1/tests/test-obsolete.t
+++ /hab/cache/src/mercurial-3.9.1/tests/test-obsolete.t.err
@@ -972,8 +972,6 @@
$ chmod 000 .hg/cache/hidden
$ hg log -r . -T '{node}' --debug
- cannot read hidden cache
- error writing hidden changesets cache
8fd96dfc63e51ed5a8af1bec18eb4b19dbf83812 (no-eol)
#endif

Keybase proof

I hereby claim:

  • I am stevendanna on github.
  • I am ssd (https://keybase.io/ssd) on keybase.
  • I have a public key ASBsBhcnsOsg-oAkxsHvggjT-1_nkvfJXFGRtUVFmKVtbAo

To claim this, I am signing this object:

-define(SELF, 'monitor@127.0.0.1').
-define(BIFROST, 'oc_bifrost@127.0.0.1').
-define(BIFROST_COOKIE, 'oc_bfirost').
init_network() ->
net_kernel:start([?SELF, longnames]),
erlang:set_cookie(node(), ?BIFROST_COOKIE),
pong = net_adm:ping(?BIFROST).
main(_Args) ->
file "bar"
file "baz"
log "foo" do
only_if do
resources("file[bar]").updated ||
resources("file[baz]").updated
end
end
In terminal 1
> mkfifo test.fifo
> gcc test.c
> ./a.out
In terminal 2
> cat >test.fifo
(Interrupt with ctl+C)
def resource_exists?(resource_spec)
resources(resource_spec)
true
rescue Chef::Exceptions::ResourceNotFound
false
end
@stevendanna
stevendanna / hypothesis.md
Created May 13, 2015 12:18
Chef Server 12.0.8 Double Transaction Rate

Supposed Cause

Chef Server 12.0.8+ contains a new version of our underlying postgresql client library and a new version of the sqerl library which provideds an abstraction over that. These updates included the following change:

https://github.com/chef/sqerl/commit/11d08f363fa61958f5e46d2560447931f88ae3ee

which results in the following query being sent before each query that we send to sqerl:

set statement_timeout=5000
@stevendanna
stevendanna / auth_info.md
Last active August 29, 2015 14:20
chef_wm auth_info docs

Understand the Permissions Requested by an oc_chef_wm Module

Chef Server API requests are eventually routed to a module in the oc_chef_wm application. These modules implement the 'chef_wm' behavior. A behavior defines a set of callback functions that are used to process each request.

For authorization, the relevant callback function is auth_info/2. auth_info/2 takes 2 arguments: The Request (which holds all the information about the HTTP request, such as method, path, etc) and the

@stevendanna
stevendanna / jiffybench.org
Last active August 29, 2015 14:20
Jiffy Benchmarks
* Benchmark Code
#+NAME: jsonbench
#+BEGIN_SRC erlang
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname jsonbench -pa deps/jiffy/ebin
-mode(compile).
main([Iter]) ->