Skip to content

Instantly share code, notes, and snippets.

View haubie's full-sized avatar

David haubie

View GitHub Profile
@thmsmlr
thmsmlr / kino_daemon.exs
Created January 14, 2024 21:59
Kino Background Daemon
child_spec = Task.child_spec(fn ->
IO.puts("""
I am doing daemon things for my Livebook.
If I re-evaluate the cell, this task will be terminated and restart with the new version of the code.
If the task ever terminates, the Supervisor will automatically restart it.
Useful for running things in the background that don't need to directly interact with your notebook.
""")
@mcrumm
mcrumm / phx_sqlite_fly_launch.md
Last active January 17, 2026 15:23
Phoenix + SQLite Deployment tips

Deploying to Fly.io with SQLite

Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

@ssankko
ssankko / Cargo.toml
Created December 12, 2021 20:31
Hot-plugging for midi devices using midly on MacOS
...
[dependencies]
midir = "0.7"
midly = "0.5"
coremidi = "0.5"
core-foundation = "0.9"
@cblavier
cblavier / application.ex
Last active July 14, 2025 23:22
Cowboy 2.5 proxy, used to bind a single port (on Heroku) for umbrella Phoenix applications. It supports HTTPS and websockets properly.
defmodule MasterProxy.Application do
alias MyApp.Endpoint, as: MyAppEndpoint
alias MyApp.UserSocket, as: MyAppUserSocket
alias MyOtherApp.Endpoint, as: MyOtherAppEndpoint
alias MyOtherApp.UserSocket, as: MyOtherAppUserSocket
alias Phoenix.LiveReloader.Socket, as: LiveReloadSocket
alias Plug.Cowboy
@ktec
ktec / application.ex
Last active January 15, 2022 23:46
Example MasterProxy for Elixir Umbrella applications supporting websockets
defmodule MasterProxy.Application do
@moduledoc """
Custom Cowboy specification to support hosting multiple Phoenix apps within the same umbrella,
all served via the same port. This is only really necessary if you're deploying your umbrella
to a restricted hosting environment like Heroku where they only expose 1 port per dyno.
Don't for get to configure your endpoints, something like this should work:
config :myapp_web, MyAppWeb.Endpoint,
url: [scheme: "https", host: "myapp.herokuapp.com", port: 443],
@daksis
daksis / hitchhikers-guide-to-machine-learning.md
Created September 15, 2017 20:48
Hitchhikers Guide to Machine Learning Resources

Hitchhikers Guide to Machine Learning Resources

Reference Sources

  1. Project Rhea — online learning community where students teach other students. The tutorials here vary in detail and quality. Generally they are more that a definition at mathworld, less than a step by step. Good for getting the highlights on an unfamiliar topic
  2. Wolfram Mathworld — Like wikipedia, but only for Math. Go here when you have no idea what an "Isotopic Kernel is or why you would care. Mathworld will give you 80+ entries that are linked.
  3. Wikipedia Math Portal — the place to find everything math related on Wikipedia.

Math References

@randomecho
randomecho / australian-postcodes.sql
Last active November 23, 2025 08:26
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;