Skip to content

Instantly share code, notes, and snippets.

View krainboltgreene's full-sized avatar
🏠
Working from home

Kurtis Rainbolt-Greene krainboltgreene

🏠
Working from home
View GitHub Profile
html
head
meta
title
link
script
p
section
kbd
nav
iex --erl -sssdio=128 -S mix
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Generated genie app
[info] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
[info] XLA service 0x7fd5907b7b30 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
[info] StreamExecutor device (0): NVIDIA GeForce GTX 1060 6GB, Compute Capability 6.1
[info] Using BFC allocator.
[info] XLA backend allocating 2737831936 bytes on device 0 for BFCAllocator.
defmacro example(keys) when is_list(keys) do
quote do
example(unquote(keys), defer_to: __MODULE__, loaded: false)
end
end
defmacro example(keys, defer_to: defer_to) when is_list(keys) do
quote do
example(unquote(keys), defer_to: unquote(defer_to), loaded: false)
end
FROM heroku/heroku:20-build as build
ARG BUNDLE_GEMS__CONTRIBSYS__COM
ENV STACK heroku-20
ENV RACK_ENV production
ENV RAILS_ENV production
ENV PORT 8080
WORKDIR /home/application/
uri = URI.parse("http://localhost:4000")
uri_with_scheme = %URI{scheme: "http", host: "localhost", port: 8080}
uri_without_scheme = %URI{host: "localhost", port: 8080}
URI.merge(uri, uri_with_scheme) %URI{
authority: nil,
fragment: nil,
host: "localhost",
path: nil,
port: 8080,
defmodule ElixirContainerAgentExperiment.Application do
use Application
def start(_type, _args) do
children = [
{
Task.Supervisor,
name: ElixirContainerAgentExperiment.ExampleSupervisor
}
]
defmodule Example do
defmacro example(block) do
quote do
def test(unquote(block)) do
IO.inspect(a)
end
end
end
end
defmodule LiveDataImport.ESI do
require Logger
@default_host URI.parse("https://esi.evetech.net/")
@default_fetch_query %{datasource: "tranquility"}
@type allowed_verbs :: :get | :patch | :post | :put
@spec read(String.t(), map) :: Flow.t()
def read(resource, query \\ %{datasource: "tranquility"})
def unload_cache_attempt({:ignore, :retry}, resource, parameters, http_client, cache) do
Logger.warn("Retrying request in 1s")
Process.sleep(1000)
fetch_for(resource, parameters, http_client, cache)
end
def unload_cache_attempt({:ok, %{status_code: 502}}, resource, parameters, http_client, cache) do
Logger.warn("Retrying request in 1s")
Process.sleep(1000)
fetch_for(resource, parameters, http_client, cache)
defmodule A do
# What you can write in Elixir
@spec a(String.t()) :: integer
def a(b) when is_bitstring(b) do
if b == "hello" do
1
else
2
end
end