Skip to content

Instantly share code, notes, and snippets.

View niranjanaryan's full-sized avatar
🤿
Deeply Involved

Niranjan Anandkumar niranjanaryan

🤿
Deeply Involved
View GitHub Profile
@niranjanaryan
niranjanaryan / nixos-as-bhyve-guest.md
Created November 5, 2024 08:38 — forked from j-keck/nixos-as-bhyve-guest.md
nixos as bhyve guest

create a vm

root@main:~ # vm create -t debian -s 100G nixos
root@main:~ # vm iso /stuff/downloads/nixos-graphical-18.03.132192.ce0d9d638de-x86_64-linux.iso 
root@main:~ # vm -f install nixos nixos-graphical-18.03.132192.ce0d9d638de-x86_64-linux.iso

boot the image

determine the 'init' executable path from '(cd0)/isolinux/isolinux.cfg'. look for a line which start's with: 'APPEND init=/nix/store/.....'

@acalejos
acalejos / Nx_Decision_Trees.livemd
Last active January 12, 2025 03:56
Serving Spam Detection With XGBoost and Elixir

Nx-Powered Decision Trees

Mix.install(
  [
    {:exgboost, "~> 0.3.1", override: true},
    {:nx, "~> 0.6"},
    {:exla, "~> 0.5"},
@Qqwy
Qqwy / benchmarks.exs
Last active July 21, 2024 08:39
Elixir benchmark of different implementations of the 'subarray sum' problem
Mix.install([
:benchee,
{:okasaki, "~> 1.0"}, # <- used by Qqwy's Okasaki solution
:nx, # <- used by Qqwy's Nx solution
{:exla, "~> 0.5"}, # <- used by Qqwy's Nx solution
],
config: [nx: [default_backend: EXLA.Backend]] # <- used by Qqwy's Nx solution
)
inputs = %{
@o11c
o11c / every-vm-tutorial-you-ever-studied-is-wrong.md
Last active May 18, 2025 22:01
Every VM tutorial you ever studied is wrong (and other compiler/interpreter-related knowledge)

Note: this was originally several Reddit posts, chained and linked. But now that Reddit is dying I've finally moved them out. Sorry about the mess.


URL: https://www.reddit.com/r/ProgrammingLanguages/comments/up206c/stack_machines_for_compilers/i8ikupw/ Summary: stack-based vs register-based in general.

There are a wide variety of machines that can be described as "stack-based" or "register-based", but not all of them are practical. And there are a lot of other decisions that affect that practicality (do variables have names or only address/indexes? fixed-width or variable-width instructions? are you interpreting the bytecode (and if so, are you using machine stack frames?) or turning it into machine code? how many registers are there, and how many are special? how do you represent multiple types of variable? how many scopes are there(various kinds of global, local, member, ...)? how much effort/complexity can you afford to put into your machine? etc.)

  • a pure stack VM can only access the top elemen
@brentjanderson
brentjanderson / README.md
Created June 14, 2022 15:53
Elixir runtime-controlled supervision tree using feature flags (circuit breaker)

These snippets provide a foundation for starting and stopping supervision trees at runtime using feature flags (e.g. Launch Darkly).

Some things to note when adapting these snippets:

  1. application.ex needs to be adapted into an existing application. The important part is that each child spec provided is compliant, and that there is a feature flag (ld_key) specified.
  2. As written, if a feature flag fails for some reason, it defaults to starting all children. There is room for adaptation here as needed.
  3. This implementation will still require a FeatureFlags module to be available that implements is_on?/2. Adjust as needed to accomodate your own feature flag setup.
@zblanco
zblanco / getting_lazy_with_dataflow_graphs_in_elixir.livemd
Last active January 30, 2025 00:49
Getting Lazy with Dataflow Graphs in Elixir

Getting Lazy with Dataflow Graphs in Elixir

Intro

What do Tensorflow, Apache Airflow, Rule Engines, and Excel have in common?

Under the hood they all use DAGs to model data-flow dependencies of the program. Using graphs to model programs is great because you can modify the program at runtime. Lets talk about doing this in Elixir for great good.

@tpmccallum
tpmccallum / wasmedge-sel4-installation-message.md
Created October 5, 2021 23:53
wasmedge-sel4 installation message
In file included from /home/wasmedge/sel4_wasmedge/build/include/c++/v1/unordered_map:435,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/common/enum_configure.h:19,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/common/configure.h:15,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/ast/instruction.h:18,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/lib/interpreter/engine/engine.cpp:2:
/home/wasmedge/sel4_wasmedge/build/include/c++/v1/__hash_table:2069:1: warning: always_inline function might not be inlinable [-Wattributes]
 2069 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wasmedge/sel4_wasmedge/build/include/c++/v1/__hash_table:2069:1: warning: always_inline function might not be inlinable [-Wattributes]
@cr0t
cr0t / vega_kino_tesla_examples.md
Last active December 3, 2023 10:17
Example of using Tesla, VegaLite, and Kino libraries in Elixir's Livebook
@usrbinkat
usrbinkat / container-image-file-save-load-transport.md
Last active August 6, 2024 06:49
Exercise in container image saving, loading from file, and embedding as compressed base64 encoded text string

Container image file and transportation

Conclusion:

Images can be saved to file or base64 encoded for building directly into golang binaries, python/bash scripts, and carrying independently across disconnected systems.

Unfortunately, the only way to preserve image metadata is to save as a docker-archive transport type, and to podman load the resulting archive via following step:

cat pause-3.2.tar | podman load
cat registry-latest.tar | podman load
@antonydevanchi
antonydevanchi / README.md
Last active January 26, 2025 23:48
octodns + octodns-lexicon + dns-lexicon — automation tool for 91 DNS Provider

Yandex.PDD Setup

Install

mkdir workspace; cd workspace

pipenv install; pipenv shell