Skip to content

Instantly share code, notes, and snippets.

View rboyd's full-sized avatar

Robert Boyd rboyd

  • Anarchist
  • Bentonville, AR
View GitHub Profile
@rboyd
rboyd / filter_long_emails.js
Last active July 1, 2023 05:37
google apps script to archive and autoreply to long emails.
/* paste into http://script.google.com
run periodically (e.g. every 5 minutes) with a timer by selecting 'Resources' > 'current project's triggers...'
*/
function filterLongEmails() {
var num_messages = 1; // will be applied to the last n messages. Google allows up to 500
var word_limit = 50;
var subj = "Shorter emails will get read.";
var body = "Dear friends, I value my time and yours but I appreciate it if you can keep your emails under " + word_limit + " words. Please edit and resend.";
@rboyd
rboyd / random-str.clj
Created February 28, 2013 03:30
random string (clojure)
(defn rand-str [len]
(apply str (take len (repeatedly #(char (+ (rand 26) 65))))))
(let ((buf (first
(remove* nil (buffer-list)
:test-not #'(lambda (a b)
(string-match "^\*cider-repl" (buffer-name b)))))))
(save-excursion
(set-buffer buf)
(goto-char (point-max))
(insert "(start-figwheel \"ios\")")
(cider-repl-return)))
@rboyd
rboyd / ns_walk.clj
Last active January 30, 2019 00:24
(defn instrument-resolvers!
"Look for any fns matching the pattern resolve-.* in the ns*, instrument them with
iapetos for Prometheus monitoring."
[ns* registry]
(doseq [resolver-str (filter #(re-matches #"resolve-.*" (str %)) (keys (ns-publics (ns-name ns*))))]
(->> resolver-str symbol resolve (iapetos.collector.fn/instrument! registry))))
(instrument-resolvers! *ns* registry)
@rboyd
rboyd / gist:5833751
Created June 21, 2013 19:37
'lein immutant overlay torquebox 2.3.2' log
15:35:15,063 INFO [org.jboss.modules] (main) JBoss Modules version 1.2.0.CR1
15:35:15,371 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.2.GA
15:35:15,445 INFO [org.jboss.as] (MSC service thread 1-2) JBAS015899: JBoss AS 7.1.x.incremental.129 "Arges" starting
15:35:15,455 DEBUG [org.jboss.as.config] (MSC service thread 1-2) Configured system properties:
[Standalone] =
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
@rboyd
rboyd / gist:5833763
Created June 21, 2013 19:38
'lein immutant overlay torquebox 2.3.2' standalone.xml
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns='urn:jboss:domain:1.4'>
<extensions>
<extension module='org.jboss.as.clustering.infinispan'/>
<extension module='org.jboss.as.cmp'/>
<extension module='org.jboss.as.configadmin'/>
<extension module='org.jboss.as.connector'/>
<extension module='org.jboss.as.deployment-scanner'/>
<extension module='org.jboss.as.ee'/>
<extension module='org.jboss.as.ejb3'/>
~/.pallet/config.clj:
(defpallet
:admin-user {:username "vagrant"
:private-key-path "/Users/robertb/.vagrant.d/insecure_private_key"}
:services
{
:my-servers {
:provider "node-list"
:node-list [["vagrant" "utility" "localhost" :ubuntu :ssh-port 2222]]
2013-06-18 12:28:34,791 DEBUG [operate-27] p.c.operations lift :phases [:pallet/os :settings] :targets []
2013-06-18 12:28:34,798 DEBUG [operate-28] p.c.primitives build-and-execute-phase :pallet/os on 0 target(s)
2013-06-18 12:28:34,805 DEBUG [operate-28] p.c.primitives build-and-execute-phase :settings on 0 target(s)
2013-06-18 12:28:34,810 DEBUG [operate-27] p.c.operations lift-partitions :phases [:phase13801] :targets []
in ~/.pallet/config.clj:
(defpallet
:services
{
:my-servers {
:provider "node-list"
:node-list [["hostname1.local" "staging" "hostname1.local" :ubuntu]]
}
})
13:37:04,259 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffa9fe14ca:-313a12eb:5123cf12:16e, node_name=1, branch_uid=0:ffffa9fe14ca:-313a12eb:5123cf12:16f, subordinatenodename=null, eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1a75463 >
13:37:04,260 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffa9fe14ca:-313a12eb:5123cf12:16e, node_name=1, branch_uid=0:ffffa9fe14ca:-313a12eb:5123cf12:16f, subordinatenodename=null, eis_name=unknown eis name >