This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am maxp on github. | |
* I am mpenzin (https://keybase.io/mpenzin) on keybase. | |
* I have a public key ASD1POnkRCRj1eeXHbXfjJM0RuzZhy_JQjWmrkQpwo0Nogo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import [java.util UUID]) | |
(defn timebased-uuid [] | |
(let [uuid (UUID/randomUUID) | |
time (int (/ (System/currentTimeMillis) 1000)) | |
high (.getMostSignificantBits uuid)] | |
(UUID. | |
(bit-or | |
(bit-and high 0x00000000FFFFFFFF) | |
(bit-shift-left time 32)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defn haversine | |
[{lon1 :longitude lat1 :latitude} {lon2 :longitude lat2 :latitude}] | |
(let [R 6372.8 ; kilometers | |
dlat (Math/toRadians (- lat2 lat1)) | |
dlon (Math/toRadians (- lon2 lon1)) | |
lat1 (Math/toRadians lat1) | |
lat2 (Math/toRadians lat2) | |
a (+ (* (Math/sin (/ dlat 2)) (Math/sin (/ dlat 2))) (* (Math/sin (/ dlon 2)) (Math/sin (/ dlon 2)) (Math/cos lat1) (Math/cos lat2)))] | |
(* R 2 (Math/asin (Math/sqrt a))))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://github.com/samfoo/mercator/blob/master/src/mercator/gpx.clj | |
(ns mercator.gpx | |
(:use [clojure.core.match :only [match]]) | |
(:require [clojure.zip :as zip] | |
[clj-time.format :as time] | |
[clojure.data.zip.xml :as xzip] | |
[clojure.data.xml :as xml])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://github.com/samfoo/mercator/blob/master/src/mercator/kml.clj | |
(ns mercator.kml | |
(:use [clojure.core.match :only [match]]) | |
(:require [clojure.zip :as zip] | |
[clj-time.format :as time] | |
[clojure.data.zip.xml :as xzip] | |
[clojure.data.xml :as xml])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://raw.githubusercontent.com/honza/clj-gpx/master/src/gpx/core.clj | |
(ns gpx.core | |
(:require [clojure.xml :refer :all] | |
[clojure.algo.generic.math-functions :refer :all] | |
[clj-time.format :as tf] | |
[clj-time.core :as tc] | |
[clojure.pprint :refer [pprint]]) | |
(:gen-class)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 1 | |
(defn resend-code [email on-success on-error] | |
(let [cognito_user (new CognitoUser #js {:Username email :Pool config/user_pool})] | |
(.resendConfirmationCode cognito_user | |
(fn [err result] | |
(info! "cognito.resend-code:" err result | |
(if err | |
(on-error err) | |
(on-success result))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cron.meteo | |
(:require | |
[clj-time.core :as t] | |
[clj-time.periodic :as tp] | |
[chime :refer [chime-at]] | |
[mount.core :refer [defstate]] | |
[monger.collection :as mc] | |
[monger.query :as mq] | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-slots [t0 t1 limit] | |
(try | |
(mq/with-collection (dbc) ENROLLS_COLL | |
(mq/find {:at {:$gte t0 :$lt t1} :state 0}) | |
(mq/limit limit)) | |
(catch Exception e | |
(warn e)))) | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns stg.fb.webhook | |
(:import | |
[javax.crypto Mac] | |
[javax.crypto.spec SecretKeySpec]) | |
(:require | |
[clojure.string :as s] | |
[cheshire.core :as json] | |
[taoensso.timbre :refer [debug info warn]] | |
[ring.adapter.jetty :refer [run-jetty]] |