Skip to content

Instantly share code, notes, and snippets.

View fonsp's full-sized avatar
🌳
climbing

Fons van der Plas fonsp

🌳
climbing
View GitHub Profile
@fonsp
fonsp / jupytercon demo.jl
Last active February 7, 2024 11:04
Two notebooks/slides from my JupyterCon 2023 talk about Pluto.jl – https://www.youtube.com/watch?v=Rg3r3gG4nQo
### A Pluto.jl notebook ###
# v0.19.27
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
### A Pluto.jl notebook ###
# v0.19.37
using Markdown
using InteractiveUtils
# ╔═╡ 77da0af3-13b8-46ba-bd6a-9ed938474c59
accesibility_def = md"""
!!! warning "Definition"
Let's define the **Accessibility** of a package/software as:
### A Pluto.jl notebook ###
# v0.19.32
using Markdown
using InteractiveUtils
# ╔═╡ 349fd1ca-7d1f-4150-9f6e-c0a5401f7d09
using BenchmarkTools
# ╔═╡ 3062003c-7ef9-11ee-3894-4bb027622ad4

Deploying Julia on heroku

Let's assume that you can run your web server on your own computer, and that you can open it in your own browser (through localhost or 127.0.0.1). This guide will go through the steps of putting that app online!

This guide will be based on a hello world sample project that uses Genie.jl, but the steps from this guide apply to any Julia web framework.

heroku has tons of features, but for a simple app, we only need the basics. In particular, we do not need the heroku command line, we can do everything through the online GUI.

Basics

heroku uses git for deployment: to package your app, you create a git repository, and to put a new version of your app online, you push to the git repository. If you already know git, then you now know how to manage a web server! It's like GitHub pages, but more powerful (and more complicated). Read heroku's introduction for a basi

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8" />
<meta name="pluto-insertion-spot-meta">
@fonsp
fonsp / turtles.jl
Last active October 4, 2023 13:03
### A Pluto.jl notebook ###
# v0.19.3
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
const base64_arraybuffer = async (data) => {
// Use a FileReader to generate a base64 data URI
const base64url = await new Promise((r) => {
const reader = new FileReader()
reader.onload = () => r(reader.result)
reader.readAsDataURL(new Blob([data]))
})
/*
The result looks like
@fonsp
fonsp / bas64url benchmark.jl
Created March 7, 2022 20:26
JS and Julia implementations for base64url, a non-standard variant of base64. See https://en.wikipedia.org/wiki/Base64#Variants_summary_table
### A Pluto.jl notebook ###
# v0.18.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@fonsp
fonsp / client.jl
Last active February 3, 2022 00:25
Simple TCP server and client in Julia
using Sockets
import Sockets: connect
using Logging
ENV["JULIA_DEBUG"] = Main
Base.@kwdef struct 🐸ServerConnection
stream::IO
read_task::Task
➜ registries ls
General General.tar.gz General.toml PlutoPackages
➜ registries rm -r *
zsh: sure you want to delete all 4 files in /Users/fons/.julia/registries [yn]? y
➜ registries ls
➜ registries # no registries
➜ registries julia16
_
_ _ _(_)_ | Documentation: https://docs.julialang.org