Skip to content

Instantly share code, notes, and snippets.

-module(popd_fsm).
-behaviour(gen_fsm).
%% API
-export([stop/0]).
-export([set_socket/0]).
-export([start_link/3]).
%% gen_fsm callbacks
@jwarlander
jwarlander / Dockerfile
Created November 29, 2013 10:46 — forked from smly/Dockerfile
FROM ubuntu
ADD influxdb-install.sh /influxdb-install.sh
RUN /bin/bash /influxdb-install.sh
EXPOSE 8083 8086
CMD /opt/influxdb/run
@jwarlander
jwarlander / gist:b9da98b00d80c442a3f5
Created June 17, 2015 14:13
Start a set of asynchronous tasks, then collect results into a list
iex(1)> tasks = for n <- 1..100, do: Task.async(fn -> n*n end)
[%Task{pid: #PID<0.61.0>, ref: #Reference<0.0.0.82>},
%Task{pid: #PID<0.62.0>, ref: #Reference<0.0.0.83>},
%Task{pid: #PID<0.63.0>, ref: #Reference<0.0.0.84>},
%Task{pid: #PID<0.64.0>, ref: #Reference<0.0.0.85>},
%Task{pid: #PID<0.65.0>, ref: #Reference<0.0.0.86>},
%Task{pid: #PID<0.66.0>, ref: #Reference<0.0.0.87>},
%Task{pid: #PID<0.67.0>, ref: #Reference<0.0.0.88>},
%Task{pid: #PID<0.68.0>, ref: #Reference<0.0.0.89>},
%Task{pid: #PID<0.69.0>, ref: #Reference<0.0.0.90>},
@jwarlander
jwarlander / lib_demo.exs
Created December 19, 2016 07:50
Example of dynamic (at compile time) delegation from Erlang-style module to Elixir module
# Actual Elixir module with all the functions
defmodule LibDemo do
def hello(), do: IO.puts "Hello, World!"
def hello(name), do: IO.puts "Hello, #{name}!"
end
defmodule LibDemo.Utils do
def make_args(0), do: []
def make_args(n) do
Enum.map(1..n, fn n -> {String.to_atom("arg#{n}"), [], Elixir} end)
with foo <- 5, # foo
bar <- foo*3 # bar
do
IO.puts bar
end
defmodule MyApp.CLI do
def main(_args) do
IO.puts("Hello from MyApp!")
end
end
@jwarlander
jwarlander / varmilo keyboard.md
Created May 11, 2023 07:19 — forked from vladak/varmilo keyboard.md
Varmilo keyboard details
@jwarlander
jwarlander / creality_ender3s1pro.cura.start.gcode
Created February 29, 2024 10:14 — forked from JohnScottUK/creality_ender3s1pro.cura.start.gcode
Ender 3 S1 Pro Optimal Start/Stop GCode for Creality/Cura Slicer Software.
; Creality Ender-3 S1 Pro Optimal Start GCode for Cura Slicer Software.
; By John Scott, 2023. https://gist.github.com/JohnScottUK/8acd76895716b3abda4fde270738daf3
;M117 Set Movement...
G90; Use absolute positioning.
M83; Use relative extrusion.
;M117 Heating Bed...
M140 S{material_bed_temperature_layer_0}; Start heating bed.
@jwarlander
jwarlander / creality_ender3s1pro.prusa.start.gcode
Created February 29, 2024 10:15 — forked from JohnScottUK/creality_ender3s1pro.prusa.start.gcode
Ender 3 S1 Pro Optimal Start GCode for PruseSlicer/SuperSlicer Software.
; Creality Ender-3 S1 Pro Optimal Start GCode for PrusaSlicer Software.
; By John Scott, 2023. https://gist.github.com/JohnScottUK/b688deeb579d090f96af29c1375513b3
;M117 Set Movement...
G90; Use absolute positioning.
;M117 Heating Bed...
M140 S{first_layer_bed_temperature[0]}; Start heating bed to temperature.
;M117 Homing Axis...
@jwarlander
jwarlander / creality_ender3s1pro.orca.start.gcode
Created February 29, 2024 10:15 — forked from JohnScottUK/creality_ender3s1pro.orca.start.gcode
Ender 3 S1 Pro Optimal Start/Stop GCode for BambuStudio/OrcaSlicer Software.
; Creality Ender-3 S1 Pro Optimal Start GCode for OrcaSlicer Software.
; By John Scott, 2023. https://gist.github.com/JohnScottUK/de30eb8c22993c4405e6afbd9b5db113
;M117 Set Movement...
G90; Use absolute positioning.
;M117 Heating Bed...
M140 S[bed_temperature_initial_layer_single]; Start heating bed.
;M117 Homing Axis...