Author: ogpveceu5ydf

  • Hold-My-Code

    Hold-My-Code

    Description

    Hold My Code is a web based app where in which a user can write and save code snippets and notes with javascript highlighting. The application works online as well as offline and can be installed as a browser application.

    Table of Contents

    Installation

    Hold My Code does not require installation, but can be installed to be used offline.

    Technologies Used:

    • Node.js
    • Javascript
    • Express.js
    • Webpack
    • CodeMirror
    • IndexDB

    Usage

    Landing Page

    Deployed Link

    License

    MIT License

    Copyright (c) [2022]

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Visit original content creator repository https://github.com/Robdom87/Hold-My-Code
  • next-fauna-data

    ⚡ Next Fauna Data

    • A Next.js Guestbook app with Fauna backend using GraphQL, boilerplate code from Vercel
    • Note: to open web links in a new window use: ctrl+click on link

    GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

    📄 Table of contents

    📚 General Info

    📷 Screenshots

    Example screenshot Example screenshot

    📶 Technologies

    💾 Setup

    • npm run dev runs the app in the development mode. Open http://localhost:3000 to view it in the browser. Note: requires Fauna API key
    • npm run build builds the app for production to the build folder. Note: requests Fauna API key
    • npm run start to run the built app.

    💻 Code Examples – taken from Vercel boilerplate code

    • lib/fauna.js mutation function to create a new guestbook entry
    export const createGuestbookEntry = (newEntry) => {
      const mutation = gql`
        mutation CreateGuestbookEntry($input: GuestbookEntryInput!) {
          createGuestbookEntry(data: $input) {
            _id
            _ts
            name
            message
            createdAt
          }
        }
      `
    
      return graphQLClient.request(mutation, { input: newEntry })
    }

    📋 Status & To-Do List

    • Status: Working. Deployed to Vercel
    • To-Do: Add extra fields and a user image/icon. Need Fauna API key to run dev. server

    👏 Inspiration

    📁 License

    • N/A

    ✉️ Contact

    Visit original content creator repository https://github.com/AndrewJBateman/next-fauna-data
  • next-fauna-data

    ⚡ Next Fauna Data

    • A Next.js Guestbook app with Fauna backend using GraphQL, boilerplate code from Vercel
    • Note: to open web links in a new window use: ctrl+click on link

    GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

    📄 Table of contents

    📚 General Info

    📷 Screenshots

    Example screenshot Example screenshot

    📶 Technologies

    💾 Setup

    • npm run dev runs the app in the development mode. Open http://localhost:3000 to view it in the browser. Note: requires Fauna API key
    • npm run build builds the app for production to the build folder. Note: requests Fauna API key
    • npm run start to run the built app.

    💻 Code Examples – taken from Vercel boilerplate code

    • lib/fauna.js mutation function to create a new guestbook entry
    export const createGuestbookEntry = (newEntry) => {
      const mutation = gql`
        mutation CreateGuestbookEntry($input: GuestbookEntryInput!) {
          createGuestbookEntry(data: $input) {
            _id
            _ts
            name
            message
            createdAt
          }
        }
      `
    
      return graphQLClient.request(mutation, { input: newEntry })
    }

    📋 Status & To-Do List

    • Status: Working. Deployed to Vercel
    • To-Do: Add extra fields and a user image/icon. Need Fauna API key to run dev. server

    👏 Inspiration

    📁 License

    • N/A

    ✉️ Contact

    Visit original content creator repository https://github.com/AndrewJBateman/next-fauna-data
  • Neurthino.jl

    Stable Dev Build Status Codecov DOI

    Neurthino.jl

    Neurthino.jl is a package for calculating neutrino oscillation probabilities. The main focus of the package lies on atmospheric neutrino flux and the neutrino propagation through earth.

    Basic Usage

    First of all the basic vacuum properties have to be defined by creating a OscillationParameters struct with fixed number of neutrino flavours of the considered model:

    julia> using Neurthino
    
    julia> osc = OscillationParameters(3);

    The values of the mixing angles (setθ!), mass squared differences (setΔm²) and CP phases (setδ!) are initialised to 0 and have to be set individually:

    julia> setθ!(osc, 1=>2, 0.59);
    
    julia> setθ!(osc, 1=>3, 0.15);
    
    julia> setθ!(osc, 2=>3, 0.84);
    
    julia> setδ!(osc, 1=>3, 3.86);
    

    The mass squared differences are defined as and within the package the convention is kept.

    julia> setΔm²!(osc, 2=>3, -2.523e-3);
    
    julia> setΔm²!(osc, 1=>2, -7.39e-5);
    

    These oscillation parameters can now be used to calculate the oscillation probabilities between the flavour states:

    julia> p = Pνν(osc, 1, 10000)
    4-dimensional AxisArray{Float64,4,...} with axes:
        :Energy, [1.0]
        :Baseline, [10000.0]
        :InitFlav, NeutrinoFlavour[Electron, Muon, Tau]
        :FinalFlav, NeutrinoFlavour[Electron, Muon, Tau]
    And data, a 1×1×3×3 Array{Float64,4}:
    [:, :, 1, 1] =
     0.40280077905806266
    
    [:, :, 2, 1] =
     0.24823028034134093
    
    [:, :, 3, 1] =
     0.348968940600596
    
    [:, :, 1, 2] =
     0.10025499082597984
    
    [:, :, 2, 2] =
     0.49250415138072934
    
    [:, :, 3, 2] =
     0.4072408577932906
    
    [:, :, 1, 3] =
     0.49694423011595723
    
    [:, :, 2, 3] =
     0.2592655682779296
    
    [:, :, 3, 3] =
     0.24379020160611306
    

    The output is an AxisArray which provides intuitive indexing, e.g. for P(νμ→ντ) at the given energy and baseline:

    julia> p[Energy=1, Baseline=1, InitFlav=Muon, FinalFlav=Tau]
    0.2592655682779296
    

    The probabilities are calculated based on the transition matrix (the so-called PMNS-Matrix) between flavour and mass eigenstates, as well as the Hamiltonian in the mass eigenbasis. In order to calculating these just once, the Pνν function can be utilised in the following way:

    julia> U = PMNSMatrix(osc)
    3×3 Array{Complex{Float64},2}:
       0.82161+0.0im         0.550114+0.0im        -0.112505+0.0983582im
     -0.301737+0.0608595im   0.601232+0.0407488im   0.736282+0.0im
      0.476688+0.0545516im  -0.576975+0.0365253im   0.659968+0.0im
    
    julia> H = Hamiltonian(osc)
    3-element Array{Complex{Float64},1}:
     -0.0008902666666666667 + 0.0im
     -0.0008163666666666667 + 0.0im
      0.0017066333333333333 + 0.0im
    
    julia> Pνν(U, H, 1, 10000)
    4-dimensional AxisArray{Float64,4,...} with axes:
        :Energy, [1.0]
        :Baseline, [10000.0]
        :InitFlav, NeutrinoFlavour[Electron, Muon, Tau]
        :FinalFlav, NeutrinoFlavour[Electron, Muon, Tau]
    And data, a 1×1×3×3 Array{Float64,4}:
    [:, :, 1, 1] =
     0.40280077905806266
    
    [:, :, 2, 1] =
     0.24823028034134093
    
    [:, :, 3, 1] =
     0.348968940600596
    
    [:, :, 1, 2] =
     0.10025499082597984
    
    [:, :, 2, 2] =
     0.49250415138072934
    
    [:, :, 3, 2] =
     0.4072408577932906
    
    [:, :, 1, 3] =
     0.49694423011595723
    
    [:, :, 2, 3] =
     0.2592655682779296
    
    [:, :, 3, 3] =
     0.24379020160611306
    

    Oscillations in Vacuum

    For homogeneous matter with a fixed density, a modified PMNS-Matrix and Hamiltonian can be determined and passed into Pνν, just like for oscillations in vacuum. In order to determine the modified PMNS-Matrix and Hamiltonian the neutrino energy and the matter density are required:

    julia> U_mat, H_mat = MatterOscillationMatrices(U, H, 1, 13);
    
    julia> H_mat
    3-element Array{Complex{Float64},1}:
     -0.0008404901318507502 - 2.5459232191294903e-20im
       9.078126149399635e-5 - 1.75151351027943e-20im
      0.0017419062876598283 - 1.8741859435908039e-19im
    
    julia> U_mat
    3×3 Array{Complex{Float64},2}:
      0.0358018-0.000158113im  0.970863+0.0im       -0.178275+0.156083im
     -0.662778+0.00661213im    0.157174+0.116074im   0.722845+0.0im
      0.74793+0.0im            0.0917808+0.104043im  0.649115-0.00104331im
    

    The oscillation probabilities using the Pνν function, as described above:

    julia> Pνν(U_mat, H_mat, 1, 10000)
    4-dimensional AxisArray{Float64,4,...} with axes:
        :Energy, [1]
        :Baseline, [10000]
        :InitFlav, NeutrinoFlavour[Electron, Muon, Tau]
        :FinalFlav, NeutrinoFlavour[Electron, Muon, Tau]
    And data, a 1×1×3×3 Array{Float64,4}:
    [:, :, 1, 1] =
     0.8340722296308641
    
    [:, :, 2, 1] =
     0.08290502782120308
    
    [:, :, 3, 1] =
     0.08302274254793415
    
    [:, :, 1, 2] =
     0.10825570726818898
    
    [:, :, 2, 2] =
     0.052976635020068
    
    [:, :, 3, 2] =
     0.8387676577117485
    
    [:, :, 1, 3] =
     0.05767206310094823
    
    [:, :, 2, 3] =
     0.8641183371587345
    
    [:, :, 3, 3] =
     0.07820959974032213
    
    

    The second option is suitable for scenarios with more complex paths with sections of different densities. An example is shown in the next chapter, where we propagate neutrinos through the earth.

    Neutrino Propagation through the Earth

    The Neurthino.jl package also includes features for the neutrino oscillation probabilities through the Earth, i.e. it contains functions for generating a neutrino path based on the PREM model. In the following example a neutrino oscillogram with a resolution of 200×200 bins is determined. The zenith angles for up going neutrinos (cos(θ)ϵ[-1,0]) and subsequently the neutrino paths are generated first:

    julia> zenith = acos.(range(-1,stop=0,length=200));
    
    julia> paths = Neurthino.prempath(zenith, 2.5, samples=100, discrete_densities=0:0.1:14);
    

    The detector is assumed to be 2.5km under the earth’s surface (a typical KM3NeT detector block in the Mediterranean), which is a realistic scenario for Water-Cherenkov-Detectors in sea or ice. Each path consists of 100 sections of equal lengths while the matter density is taken from the PREM model. If a vector of densities is passed as discrete_densities, the values are clipped to the closest value.

    julia> energies = 10 .^ range(0, stop=2, length=200);
    
    julia> prob = Pνν(U, H, energies, paths);
    

    The returned array prob is again of type AxisArray with an axis Path for the path index (instead of the Baseline axis). P(νe→νe) is determined by prob[InitFlav=Electron, FinalFlav=Electron], which can be visualised by a heatmap:

    and for P(νμ→νμ) or prob[InitFlav=Muon, FinalFlav=Muon]:

    Visit original content creator repository https://github.com/KM3NeT/Neurthino.jl
  • ManipulandoXLSX

    ManipulandoXLSX

    Projeto cuja função é recuperar dados de um arquivo txt e criar e inserir os dados recuperados em um arquivo xlsx

    Resumo:

    Por questões práticas e tecnológicas diversas pessoas, principalmente em ambiente organizacional optam por fazerem relatórios e planilhas digitalizados por computadores para assim acessá-los e apresentá-los de forma mais eficiente.
    Assim sendo, a fim de facilitar a vida de um colaborador da área da psicologia que tem a função de fazer um relatório em um arquivo de texto sobre seus pacientes e, após, passar os dados desse relatório em forma de planilha. Desenvolvi um programa que acessa este arquivo na extensão “.txt” e recupera as informações deste arquivo (nome, quantidade de sessões no mês e convênio), calcula o total a receber de cada cliente levando em consideração a quantidade de consultas com o quanto o convênio do respectivo cliente paga.

    Tópicos:

    🔹 Sobre o projeto

    🔹 Funções do script

    🔹 Requisitos para rodar o código

    🔹 Como rodar o código

    Sobre o Projeto:

    O programa foi escrito em Python com o auxílio da biblioteca openpyxl, usada para que o Python possa interagir com arquivos gerados pela ferramenta de edição e criação de planilhas Microsoft Excel (arquivos de extensão “.xls” e “.xlsx”). O diretório conta com o script app.py e duas pastas, documentos (onde os documentos de extensão “.txt” ficam) e planilhas (onde o programa app.py salva as planilhas criadas)

    Funções do script:

    • main():

      Função principal, faz um loop enquanto interage com o usuário para receber o nome do relatório para recuperar os dados e o mês referente à planilha além de chamar as demais funções para criar, inserir os dados e formatar a planilha.
    • txt(arq):

      Função que recebe o nome do arquivo de texto inserido pelo usuário; verifica se foi adicionado a extensão, caso não, adiciona a extenção”.txt”.
    • usaDoc(documento):

      Função que recebe o nome do documento; abre o documento; separa os registros; verifica para cada registro, para cada linha do registro se possui algum dos dados necessários, caso a linha tenha a função chamará outra função que garimpa apenas o valor necessário; retorna um dicionário contendo todos dados dos registros.
    • precoConvenio(convenio,qtd):

      Função que recebe o nome do convênio do registro e a quantidade de seções; verifica o convênio e retorna o resultado do preço por seção multiplicado pela quantidade.
    • pegaQtd(frase):

      Função que recebe a linha onde o valor referente à quantidade se encontra e retorna apenas este valor.
    • pegaNome(frase):

      Função que recebe a linha onde o valor referente ao nome se encontra e retorna apenas este valor.
    • repetido(lista,nome):

      Função que recebe uma lista de dicionários e um nome; a função irá verificar se o nome pertence a algum dicionário da lista e, caso sim: irá retornar uma lista com o booleano verdadeiro e o índice do dicionário onde está o nome, caso não: será retornado uma lista com falso e o número -1.
    • criaPlan(arq,mes):

      Função que recebe o nome do arquivo texto e o mês referente à planilha; cria a planilha; chama as funções que adicionam e estiliza os registros e salva o arquivo com extensão “.xlsx”.
    • addPessoas

      (pessoas, plan, linhaInicial): Função que recebe uma lista de dicionários que contêm os dados das pessoas, a planilha em que serão inseridos os dados e a linha de onde o programa iniciará a adicionar; adiciona os registros e seus valores na planilha.
    • estiliza(planilha,celulas,estilo):

      Função que recebe a planilha que irá modificar, uma lista com as células e um inteiro que indica o tipo de estilo; caso estilo seja igual a 1, a função irá estilizar as células como células de título; caso estilo seja igual a 2, as células serão formatadas como células de valores.

    Requisitos para rodar o código:

    • Linguagem Python
    • Biblioteca openpyxl

    Recomendo que use uma versão recente do python para evitar erros. A versão que usei foi a 3.8

    Para instalar o Python em seu computador,acesse o link abaixo para abrir o site oficial da linguagem onde pode-se consultar informações sobre a instalação:

    https://www.python.org
    

    Para instalar o openpyxl cole o seguinte código na linha de comando do seu computador:

    pip install openpyxl
    

    Para mais informações sobre a biblioteca acesse a documentação disponível em:

    https://openpyxl.readthedocs.io/
    

    Como rodar o código:

    1. Selecione a pasta que deseja baixar o projeto, abra a interface de linha de comando do Git e cole o seguinte código para clonar o projeto:
      git clone https://github.com/KevinFGR/ManipulandoXLSX.git 
      
    2. Abra a interface de linha de comando do seu computador na pasta manipulandoxlsx e insira o seguinte comando para executar o programa:
      py app.py
      
    3. Interaja com o programa respondendo o mês referente e o nome do arquivo de texto
    4. Após o programa informar que a planilha foi criada você pode encontrá la na pasta planilhas
    Visit original content creator repository https://github.com/KevinFGR/ManipulandoXLSX
  • ManipulandoXLSX

    ManipulandoXLSX

    Projeto cuja função é recuperar dados de um arquivo txt e criar e inserir os dados recuperados em um arquivo xlsx

    Resumo:

    Por questões práticas e tecnológicas diversas pessoas, principalmente em ambiente organizacional optam por fazerem relatórios e planilhas digitalizados por computadores para assim acessá-los e apresentá-los de forma mais eficiente.
    Assim sendo, a fim de facilitar a vida de um colaborador da área da psicologia que tem a função de fazer um relatório em um arquivo de texto sobre seus pacientes e, após, passar os dados desse relatório em forma de planilha. Desenvolvi um programa que acessa este arquivo na extensão “.txt” e recupera as informações deste arquivo (nome, quantidade de sessões no mês e convênio), calcula o total a receber de cada cliente levando em consideração a quantidade de consultas com o quanto o convênio do respectivo cliente paga.

    Tópicos:

    🔹 Sobre o projeto

    🔹 Funções do script

    🔹 Requisitos para rodar o código

    🔹 Como rodar o código

    Sobre o Projeto:

    O programa foi escrito em Python com o auxílio da biblioteca openpyxl, usada para que o Python possa interagir com arquivos gerados pela ferramenta de edição e criação de planilhas Microsoft Excel (arquivos de extensão “.xls” e “.xlsx”). O diretório conta com o script app.py e duas pastas, documentos (onde os documentos de extensão “.txt” ficam) e planilhas (onde o programa app.py salva as planilhas criadas)

    Funções do script:

    • main():

      Função principal, faz um loop enquanto interage com o usuário para receber o nome do relatório para recuperar os dados e o mês referente à planilha além de chamar as demais funções para criar, inserir os dados e formatar a planilha.

    • txt(arq):

      Função que recebe o nome do arquivo de texto inserido pelo usuário; verifica se foi adicionado a extensão, caso não, adiciona a extenção”.txt”.

    • usaDoc(documento):

      Função que recebe o nome do documento; abre o documento; separa os registros; verifica para cada registro, para cada linha do registro se possui algum dos dados necessários, caso a linha tenha a função chamará outra função que garimpa apenas o valor necessário; retorna um dicionário contendo todos dados dos registros.

    • precoConvenio(convenio,qtd):

      Função que recebe o nome do convênio do registro e a quantidade de seções; verifica o convênio e retorna o resultado do preço por seção multiplicado pela quantidade.

    • pegaQtd(frase):

      Função que recebe a linha onde o valor referente à quantidade se encontra e retorna apenas este valor.

    • pegaNome(frase):

      Função que recebe a linha onde o valor referente ao nome se encontra e retorna apenas este valor.

    • repetido(lista,nome):

      Função que recebe uma lista de dicionários e um nome; a função irá verificar se o nome pertence a algum dicionário da lista e, caso sim: irá retornar uma lista com o booleano verdadeiro e o índice do dicionário onde está o nome, caso não: será retornado uma lista com falso e o número -1.

    • criaPlan(arq,mes):

      Função que recebe o nome do arquivo texto e o mês referente à planilha; cria a planilha; chama as funções que adicionam e estiliza os registros e salva o arquivo com extensão “.xlsx”.

    • addPessoas

      (pessoas, plan, linhaInicial): Função que recebe uma lista de dicionários que contêm os dados das pessoas, a planilha em que serão inseridos os dados e a linha de onde o programa iniciará a adicionar; adiciona os registros e seus valores na planilha.

    • estiliza(planilha,celulas,estilo):

      Função que recebe a planilha que irá modificar, uma lista com as células e um inteiro que indica o tipo de estilo; caso estilo seja igual a 1, a função irá estilizar as células como células de título; caso estilo seja igual a 2, as células serão formatadas como células de valores.

    Requisitos para rodar o código:

    • Linguagem Python
    • Biblioteca openpyxl

    Recomendo que use uma versão recente do python para evitar erros. A versão que usei foi a 3.8

    Para instalar o Python em seu computador,acesse o link abaixo para abrir o site oficial da linguagem onde pode-se consultar informações sobre a instalação:

    https://www.python.org
    

    Para instalar o openpyxl cole o seguinte código na linha de comando do seu computador:

    pip install openpyxl
    

    Para mais informações sobre a biblioteca acesse a documentação disponível em:

    https://openpyxl.readthedocs.io/
    

    Como rodar o código:

    1. Selecione a pasta que deseja baixar o projeto, abra a interface de linha de comando do Git e cole o seguinte código para clonar o projeto:

      git clone https://github.com/KevinFGR/ManipulandoXLSX.git 
      
    2. Abra a interface de linha de comando do seu computador na pasta manipulandoxlsx e insira o seguinte comando para executar o programa:

      py app.py
      
    3. Interaja com o programa respondendo o mês referente e o nome do arquivo de texto
    4. Após o programa informar que a planilha foi criada você pode encontrá la na pasta planilhas

    Visit original content creator repository
    https://github.com/KevinFGR/ManipulandoXLSX

  • wasi-worker

    The proper way to create WASM browser service workers.

    This crate provides rust library and JS glue code allowing to wrap POSIX compatible code into WASM/WASI target to be able to run in the browser service worker. It also provides imput/output message channel with main web application.

    Why WASI?

    WebAssembly System Interfaces (WASI) is an exciting new specification that allows running POSIX-like applications anywhere, safely and securely with WebAssembly. -> Medium / Running WASI in Javascript with Wasmer-JS

    POSIX-compatible applications compiled to WASI can now also run in browser, think of code-reuse and delegating server workload to client side. On top of that it appears code compiled to wasm32-wasi target is executing about 2 times faster than code compiled to other wasm32 targets with web bindings, CPU intensive workloads can now execute with performance close to native targets (try http://wabench.com:8080).

    Why might I need wasi-worker?

    WASI target allows to compile many crates which are using standard library, except threads and networking which is not supported yet. The only problem is that WASI is not built to be executed from browser, rather it is standard which aims to run WASM code on server side. Leveraging @wasmer/wasi this crate provides browser service worker WASI runtime as well as communication bridge to/from web application.

    Another possible reason is WASM code which executes as part of web application occupies same javascript thread, hence if wasm code is running complex calculations it will block browser application while working. To make it working in separate thread we can employ browser service workers.

    Usage example

    This example requires WASI JavaScript bindings which can be deployed with wasi-worker-cli or WASI environment with properly preconfigured filesystem

    use wasi_worker::*;
    
    struct MyWorker;
    impl Handler for MyWorker {
      fn on_message(&self, msg: &[u8]) -> std::io::Result<()> {
        println!("My Worker got message: {:?}", msg);
        Ok(())
      }
    }
    
    fn main() {
      // JS glue code will hook to /output.bin
      ServiceWorker::initialize(ServiceOptions::default());
      ServiceWorker::set_message_handler(Box::new(MyWorker {}));
      // Send binary message to main browser application
      ServiceWorker::post_message(b"message");
    }

    JavaScript WASI bindings

    JavaScript WASI bindings are built on top of @wasmer libraries can be easily deployed with wasiworker tool:

    cargo install wasi-worker-cli
    

    wasiworker install will add sample worker code and bin target to current crate directory:

    wasiworker install
    

    wasiworker deploy will build worker bin target and deploy it with JS glue code under ./dist:

    wasiworker deploy
    

    For hacking JS glue code source code is located in the same repository.

    More detailed example

    use wasi_worker::*;
    
    struct MyWorker {}
    impl Handler for MyWorker {
      fn on_message(&self, msg: &[u8]) -> std::io::Result<()> {
        // Process incoming message
        println!("My Worker got message: {:?}", msg);
        Ok(())
      }
    }
    
    fn main() {
      // In WASI setup output will go to /output.bin
      #[cfg(target_os="wasi")]
      let opt = ServiceOptions::default();
      // In user filesystem we operate under current dir
      #[cfg(not(target_os="wasi"))]
      let opt = ServiceOptions { 
        output: FileOptions::File("./testdata/output.bin".to_string()) 
      };
      let output_file = match &opt.output { 
        FileOptions::File(path) => path.clone() 
      };
      ServiceWorker::initialize(opt)
        .expect("ServiceWorker::initialize");
    
      // Attach Agent to ServiceWorker as message handler singleton
      ServiceWorker::set_message_handler(Box::new(MyWorker {}));
    
      // Send binary message to main browser application
      // this requires JS glue see wasi-worker-cli
      ServiceWorker::post_message(b"message")
        .expect("ServiceWorker::post_message");
    
      // It does not autodelete output file
      std::fs::remove_file(output_file)
        .expect("Remove output.bin");
    }

    TODO

    • library code with WASI fs interface
    • basic example
    • documentation
    • CLI for worker setup
    • drop output file on exit

    Visit original content creator repository
    https://github.com/dunnock/wasi-worker

  • backstage

    headline

    English | 한국어 | 中文版 | Français

    License CNCF Status Discord Code style Codecov OpenSSF Best Practices OpenSSF Scorecard

    What is Backstage?

    Backstage is an open source framework for building developer portals. Powered by a centralized software catalog, Backstage restores order to your microservices and infrastructure and enables your product teams to ship high-quality code quickly without compromising autonomy.

    Backstage unifies all your infrastructure tooling, services, and documentation to create a streamlined development environment from end to end.

    software-catalog

    Out of the box, Backstage includes:

    • Backstage Software Catalog for managing all your software such as microservices, libraries, data pipelines, websites, and ML models
    • Backstage Software Templates for quickly spinning up new projects and standardizing your tooling with your organization’s best practices
    • Backstage TechDocs for making it easy to create, maintain, find, and use technical documentation, using a “docs like code” approach
    • Plus, a growing ecosystem of open source plugins that further expand Backstage’s customizability and functionality

    Backstage was created by Spotify but is now hosted by the Cloud Native Computing Foundation (CNCF) as an Incubation level project. For more information, see the announcement.

    Project roadmap

    For information about the detailed project roadmap including delivered milestones, see the Roadmap.

    Getting Started

    To start using Backstage, see the Getting Started documentation.

    Documentation

    The documentation of Backstage includes:

    Community

    To engage with our community, you can use the following resources:

    • Discord chatroom – Get support or discuss the project
    • Contributing to Backstage – Start here if you want to contribute
    • RFCs – Help shape the technical direction
    • FAQ – Frequently Asked Questions
    • Code of Conduct – This is how we roll
    • Adopters – Companies already using Backstage
    • Blog – Announcements and updates
    • Newsletter – Subscribe to our email newsletter
    • Backstage Community Sessions – Join monthly meetups and explore Backstage community
    • Give us a star ⭐️ – If you are using Backstage or think it is an interesting project, we would love a star ❤️

    Governance

    See the GOVERNANCE.md document in the backstage/community repository.

    License

    Copyright 2020-2025 © The Backstage Authors. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page: https://www.linuxfoundation.org/trademark-usage

    Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

    Security

    Please report sensitive security issues using Spotify’s bug-bounty program rather than GitHub.

    For further details, see our complete security release process.

    Visit original content creator repository https://github.com/backstage/backstage
  • HyperFace

    HyperFace

    Contains the implementation of HyperFace: A deep multi task learning framework for facial recognition, landmark detection, pose and gender detection

    TODO :

    • Implement HyperFace-AlexNet

      • Selective search
      • Iterative region proposal (IRP)
      • Landmark based – Non Maximum Suppression (L-NMS)
      • skip training RCNN on imagenet and directly train on region proposals from AFLW dataset
      • Copy weights to the hyperface model and retrain it on AFLW dataset
    • Implement HyperFace-ResNet101

      • Uses keras.application to load model weights and retrain R-CNN
      • Re-write the model architecture for resnet and carry out training
    • Experimental stuff

      • Find better loss functions/ Implement custom loss functions
      • Find better optimizer
      • Decide on using ReduceLROnPlateau or not, look for useful callbacks
    • Future Plans

      • Implement using ResNet
      • Divide the code into seperate files
      • support command line arguments
    • Known issues

      • openCV’s imread function reads in BGR instead of RGB, skimage ioread is comparatively slower than openCV, matplotlib shows wrong image plots because of BGR mode
      • Some images are bw by default so proper dimension conversion can not be done at all images (at the moment those images are skipped to save me from headache)
      • Processing all images uses up 14gb+ of RAM, so try and implement some other way because I plan on implementing data augementation in future to increase face detection accuracy
      • No official keras implementation of ResNet101, this code relies on experimental code(ro be changed in next version update)

    Current model archietecture (AlexNet) is shown below –

    HyperFace AlexNet

    Visit original content creator repository https://github.com/ashishtrivedi16/HyperFace
  • flutter_quickjs

    flutter_quickjs

    Flutter bindings with dart:ffi for QuickJS : A small Javascript engine supports ES2020.

    This is a plugin help execute javascript on flutter app, which is convenient to use with simple apis, and it supports iOS, Android now.

    Install

    To use this plugin, add flutter_quickjs as a dependency in your pubspec.yaml file.

    CocoaPods: >= 1.10.0

    Usage

    Basic Example

    import 'package:flutter/material.dart';
    import 'package:flutter_quickjs/flutter_quickjs.dart';
    
    void main() {
      var evalResult = runJs();
      runApp(
        MaterialApp(
          home: Material(
            child: Center(
              child: Text(evalResult),
            ),
          ),
        ),
      );
    }
    
    runJs() {
      var qjs = FlutterQuickjs();
      var res = qjs.eval('Math.PI');
      qjs.close();
      return res.toString();
    }

    Global Object

    qjs.eval('var a = 666;');
    print(qjs.global()['a']);
    // 666

    Set Value

    qjs.setValue('globalThis.console.log', (msg) {
      print(msg);
    });
    qjs.eval('console.log("hello world!")');
    // hello world!

    JS Function Call

    var func = qjs.eval('function func(a, b){return [a, b, a + b];}func');
    print(func(2,3));
    // [2, 3, 5]

    For more usages please see example

    Datatype Mapping

    dart js
    null Undefined / Null
    Bool Boolean
    Int Number
    Double Number
    String String
    List Array
    Map Object
    Function Function
    Exception Error

    Todo

    • bytecode support
    • support more platforms like macos,linux

    Reference

    Lincense

    MIT © ZhangPingFan

    Visit original content creator repository
    https://github.com/ZhangPingFan/flutter_quickjs