Total Pageviews

Showing posts with label elixir. Show all posts
Showing posts with label elixir. Show all posts

Sunday, 5 July 2026

Livebook

 

Automate code & data workflows with interactive Elixir notebooks

Website Latest Version

Livebook is a web application for writing interactive and collaborative code notebooks. It features:

  • Code notebooks with Markdown support and Code cells where Elixir code is evaluated on demand.

  • Rich code editor through CodeMirror: with support for autocompletion, inline documentation, code formatting, etc.

  • Interactive results via Kino: display Vega-Lite charts, tables, maps, and more.

  • Automation: use Smart cells to perform high-level tasks and write notebooks faster than ever. Query databases, plot charts, build maps, and more directly from Livebook's UI.

  • Reproducible: Livebook ensures your code runs in a predictable order, all the way down to package management. It also tracks your notebook state, annotating which parts are stale.

  • Collaboration: multiple users can work on the same notebook at once, no additional setup required.

  • Decentralized: Livebook is open-source and you can run it anywhere. The "Run in Livebook" badge makes it easy to import any Livebook into your own Livebook.

  • Versionable: notebooks are stored in the .livemd format, which is a subset of Markdown with support for diagrams via Mermaid and for mathematical formulas via KaTex. .livemd files can be shared and play well with version control.

  • Custom runtimes: when executing Elixir code, you can either start a fresh Elixir instance, connect to an existing node, or run it inside an existing Elixir project, with access to all of its modules and dependencies. This means Livebook can be a great tool to introspect and document existing projects too.

Getting started

Head out to the Install section of Livebook's website to get started. Once Livebook is up and running on your machine, visit the "Learn" section with introductory guides and documentation on several Livebook features. Here is a sneak peak of the "Welcome to Livebook" guide:

Screenshot

There are more resources for those who are ready to dig deeper:

Installation

We provide several methods for running Livebook, pick the one that best fits your use case.

Desktop app

Docker

Running Livebook using Docker is another great option to run Livebook in case you don't have Elixir installed.

# Running with the default configuration
docker run -p 8080:8080 -p 8081:8081 --pull always ghcr.io/livebook-dev/livebook

# In order to access and save notebooks directly to your machine
# you can mount a local directory into the container.
# Make sure to specify the user with "-u $(id -u):$(id -g)"
# so that the created files have proper permissions
docker run -p 8080:8080 -p 8081:8081 --pull always -u $(id -u):$(id -g) -v $(pwd):/data ghcr.io/livebook-dev/livebook

# You can configure Livebook using environment variables,
# for all options see the dedicated "Environment variables" section below
docker run -p 8080:8080 -p 8081:8081 --pull always -e LIVEBOOK_PASSWORD="securesecret" ghcr.io/livebook-dev/livebook

# Or if you need to run on different ports:
docker run -p 8090:8090 -p 8091:8091 --pull always -e LIVEBOOK_PORT=8090 -e LIVEBOOK_IFRAME_PORT=8091 ghcr.io/livebook-dev/livebook

To deploy Livebook on your cloud platform, see our Docker Deployment guide.

For CUDA support, see images with the "cuda" tag.

To try out features from the main branch you can alternatively use the ghcr.io/livebook-dev/livebook:nightly image. See Livebook images.

Embedded devices

If you want to run Livebook on embedded devices, such as Raspberry Pi, BeagleBone, etc., check out the Livebook firmware built with Nerves.

Direct installation with Elixir

You can run Livebook on your own machine using just Elixir. You will need Elixir v1.18 or later. Livebook also requires the following Erlang applications: inets, os_mon, runtime_tools, ssl and xmerl. Those applications come with most Erlang distributions but certain package managers may split them apart. For example, on Ubuntu, these Erlang applications can be installed as follows:

sudo apt install erlang-inets erlang-os-mon erlang-runtime-tools erlang-ssl erlang-xmerl erlang-dev erlang-parsetools

Note: The livebook package is meant to be used as a CLI tool. Livebook is not officially supported as a Mix/Hex dependency.

Escript

Running Livebook using Escript makes for a very convenient option for local usage and provides easy configuration via CLI options.

mix do local.rebar --force, local.hex --force
mix escript.install hex livebook

# Start the Livebook server
livebook server

# See all the configuration options
livebook server --help

After you install the escript, make sure you add the directory where Elixir keeps escripts to your $PATH. If you installed Elixir with asdf, you'll need to run asdf reshim elixir once the escript is built.

To try out features from the main branch you can alternatively install the escript directly from GitHub like this:

mix escript.install github livebook-dev/livebook

