Skip to content

Instantly share code, notes, and snippets.

View evadne's full-sized avatar
gone fishing

Evadne Wu evadne

gone fishing
View GitHub Profile
evadne / console.ex
Last active November 5, 2023 18:36
Elixir Tic Tac Toe with Minimax
defmodule TTT.Console do
def print(board) do
at = fn index ->
case elem(board, index) do
nil -> " "
:X -> "X"
:O -> "O"
evadne /
Last active October 4, 2023 23:24
How to Sell Elixir (2023)

How to Sell Elixir AGAIN (2023)

Presented by Evadne Wu at Code BEAM Lite in Stockholm, Sweden on 12 May 2023


We have celebrated 10 years of Elixir and also nearly 25 years of Erlang since the open source release in December 1998.

Most of the libraries that were needed to make the ecosystem viable have been built, talks given, books written, conferences held and training sessions provided. A new generation of companies have been built on top of the Elixir / Erlang ecosystem. In all measures, we have achieved further reach and maturity than 5 years ago.

evadne /
Last active December 29, 2022 22:20
LG Digital Signage External Control
#!/usr/bin/env python3
import re
import select
import socket
import sys
class WakeOnLan:
def __init__(self, mac, broadcast_ip = "", broadcast_port = 9):
self.mac_bytes = bytes.fromhex(re.sub('[^a-z0-9]', '', mac))
evadne /
Last active December 31, 2022 20:53
NEC X651UHD External Control
#!/usr/bin/env python3
import select
import socket
import sys
import functools
import datetime
import time
class Display:
evadne / messages.ex
Last active October 11, 2020 22:30
Stream Iterator
defmodule StreamIterator.Messages do
@moduledoc """
The Stream Iterator can be used to consume items from an Elixir Stream incrementally.
## Examples
### Infinite Streams
When used on infinite streams such as the ones returned by `Stream.cycle/1`, the Stream
Iterator will always return the next item.
evadne / gettext-sanitise.exs
Created October 13, 2019 15:09
Sanitise Gettext (Elixir) output for version control
# For all .POT files
# Parse PO to internal format
# Remove comments
# Remove duplicate references
# Sort terms by key
# Dump out data
# Bodge data with regex
# Remove leading #: for long reference
# Write file
evadne / service_discovery.ex
Created September 12, 2019 20:34
ExAws add-on for AWS Service Discovery
defmodule ExAws.ServiceDiscovery do
@moduledoc """
Minimal module to issue AWS Cloud Map requests with ExAws, which
is used by clustering mechanisms.
alias ExAws.Operation.JSON
@version "2017-03-14"
@namespace "Route53AutoNaming_v20170314"
evadne /
Created April 28, 2019 19:23
Properly invoke Sublime Text from WSL
function subl () {
SublimePath="/mnt/c/Program Files/Sublime Text 3/subl.exe"
TargetPath=$(readlink -f $1)
ProjectsPath=$(readlink -f $HomePath/projects)
SublimeProjectsPath=$(readlink -f $HomePath/sublime)
echo "Editing $TargetPath"
case $TargetPath/ in
evadne /
Last active July 11, 2023 06:33
Build & Cache multi-stage Docker images (with Build Specification for AWS CodeBuild)
# the general idea
Stages=$(cat $FilePath | grep -oP '^FROM .+ (AS|as) \K(.+)$')
CacheArgs=$(for Stage in $Stages; do echo "--cache-from $RepoURI:cache-$Stage"; done | paste -sd ' ')
BuildArgs="--file $FilePath $CacheArgs"
for Stage in $Stages; do docker pull $RepoURI:cache-$Stage || true; done
for Stage in $Stages; do docker build $BuildArgs --tag $RepoURI:cache-$Stage --target $Stage . || break; done
docker build $BuildArgs --tag $RepoURI:$ImageTag .