Mix.install([
{:nx, "~> 0.1.0-dev", github: "elixir-nx/nx", sparse: "nx", override: true},
{:vega_lite, "~> 0.1"},
{:kino, "~> 0.3"}
])
This file contains 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
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) | |
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) | |
ok | |
vm.args needs to have either -name or -sname parameter. | |
+ uname | |
+ grep -q Darwin | |
++ readlink -f /usr/local/ourco/ourapp-1.1.3/releases/1.1.3/ourapp.sh | |
+ SCRIPT=/usr/local/ourco/ourapp-1.1.3/releases/1.1.3/ourapp.sh | |
++ dirname /usr/local/ourco/ourapp-1.1.3/releases/1.1.3/ourapp.sh | |
+ SCRIPT_DIR=/usr/local/ourco/ourapp-1.1.3/releases/1.1.3 |
I hereby claim:
- I am dantswain on github.
- I am dantswain (https://keybase.io/dantswain) on keybase.
- I have a public key whose fingerprint is 6C6B A60E D74A C07B 6124 F3DA A171 B2F0 C78D 87D4
To claim this, I am signing this object:
This file contains 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
namespace erl thrash | |
typedef i64 UgeInt | |
const i32 MAX_THINGS = 42 | |
enum TacoType { | |
BARBACOA = 123, | |
CARNITAS = 124, | |
STEAK = 125, |
This file contains 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
iex(1)> KafkaEx.create_worker(:foo, uris: Application.get_env(:kafka_ex, :brokers), consumer_group: "bar") | |
14:53:54.712 [debug] Succesfully connected to "localhost" on port 9092 | |
14:53:54.714 [debug] Succesfully connected to "localhost" on port 9093 | |
14:53:54.716 [debug] Succesfully connected to "localhost" on port 9094 | |
{:ok, #PID<0.138.0>} | |
iex(2)> Enum.each(1..1000, fn x -> KafkaEx.produce("foo", 0, "bar#{x}") end) | |
:ok |
This file contains 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
#!/usr/bin/env elixir | |
# Convert an Elixir config.exs to an erlang sys.config | |
# | |
# Usage: elixir_to_sys_config config.exs > sys.config | |
# First argument is the Elixir config.exs file | |
# Writes to stdout | |
# You probably want to set MIX_ENV accordingly | |
# | |
# 2015 by Dan Swain, [email protected] |
This file contains 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
# encoding: utf-8 | |
class Bar | |
def initialize(name) | |
@name = name | |
end | |
def hi | |
puts "HI #{@name}" | |
end |
To produce a string a la '2015-03-25' for the current date
In Ruby:
require 'date'
d = Date.today
puts d.to_s
In Javascript:
This file contains 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
% From http://stackoverflow.com/questions/12657202/ | |
-export([first/3, first1/3]). | |
% My solution | |
first([E | Rest], Condition, Default) -> | |
case Condition(E) of | |
true -> E; | |
false -> first(Rest, Condition, Default) | |
end; | |
first([], _Cond, Default) -> Default. |
This file contains 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
if(AllocConsole()) | |
{ | |
freopen("CONOUT$", "wt", stdout); | |
freopen("CONOUT$", "wt", stderr); | |
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), | |
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); | |
fprintf(stdout, "\n"); | |
fprintf(stdout, " stdout/stderr Console\n"); |
NewerOlder