From source

You can run latest Livebook directly from source.

git clone https://github.com/livebook-dev/livebook.git
cd livebook
mix setup.prod

# Run the Livebook server
MIX_ENV=prod mix phx.server

Security considerations

Livebook is built to document and execute code. Anyone with access to a Livebook instance will be able to access any file and execute any code in the machine Livebook is running.

For this reason, Livebook only binds to the 127.0.0.1, allowing access to happen only within the current machine. When running Livebook in the production environment - the recommended environment - we also generate a token on initialization and we only allow access to the Livebook if said token is supplied as part of the URL.

Environment variables

The following environment variables can be used to configure Livebook on boot:

  • LIVEBOOK_ALLOW_URI_SCHEMES - sets additional allowed hyperlink schemes to the Markdown content. Livebook sanitizes links in Markdown, allowing only a few standard schemes by default (such as http and https). Set it to a comma-separated list of schemes.

  • LIVEBOOK_APP_SERVICE_NAME - sets the application name used by the cloud provider to aid debugging.

  • LIVEBOOK_APP_SERVICE_URL - sets the application url to manage this Livebook instance within the cloud provider platform.

  • LIVEBOOK_APPS_BANNER - sets the value to render at the top apps banner.

  • LIVEBOOK_APPS_PATH - the directory with app notebooks. When set, the apps are deployed on Livebook startup with the persisted settings. Password-protected notebooks will receive a random password, unless LIVEBOOK_APPS_PATH_PASSWORD is set. When deploying using Livebook's Docker image, consider using LIVEBOOK_APPS_PATH_WARMUP.

  • LIVEBOOK_APPS_PATH_PASSWORD - the password to use for all protected apps deployed from LIVEBOOK_APPS_PATH.

  • LIVEBOOK_APPS_PATH_WARMUP - sets the warmup mode for apps deployed from LIVEBOOK_APPS_PATH. Must be either "auto" (apps are warmed up on Livebook startup, right before app deployment) or "manual" (apps are warmed up when building the Docker image; to do so add "RUN /app/bin/warmup_apps" to your image). Defaults to "auto".

  • LIVEBOOK_AWS_CREDENTIALS - enable Livebook to read AWS Credentials from environment variables, AWS Credentials, EC2/ECS metadata when configuring S3 buckets.

  • LIVEBOOK_BASE_URL_PATH - sets the base url path the web application is served on. Useful when deploying behind a reverse proxy.

  • LIVEBOOK_PUBLIC_BASE_URL_PATH - sets the base url path the /public/* routes are served on. Note that this takes precedence over LIVEBOOK_BASE_URL_PATH, if both are set. Setting this may be useful to create exceptions when deploying behind a reverse proxy that requires authentication.

  • LIVEBOOK_CACERTFILE - path to a local file containing CA certificates. Those certificates are used during for server authentication when Livebook accesses files from external sources.

  • LIVEBOOK_CLUSTER - configures clustering strategy when running multiple instances of Livebook using either the Docker image or an Elixir release. See the "Clustering" docs for more information: https://hexdocs.pm/livebook/clustering.html

  • LIVEBOOK_COOKIE - sets the cookie for running Livebook in a cluster. Defaults to a random string that is generated on boot.

  • LIVEBOOK_DATA_PATH - the directory to store Livebook's internal configuration. Defaults to "livebook" under the default user data directory.

  • LIVEBOOK_DEFAULT_RUNTIME - sets the runtime type that is used by default when none is started explicitly for the given notebook. Must be either "standalone" (Standalone), "attached:NODE:COOKIE" (Attached node) or "embedded" (Embedded). Defaults to "standalone".

  • LIVEBOOK_FORCE_SSL_HOST - sets a host to redirect to if the request is not over HTTPS. Note it does not apply when accessing Livebook via localhost. Defaults to nil.

  • LIVEBOOK_HOME - sets the home path for the Livebook instance. This is the default path used on file selection screens and others. Defaults to the user's operating system home.

  • LIVEBOOK_IDENTITY_PROVIDER - controls whether Zero Trust Authentication must be used for this Livebook instance. This is useful when deploying Livebook inside a cloud platform, such as Cloudflare and Google. Supported values are:

    • basic_auth:<username>:<password>
    • cloudflare:<your-team-name (domain)>
    • google_iap:<your-audience (aud)>
    • tailscale:<tailscale-cli-socket-path>
    • custom:YourElixirModule

    See our authentication docs for more information: https://hexdocs.pm/livebook/authentication.html

  • LIVEBOOK_IFRAME_PORT - sets the port that Livebook serves iframes at. This is relevant only when running Livebook without TLS. Defaults to 8081.

  • LIVEBOOK_IFRAME_URL - sets the URL that Livebook loads iframes from. By default iframes are loaded from local LIVEBOOK_IFRAME_PORT when accessing Livebook over http:// and from https://livebookusercontent.com when accessing over https://.

  • LIVEBOOK_IMAGE_REGISTRY_URL - sets the container image registry used to fetch livebook images from. By default uses ghcr.io/livebook-dev/livebook.

  • LIVEBOOK_IP - sets the ip address to start the web application on. Must be a valid IPv4 or IPv6 address.

  • LIVEBOOK_LOG_LEVEL - sets the logger level, allowing for more verbose logging, either of: error, warning, notice, info, debug. Defaults to warning.

  • LIVEBOOK_LOG_METADATA - a comma-separated list of metadata keys that should be included in the log messages. Livebook-specific keys include:

    • users (attached to evaluation and request logs)
    • session_mode (attached to evaluation logs, either "default" or "app")
    • code (attached to evaluation logs, the code being evaluated)
    • event (attached to evaluation logs, currently always "code.evaluate")

    By default includes only request_id.

  • LIVEBOOK_LOG_FORMAT - sets the log output format, either "text" (default) for human-readable logs or "json" for structured JSON.

  • LIVEBOOK_NODE - sets the node name for running Livebook in a cluster. Note that Livebook always runs using long names distribution, so the node host name must use a fully qualified domain name (FQDN) or an IP address.

  • LIVEBOOK_PASSWORD - sets a password that must be used to access Livebook. Must be at least 12 characters. Defaults to token authentication.

  • LIVEBOOK_PROXY_HEADERS - a comma-separated list of headers that are set by proxies. For example, x-forwarded-for,x-forwarded-proto. Configuring those may be required when running Livebook behind reverse proxies.

  • LIVEBOOK_PORT - sets the port Livebook runs on. If you want to run multiple instances on the same domain with the same credentials but on different ports, you also need to set LIVEBOOK_SECRET_KEY_BASE. Defaults to 8080. If set to 0, a random port will be picked.

  • LIVEBOOK_SECRET_KEY_BASE - sets a secret key that is used to sign and encrypt the session and other payloads used by Livebook. Must be at least 64 characters long and it can be generated by commands such as: openssl rand -base64 48. Defaults to a random secret on every boot.

  • LIVEBOOK_SHUTDOWN_ENABLED - controls if a shutdown button should be shown in the homepage. Set it to "true" to enable it.

  • LIVEBOOK_TOKEN_ENABLED - controls whether token authentication is enabled. Enabled by default unless LIVEBOOK_PASSWORD is set. Set it to "false" to disable it.

  • LIVEBOOK_UPDATE_INSTRUCTIONS_URL - sets the URL to direct the user to for updating Livebook when a new version becomes available.

  • LIVEBOOK_WITHIN_IFRAME - controls if the application is running inside an iframe. Set it to "true" to enable it. If you do enable it, then the application must run with HTTPS.

The environment variables ERL_AFLAGS and ERL_ZFLAGS can also be set to configure Livebook and the notebook runtimes. ELIXIR_ERL_OPTIONS are also available to customize Livebook, but it is not forwarded to runtimes.

If running Livebook via the command line, run livebook server --help to see all CLI-specific options.

Livebook Desktop

When running Livebook Desktop, Livebook will invoke on boot a file named ~/.livebookdesktop.sh on macOS or %USERPROFILE%\.livebookdesktop.bat on Windows. This file can set environment variables used by Livebook, such as:

  • the PATH environment variable

  • or to configure the Erlang VM, for instance, by setting ERL_AFLAGS="-proto_dist inet6_tcp" if you need Livebook to run over IPv6

Be careful when modifying boot files, Livebook may be unable to start if configured incorrectly.

Development

Livebook is primarily a Phoenix web application and can be setup as such:

git clone https://github.com/livebook-dev/livebook.git
cd livebook
mix setup

# Run the Livebook server
mix phx.server

# Run tests
mix test

Desktop app

./rel/app/tauri.sh dev
from  https://github.com/livebook-dev/livebook

Thursday, 18 June 2026

unwall

 

Wallsplash

Periodically change your desktop's wallpaper from unsplash.

Commands

Load and start the daemon

launchctl load ~/Library/LaunchAgents/com.wallsplash.plist

To stop and unload

launchctl unload ~/Library/LaunchAgents/com.wallsplash.plist

Check if it's running

launchctl list | grep wallsplash
from  https://github.com/aayushmau5/unwall

Tuesday, 7 April 2026

Hexpm

 

API server and website for Hex。

CI

API server and website for https://hex.pm.

Contributing

To contribute to Hexpm you need to properly set up your development environment.

Also see the client repository: hex. The client uses hexpm for integration tests, so hexpm needs to support all versions the client supports. CI ensures that tests are run on all supported versions.

Setup

  1. Run mix setup to install dependencies, create and seed database etc
  2. Run mix test
  3. Run iex -S mix phx.server and visit http://localhost:4000/

After this succeeds you should be good to go!

See setup alias in mix.exs and sections below for more information or when you run into issues.

from  https://github.com/hexpm/hexpm

 

 

Sunday, 27 October 2024

基于elixir的静态网站程序tableau

 Static Site Generator-tableau

Discord Hex.pm Hex Docs GitHub Discussions

Static Site Generator for Elixir.

Goals

  • Good code and browser reloading on file change
  • Easy to use the current Node.js JS/CSS tooling
  • Extensions
  • Ability to work with "data" (either dynamic data or static files)
    • YAML Files
    • Elixir scripts (.exs files)
  • Handles stuff like Posts, RSS, sitemap, SEO.
    • Posts
    • RSS
    • Sitemap
    • SEO
  • Project generator

Installation

The easiest way to get started is to generate a new project using the tableau.new mix task.

Currently the generator can create a website using several different template syntaxes and assets frameworks.

Please run mix help tableau.new or mix tableau.new --help to see all of the possible flags.

mix archive.install hex tableau_new

mix tableau.new my_awesome_site

Otherwise, you can just install Tableau into a new mix project.

def deps do
  [
    {:tableau, "~> 0.17"}
  ]
end

Documentation can be found at https://hexdocs.pm/tableau.

Built with Tableau

Site Template Styling Template Source
www.elixir-tools.dev Temple Tailwind
elixir-tools/elixir-tools.dev
www.mitchellhanberg.com Liquid Tailwind
mhanberg/blog
pdx.su Temple CSS
paradox460/pdx.su
Xmeyers HEEx Tailwind
andyl/xmeyers
0x7f HEEx magick.css
0x7fdev/site
Hackery HEEx Tailwind ✅ mhanberg/hackery
doneth.dev HEEx Tailwind
JohnDoneth/doneth.dev
joelkoch.dev HEEx Tailwind
joelpaulkoch/joelkoch.dev
www.ethangunderson.com HEEx Tailwind
ethangunderson/website
https://adrienanselme.com/ HEEx Tailwind
adanselm/adanselm.github.io

Getting Started

The examples in the README use the Temple library to demonstrate that Tableau can be used with any markup language of your choice. You could easily use the builtin EEx, or use HEEx, Surface, or HAML.

Layouts

Layouts are modules that use the use Tableau.Layout macro.

Layouts have access to the @site and @page assign.

The @site assign contains your site's config.

The @page assign contains all the options passed to the use Tableau.Page macro.

defmodule MySite.RootLayout do
  use Tableau.Layout

  import Temple

  def template(assigns) do
    temple do
      "<!DOCTYPE html>"

      html lang: "en" do
        head do
          meta charset: "utf-8"
          meta http_equiv: "X-UA-Compatible", content: "IE=edge"
          meta name: "viewport", content: "width=device-width, initial-scale=1.0"

          title do
            @page.some_assign
          end

          link rel: "stylesheet", href: "/css/site.css"
        end

        body class: "font-sans" do
          main class: "container mx-auto px-2" do
            div class: "border-4 border-green-500" do
              a class: "text-blue-500 hover:underline", href: "/about" do
                "About"
              end

              a class: "text-blue-500 hover:underline", href: "/posts" do
                "Posts"
              end

              render @inner_content
            end
          end
        end

        if Mix.env() == :dev do
          c &Tableau.live_reload/1
        end
      end
    end
  end
end

Page

Pages are modules that use the use Tableau.Page macro.

Required options:

  • :layout - which layout module to use.
  • :permalink - the permalink of the page

Any remaining options are arbitrary and will be available under the @page assign available to layout and page templates.

defmodule MySite.AboutPage do
  use Tableau.Page,
    layout: MySite.RootLayout,
    permalink: "/about",
    some_assign: "foo"

  import Temple

  def template(assigns) do
    temple do
      span class: "text-red-500 font-bold" do
        "i'm a super cool and smart!"
      end
    end
  end
end

Live Reloading

You can specify a set of directories/files to watch for changes, and the browser will automatically refresh.

# config/config.exs
import Config

config :tableau, :reloader,
  patterns: [
    ~r"lib/layouts/.*.ex",
    ~r"lib/pages/.*.ex",
    ~r"lib/components.ex",
    ~r"_site/.*.css"
  ]

All you need to do is render the Tableau.live_reload/1 component right after your body tag.

# lib/layouts/app.ex

defmodule YourApp.Layouts.App do
  use Tableau.Layout

  import Temple

  def template(assigns) do
    temple do
      "<!DOCTYPE html>"

      html lang: "en" do
        head do
          meta charset: "utf-8"
          meta http_equiv: "X-UA-Compatible", content: "IE=edge"
          meta name: "viewport", content: "width=device-width, initial-scale=1.0"

          link rel: "stylesheet", href: "/css/site.css"
        end

        body class: "font-sans" do
          main class: "container mx-auto px-2" do
            render(@inner_content)
          end
        end

        if Mix.env() == :dev do
          c &Tableau.live_reload/1
        end
      end
    end
  end
end

JS/CSS

You can arbitrarily start other build tools as "watchers". This is inspired by the way Phoenix does it.

# config/config.exs

import Config

config :tableau, :assets,
  npx: [
    "tailwindcss",
    "-o",
    "_site/css/site.css",
    "--watch"
  ]

# or if you are using a package similar to the TailwindCSS hex package

config :tableau, :assets, tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}

import_config "#{config_env()}.exs"

This will start a long running process that will independently build your CSS as it sees files change.

These are started automatically when you run mix tableau.server.

Static Assets

Other static assets can be copied into the "out" directory by placing them in an extra directory in the root of your project.

This directory can be configured.

config :tableau, :config,
  include_dir: "static"

Development

The dev server can be started with mix tableau.server. On file change, a browser reload will be triggered and the page your requesting will be re-built during the request.

 from https://github.com/elixir-tools/tableau

Monday, 18 December 2023

开源的客服聊天系统-Papercups



Papercups是一款开源的在线实时聊天或客服系统。基于 Elixir语言编写,遵守MIT开源协议。Papercups支持直接对接 Slack,此外还支持电子邮件回复、自定义聊天组件、Markdown 和 Emoji 文本等功能,并适配了 Flutter、React 等前端开发框架。

功能特色:

    通过电子邮件回复
    来自短信的回复
    自定义聊天小部件: 一个可自定义的聊天小部件,可以嵌入网站以与客户交谈
    React 支持 – 将聊天小部件嵌入为 React 组件或简单的 HTML代码
    React Native 支持 – 将聊天小部件嵌入到 React Native 应用程序中
    Flutter支持 – 将聊天小部件嵌入 Flutter 应用程序中
    Slack 集成 – 与 Slack 连接,可以直接从 Slack 频道查看和回复消息
    Mattermost 集成 – 与 Mattermost 连接,可以直接从 Mattermost 查看和回复消息
    Markdown和表情符号支持 –
    邀请团队 – 向团队成员发送邀请链接以加入
    对话管理 – 关闭、分配对话并确定其优先级

Demo: https://app.papercups.io/demo

源代码:https://github.com/papercups-io/papercups

Friday, 31 March 2023

Build your own X

 Master programming by recreating your favorite technologies from scratch. 

https://codecrafters.io/

Table of Contents

This repository is a compilation of well-written, step-by-step guides for re-creating our favorite technologies from scratch.

What I cannot create, I do not understand — Richard Feynman.

It's a great way to learn.

Tutorials

Build your own 3D Renderer

Build your own Augmented Reality

Build your own BitTorrent Client

Build your own Blockchain / Cryptocurrency

Build your own Bot

Build your own Command-Line Tool

Build your own Database

Build your own Docker

Build your own Emulator / Virtual Machine

Build your own Front-end Framework / Library

Build your own Game

Build your own Git

Build your own Network Stack

Build your own Neural Network

Build your own Operating System

Build your own Physics Engine

Build your own Programming Language

Build your own Regex Engine

Build your own Search Engine

Build your own Shell

Build your own Template Engine

Build your own Text Editor

Build your own Visual Recognition System

Build your own Voxel Engine

Build your own Web Browser

Build your own Web Server

Uncategorized

Contribute

Origins & License

CC0

This repository is the work of many contributors. It was started by Daniel Stefanovic, and is now maintained by CodeCrafters, Inc. To the extent possible under law, CodeCrafters, Inc. has waived all copyright and related or neighboring rights to this work.

from https://github.com/codecrafters-io/build-your-own-x