Skip to content

Instantly share code, notes, and snippets.

View arohner's full-sized avatar

Allen Rohner arohner

View GitHub Profile
@arohner
arohner / google-api.clj
Created November 5, 2016 21:53
Clojure example of accessing google APIs directly
(ns example.api.google
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-jwt.core :as jwt]
[clj-jwt.key :as key]
[clj-time.core :as time]
[clj-http.client :as http]
[clojure.string :as str])
(:import java.io.StringReader))
### Keybase proof
I hereby claim:
* I am arohner on github.
* I am arohner (https://keybase.io/arohner) on keybase.
* I have a public key ASDBb6_DdjJJsU7SDLNwjCHqnyvRDgmULf_nDTu9-RWpLQo
To claim this, I am signing this object:
@arohner
arohner / gist:8448042
Created January 16, 2014 01:15
clojure.data.xml parse error
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[18,4]
Message: http://www.w3.org/TR/1999/REC-xml-names-19990114#AttributePrefixUnbound?project&xsi:schemaLocation&xsi
XMLStreamReaderImpl.java:598 com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next
xml.clj:201 clojure.data.xml/pull-seq[fn]
LazySeq.java:42 clojure.lang.LazySeq.sval
LazySeq.java:60 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
xml.clj:98 clojure.data.xml/seq-tree[fn]
LazySeq.java:42 clojure.lang.LazySeq.sval
{:user {:mirrors {#"clojars" {:name "tcrawley"
:url "https://clojars-mirror.tcrawley.org/repo/"}}
}}
@arohner
arohner / gist:8012993
Created December 17, 2013 21:35
lein heapspace
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.LinkedList.linkLast(LinkedList.java:140)
at java.util.LinkedList.add(LinkedList.java:336)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.interpolateCollectionField(StringSearchModelInterpolator.java:276)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.interpolateField(StringSearchModelInterpolator.java:170)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.traverseObjectWithParents(StringSearchModelInterpolator.java:149)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator$InterpolateObjectAction.run(StringSearchModelInterpolator.java:123)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.maven.model.interpolation.StringSearchModelInterpolator.interpolateObject(StringSearchModelInterpolator.java:75)
at org.apache.maven.model.interpolation.St
@arohner
arohner / gist:8010983
Created December 17, 2013 19:21
core.typed + keys
(t/ann flag-keys (t/Map t/Keyword t/Int))
(def flag-keys
{:insensitive Pattern/CASE_INSENSITIVE
:literal Pattern/LITERAL})
(t/ann ^:no-check flags->bitmask [(t/Map t/Keyword Boolean) -> t/Int])
(defn flags->bitmask
[flags]
(->> flags
(filter val)
@arohner
arohner / gist:7149600
Created October 25, 2013 04:57
into-array>
(t/ann make-process [String -> java.lang.Process])
(defn make-process [script]
(let [^Runtime r (Runtime/getRuntime)
arr (t/into-array> String ["echo 'hello'"])]
(t/print-env "let")
(.exec r arr)))
@arohner
arohner / gist:7111364
Created October 23, 2013 02:00
rubygems failure during bundle install
Bundler::Fetcher::CertificateFailureError: Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:209:in `rescue in fetch'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:199:in `fetch'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:222:in `fetch'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:92:in `fetch_spec'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:46:in `_remote_specification'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/gems/bundl
@arohner
arohner / gist:7089153
Created October 21, 2013 19:04
rubygems SSL clue?
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: wrong version number
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `connect'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `connect'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:1445:in `begin_transport'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:1376:in `request'
/home/ubuntu/foo/vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/net.rb:28:in `block in request_with_newrelic_trace'
/home/ubuntu/foo/vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/cross_app_
@arohner
arohner / gist:7087099
Created October 21, 2013 16:54
rubygems problems
ubuntu@box55:~/arohner-test$ gem --version
2.1.9
ubuntu@box55:~/arohner-test$ gem install lazy_high_charts --version=1.1.7 --verbose
HEAD https://rubygems.org/specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
ERROR: Error installing lazy_high_charts:
lazy_high_charts requires RubyGems version ~> 1.3. Try 'gem update --system' to update RubyGems itself.