

{"id":8140,"date":"2018-02-06T15:29:49","date_gmt":"2018-02-06T20:29:49","guid":{"rendered":"https:\/\/rud.is\/b\/?p=8140"},"modified":"2018-03-07T16:50:11","modified_gmt":"2018-03-07T21:50:11","slug":"quick-and-clean-dmarc-record-processing-with-inline-rcpp","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/","title":{"rendered":"Quick and Clean DMARC Record Processing with &#8220;Inline&#8221; Rcpp"},"content":{"rendered":"<p>Much of what I need to do for work-work involves using tools that are (for the moment) not in R. Today, I needed to test the validity of (and other processing on) <a href=\"https:\/\/dmarc.org\/\">DMARC records<\/a> and I&#8217;m <em>loathe<\/em> to either reinvent the wheel or reticulate bits from a fragmented programming language ecosystem unless absolutely necessary. Thankfully, there&#8217;s <a href=\"http:\/\/www.trusteddomain.org\/opendmarc\/libopendmarc\/index.html\"><code>libopendmarc<\/code><\/a> which works well on sane operating systems, but it is a C library that needs an interface to use in R.<\/p>\n<p>However, I also <em>really<\/em> didn&#8217;t want to start a new package for this <em>just<\/em> yet (there will eventually be one, though, and I prefer working in a package context for Rcpp work). I just needed to run <a href=\"http:\/\/www.trusteddomain.org\/opendmarc\/libopendmarc\/opendmarc_policy_store_dmarc.html\"><code>opendmarc_policy_store_dmarc()<\/code><\/a> against a decent-sized chunk of domain names and already-retrieved DMARC <code>TXT<\/code> records. So, I decided to write a small &#8220;inline&#8221; <code>cppFunction()<\/code> to get&#8217;er done.<\/p>\n<p>Why am I blogging about this?<\/p>\n<p>Despite growing popularity and a nice <a href=\"http:\/\/gallery.rcpp.org\/\">examples site<\/a>, many newcomers to <code>Rcpp<\/code> (literally <em>the<\/em> way you want to go when it comes to bridging C[++] and R) still voice discontent about there not being enough &#8220;easy&#8221; examples. Granted, they are quitely likely looking for full-bore tutorials covering a different, explicit use cases. The aforelinked Gallery has some of those and there <em>are<\/em> codified examples in &#8212; literally &#8212; <a href=\"https:\/\/github.com\/eddelbuettel\/rcppexamples\"><code>rcppexamples<\/code><\/a>. But, there definitely needs to be more blog posts, books and such linking to them and expanding upon them.<\/p>\n<p>Having mentioned that I&#8217;m using <code>cppFunction()<\/code>, one could, further, ask <em>&#8220;<code>cppFunction()<\/code> has a help page with an example, so why blather about using it?&#8221;<\/em>. Fair point! And, there <em>is<\/em> a reason which was hinted at in the opening paragraph.<\/p>\n<p>I need to use <code>libopendmarc<\/code> and that requires making a &#8220;plugin&#8221; if I&#8217;m going to do this &#8220;inline&#8221;. For some other DMARC processing I also need to use <code>libresolv<\/code> since the library needs to make DNS requests and uses <code>resolv<\/code>. You don&#8217;t need a plugin for a package version as you just need to boilerplate some &#8220;find these libraries and get their paths right for <code>Makevars.in<\/code>&#8221; and add the linking code in there as well. Here, we need to register two plugins that provide metdata for the magic that happens under the covers when <code>Rcpp<\/code> takes your inline code, compiles it and makes the function shared object available in R.<\/p>\n<p>Plugins can be complex and do transformations, but the two I needed to write are just helping ensure the right <code>#include<\/code> lines are there along with the right linker libraries. Here they are:<\/p>\n<pre id=\"registerplugin01\"><code class=\"language-r\">library(Rcpp)\r\n\r\nregisterPlugin(\r\n  name = &quot;libresolv&quot;,\r\n  plugin = function(x) {\r\n    list(\r\n      includes = &quot;&quot;,\r\n      env = list(PKG_LIBS=&quot;-lresolv&quot;)\r\n    )\r\n  }\r\n)\r\n\r\nregisterPlugin(\r\n  name = &quot;libopendmarc&quot;,\r\n  plugin = function(x) {\r\n    list(\r\n      includes = &quot;#include &lt;opendmarc\/dmarc.h&gt;&quot;,\r\n      env = list(PKG_LIBS=&quot;-lopendmarc&quot;)\r\n    )\r\n  }\r\n)<\/code><\/pre>\n<p>All they do is make data structures available in the environment. We can use <code>inline::getPlugin()<\/code> to see them:<\/p>\n<pre id=\"registerplugin02\"><code class=\"language-r\">inline::getPlugin(&quot;libresolv&quot;)\r\n## $includes\r\n## [1] &quot;&quot;\r\n##\r\n## $env\r\n## $env$PKG_LIBS\r\n## [1] &quot;-lresolv&quot;\r\n\r\n\r\ninline::getPlugin(&quot;libopendmarc&quot;)\r\n## $includes\r\n## [1] &quot;#include &lt;opendmarc\/dmarc.h&gt;&quot;\r\n## \r\n## $env\r\n## $env$PKG_LIBS\r\n## [1] &quot;-lopendmarc&quot;<\/code><\/pre>\n<p>Finally, the tiny bit of C\/C++ code to take in the necessary parameters and return the result. In this case, we&#8217;re passing in a character vector of domain names and DMARC records and getting back a logical vector with the test results. Apart from the necessary initialization and cleanup code for <code>libopendmarc<\/code> this is an idiom you&#8217;ll recognize if you look over packages that use Rcpp.<\/p>\n<pre id=\"registerplugin04\"><code class=\"language-r\">cppFunction(\r\nstd::vector&lt; bool &gt; is_dmarc_valid(std::vector&lt; std::string&gt; domains,\r\n                                   std::vector&lt; std::string&gt; dmarc_records) {\r\n\r\n  std::vector&lt; bool &gt; out(dmarc_records.size());\r\n\r\n  DMARC_POLICY_T *pctx;\r\n  OPENDMARC_STATUS_T status;\r\n\r\n  pctx = opendmarc_policy_connect_init((u_char *)&quot;1.2.3.4&quot;, 0);\r\n\r\n  for (unsigned int i=0; i&lt;dmarc_records.size(); i++) {\r\n\r\n    status = opendmarc_policy_store_dmarc(\r\n      pctx,\r\n      (u_char *)dmarc_records[i].c_str(),\r\n      (u_char *)domains[i].c_str(),\r\n      NULL\r\n    );\r\n\r\n    out[i] = (status == DMARC_PARSE_OKAY);\r\n\r\n    pctx = opendmarc_policy_connect_rset(pctx);\r\n\r\n  }\r\n\r\n  pctx = opendmarc_policy_connect_shutdown(pctx);\r\n\r\n  return(out);\r\n\r\n}\r\n,\r\nplugins=c(&quot;libresolv&quot;, &quot;libopendmarc&quot;))<\/code><\/pre>\n<p><span style=\"font-size:9pt; font-face:italic\">(Note: the code-formatting plugin was tossing a serious fit about the long text field so you&#8217;ll need to put a single quote after <code>cppFunction(<\/code> and before the line with the <code>,<\/code> if you&#8217;re cutting and pasting at home).<\/span><\/p>\n<p>Right at the end, the final parameter is telling <code>cppFunction()<\/code> what plugins to use.<\/p>\n<p>Executing that line shunts a modified version of the function to disk, compiles it and lets us use the function in R (use <code>cacheDir<\/code>, <code>showOutput<\/code> and <code>verbose<\/code> parameters to control how many gory details lie undeneath this pristine shell).<\/p>\n<p>After running the function, <code>is_dmarc_valid()<\/code> is available in the environment and ready to use.<\/p>\n<pre id=\"registerplugin03\"><code class=\"language-r\">domains &lt;- c(&quot;bit.ly&quot;, &quot;bizible.com&quot;, &quot;blackmountainsystems.com&quot;, &quot;blackspoke.com&quot;)\r\ndmarc &lt;-  c(&quot;v=DMARC1; p=none; pct=100; rua=mailto:dmarc@bit.ly; ruf=mailto:ruf@dmarc.bitly.net; fo=1;&quot;, \r\n            &quot;v=DMARC1; p=reject; fo=1; rua=mailto:postmaster@bizible.com; ruf=mailto:forensics@bizible.com;&quot;, \r\n            &quot;v=DMARC1; p=quarantine; pct=100; rua=mailto:demarcrecords@blkmtn.com, mailto:ttran@blkmtn.com&quot;, \r\n            &quot;user.cechire.com.&quot;)\r\n\r\nis_dmarc_valid(domains, dmarc)\r\n## [1]  TRUE  TRUE  TRUE FALSE<\/code><\/pre>\n<p>Processing those 5 took just about 10 microseconds which meant I could process the ~1,000,000 domains+DMARCs in no time at all. And, I have something I can use in a DMARC utility package (coming &#8220;soon&#8221;).<\/p>\n<p>Hopefully this was a useful reference for both hooking up external libraries to &#8220;inline&#8221; Rcpp functions and for how to go about doing this type of thing in general.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Much of what I need to do for work-work involves using tools that are (for the moment) not in R. Today, I needed to test the validity of (and other processing on) DMARC records and I&#8217;m loathe to either reinvent the wheel or reticulate bits from a fragmented programming language ecosystem unless absolutely necessary. Thankfully, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[91],"tags":[810,808],"class_list":["post-8140","post","type-post","status-publish","format-standard","hentry","category-r","tag-post","tag-rcpp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Quick and Clean DMARC Record Processing with &quot;Inline&quot; Rcpp - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quick and Clean DMARC Record Processing with &quot;Inline&quot; Rcpp - rud.is\" \/>\n<meta property=\"og:description\" content=\"Much of what I need to do for work-work involves using tools that are (for the moment) not in R. Today, I needed to test the validity of (and other processing on) DMARC records and I&#8217;m loathe to either reinvent the wheel or reticulate bits from a fragmented programming language ecosystem unless absolutely necessary. Thankfully, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-06T20:29:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T21:50:11+00:00\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Quick and Clean DMARC Record Processing with &#8220;Inline&#8221; Rcpp\",\"datePublished\":\"2018-02-06T20:29:49+00:00\",\"dateModified\":\"2018-03-07T21:50:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/\"},\"wordCount\":685,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"keywords\":[\"post\",\"Rcpp\"],\"articleSection\":[\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/\",\"name\":\"Quick and Clean DMARC Record Processing with \\\"Inline\\\" Rcpp - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"datePublished\":\"2018-02-06T20:29:49+00:00\",\"dateModified\":\"2018-03-07T21:50:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/02\\\/06\\\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quick and Clean DMARC Record Processing with &#8220;Inline&#8221; Rcpp\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rud.is\\\/b\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\\\/\\\/rud.is\"],\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/author\\\/hrbrmstr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Quick and Clean DMARC Record Processing with \"Inline\" Rcpp - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/","og_locale":"en_US","og_type":"article","og_title":"Quick and Clean DMARC Record Processing with \"Inline\" Rcpp - rud.is","og_description":"Much of what I need to do for work-work involves using tools that are (for the moment) not in R. Today, I needed to test the validity of (and other processing on) DMARC records and I&#8217;m loathe to either reinvent the wheel or reticulate bits from a fragmented programming language ecosystem unless absolutely necessary. Thankfully, [&hellip;]","og_url":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/","og_site_name":"rud.is","article_published_time":"2018-02-06T20:29:49+00:00","article_modified_time":"2018-03-07T21:50:11+00:00","author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Quick and Clean DMARC Record Processing with &#8220;Inline&#8221; Rcpp","datePublished":"2018-02-06T20:29:49+00:00","dateModified":"2018-03-07T21:50:11+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/"},"wordCount":685,"commentCount":0,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"keywords":["post","Rcpp"],"articleSection":["R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/","url":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/","name":"Quick and Clean DMARC Record Processing with \"Inline\" Rcpp - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"datePublished":"2018-02-06T20:29:49+00:00","dateModified":"2018-03-07T21:50:11+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2018\/02\/06\/quick-and-clean-dmarc-record-processing-with-inline-rcpp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Quick and Clean DMARC Record Processing with &#8220;Inline&#8221; Rcpp"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-27i","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2969,"url":"https:\/\/rud.is\/b\/2014\/04\/25\/moving-from-system-calls-to-rcpp-interfaces\/","url_meta":{"origin":8140,"position":0},"title":"Moving From system() calls to Rcpp Interfaces","author":"hrbrmstr","date":"2014-04-25","format":false,"excerpt":"Over on the [Data Driven Security Blog](http:\/\/datadrivensecurity.info\/blog\/posts\/2014\/Apr\/making-better-dns-txt-record-lookups-with-rcpp\/) there's a post on how to use `Rcpp` to interface with an external library (in this case `ldns` for DNS lookups). It builds on [another post](http:\/\/datadrivensecurity.info\/blog\/posts\/2014\/Apr\/firewall-busting-asn-lookups\/) which uses `system()` to make a call to `dig` to lookup DNS `TXT` records. The core code\u2026","rel":"","context":"In &quot;Information Security&quot;","block_context":{"text":"Information Security","link":"https:\/\/rud.is\/b\/category\/information-security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12524,"url":"https:\/\/rud.is\/b\/2019\/09\/27\/100-stacked-chicklets\/","url_meta":{"origin":8140,"position":1},"title":"100% Stacked Chicklets","author":"hrbrmstr","date":"2019-09-27","format":false,"excerpt":"I posted a visualization of email safety status (a.k.a. DMARC) of the Fortune 500 (2017 list) the other day on Twitter and received this spiffy request from @MarkAltosaar: Would you be willing to add the R code used to produce this to your vignette for ggchicklet? I would love to\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/09\/dmarc-final-01.png?fit=1200%2C660&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/09\/dmarc-final-01.png?fit=1200%2C660&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/09\/dmarc-final-01.png?fit=1200%2C660&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/09\/dmarc-final-01.png?fit=1200%2C660&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/09\/dmarc-final-01.png?fit=1200%2C660&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7579,"url":"https:\/\/rud.is\/b\/2017\/12\/17\/mqtt-development-log-on-dsls-rcpp-modules-and-custom-formula-functions\/","url_meta":{"origin":8140,"position":2},"title":"mqtt Development Log : On DSLs, Rcpp Modules and Custom Formula Functions","author":"hrbrmstr","date":"2017-12-17","format":false,"excerpt":"I know some folks had a bit of fun with the previous post since it exposed the fact that I left out unique MQTT client id generation from the initial 0.1.0 release of the in-development package (client ids need to be unique). There have been some serious improvements since said\u2026","rel":"","context":"In &quot;mqtt&quot;","block_context":{"text":"mqtt","link":"https:\/\/rud.is\/b\/category\/mqtt\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3622,"url":"https:\/\/rud.is\/b\/2015\/08\/21\/doh-i-could-have-had-just-used-v8\/","url_meta":{"origin":8140,"position":3},"title":"Doh! I Could Have Had Just Used V8!","author":"hrbrmstr","date":"2015-08-21","format":false,"excerpt":"An R user recently had the need to split a \"full, human name\" into component parts to retrieve first & last names. The full names could be anything from something simple like _\"David Regan\"_ to more complex & diverse such as _\"John Smith Jr.\"_, _\"Izaque Iuzuru Nagata\"_ or _\"Christian Schmit\u2026","rel":"","context":"In &quot;Javascript&quot;","block_context":{"text":"Javascript","link":"https:\/\/rud.is\/b\/category\/javascript\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11894,"url":"https:\/\/rud.is\/b\/2019\/02\/09\/quick-hit-speeding-up-a-slow-mundane-task-with-a-little-rcpp\/","url_meta":{"origin":8140,"position":4},"title":"Quick Hit: Speeding Up a Slow\/Mundane Task with a Little Rcpp","author":"hrbrmstr","date":"2019-02-09","format":false,"excerpt":"Over at $DAYJOB's blog I've queued up a post that shows how to use our new ropendata? package to work with our Open Data portal's API. I'm not super-sure when it's going to be posted so keep an RSS reader fixed on https:\/\/blog.rapid7.com\/ if you're interested in seeing it (I\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/rud.is\/b\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4527,"url":"https:\/\/rud.is\/b\/2016\/07\/12\/slaying-cidr-orcs-with-triebeard-a-k-a-fast-trie-based-ipv4-in-cidr-lookups-in-r\/","url_meta":{"origin":8140,"position":5},"title":"Slaying CIDR Orcs with Triebeard (a.k.a. fast trie-based &#8216;IPv4-in-CIDR&#8217; lookups in R)","author":"hrbrmstr","date":"2016-07-12","format":false,"excerpt":"The insanely productive elf-lord, @quominus put together a small package ([`triebeard`](https:\/\/github.com\/ironholds\/triebeard)) that exposes an API for [radix\/prefix tries](https:\/\/en.wikipedia.org\/wiki\/Trie) at both the R and Rcpp levels. I know he had some personal needs for this and we both kinda need these to augment some functions in our `iptools` package. Despite `triebeard`\u2026","rel":"","context":"In &quot;Cybersecurity&quot;","block_context":{"text":"Cybersecurity","link":"https:\/\/rud.is\/b\/category\/cybersecurity\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/8140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=8140"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/8140\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=8140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=8140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=8140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}