Skip to content

Instantly share code, notes, and snippets.

View monjohn's full-sized avatar

Monte Johnston monjohn

  • Generac
  • Clayton NC
View GitHub Profile
@monjohn
monjohn / federation_token_service.ex
Created March 24, 2023 15:40
Calling AWS STS GetFederationToken from Elixir
defmodule Iec104AssetAdapter.FederationTokenService do
use GenServer
require Logger
defstruct [:expiration_timer, :token]
defmodule Token do
defstruct [:access_key_id, :secret_access_key, :session_token, :expiration]
end
@monjohn
monjohn / gist:88e0df32a5b15e6c673e32d97123ae5e
Created July 28, 2021 18:53
Logs after running `gigalixir run mix ecto.create`
2021-07-28T18:48:33.278815+00:00 fearful-colorful-imago[gigalixir-run]: Attempting to run 'mix ecto.create' in a new container.
2021-07-28T18:48:38.648259+00:00 fearful-colorful-imago[b'fearful-colorful-imago-run-fvccz']:
2021-07-28T18:48:38.648283+00:00 fearful-colorful-imago[b'fearful-colorful-imago-run-fvccz']: 18:48:38.602 [error] GenServer #PID<0.261.0> terminating
2021-07-28T18:48:38.648291+00:00 fearful-colorful-imago[b'fearful-colorful-imago-run-fvccz']: ** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) no pg_hba.conf entry for host "35.239.97.91", user "c15d97a5-1ec9-43ba-8e6d-74b5837b08b5-user", database "postgres", SSL on
2021-07-28T18:48:38.648299+00:00 fearful-colorful-imago[b'fearful-colorful-imago-run-fvccz']: (db_connection 2.4.0) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
2021-07-28T18:48:38.648306+00:00 fearful-colorful-imago[b'fearful-colorful-imago-run-fvccz']: (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
202
@monjohn
monjohn / gist:5136ec0f0ce2eea92461
Created October 31, 2015 16:25
Only partial data on state atom in read function
; Normalized data
(def norm-data (om/normalize Root init-data true))
(def reconciler
(om/reconciler
{:state norm-data
:parser (om/parser {:read read :mutate mutate})}))
;; This is @reconciler
{:lists [[:lists/by-id :daily]],
@monjohn
monjohn / gist:b90a18d551e7ed7403f0
Created October 27, 2015 17:17
Not refreshing ui on change of top-level val
;;; The Card component calls transact, to advance to the next item in :word-list,
;;; when it gets to the end of the sequence, the 'card/advance mutation, changes :location to a new value,
;;; this should cause a rerender from the Root Component
(def init-data
{:location :welcome
:current-list
{:german? true
:number-correct 0
:total 2
(def init-data
{:current-list
{:german? true
:current 2
:count 0
:word-list
[{:ger "Stollen" :eng "Cleats" :level :daily :score 1}
{:ger "Ball" :eng "Ball" :level :daily :score 0}
{:ger "Torhüter" :eng "Goal Keeper" :level :daily :score 2}
{:ger "Gras" :eng "Grass" :score 0 :level :daily}