Blog

  • GraphQLRouteCollection

    GraphQLRouteCollection

    Provides a simple route collection to integrate GraphQLSwift into a Vapor application.

    Swift License

    Installation

    Add GraphQLRouteCollection to your Package.swift

    import PackageDescription
    
    let package = Package(
        dependencies: [
            ...
            .package(url: "https://github.com/stevenlambion/GraphQLRouteCollection.git", .upToNextMajor(from: "0.0.1")),
        ],
        .target(
            name: "App",
            dependencies: [..., "GraphQLRouteCollection"],
        ),
    )

    Usage

    Add the GraphQLRouteCollection to your droplet. Your schema, rootValue, and context are provided through a closure to allow per request dynamic execution. A common use case is setting up dataloaders for each request.

    Basic

    import Vapor
    import GraphQLRouteCollection
    
    extension Droplet {
        func setupRoutes() throws {
    
            // By default, the collection uses "graphql" as its path.
            // Pass a custom path as the first argument to change it.
    
            try collection(
                GraphQLRouteCollection() { req in (
                    schema: schema,
                    rootValue: [:],
                    context: [:]
                )}
            )
    
        }
    }

    GraphiQL

    Enables the GraphiQL IDE when a user accesses the graphql path in a web browser.

    GraphQLRouteCollection(enableGraphiQL: true) { req in (
        schema: schema,
        rootValue: [:],
        context: [:]
    )}

    Introspection Query

    The route collection enables a quick way to introspect your entire graphql schema. This is useful in development when you need to auto-generate a schema for graphql clients such as Apollo. Here’s an example of how to enable for development use.

    GraphQLRouteCollection(enableIntrospectionQuery: true) { req in (
        schema: schema,
        rootValue: [:],
        context: [:]
    )}

    To retrieve the introspected schema simply hit the graphql endpoint without a provided query. It will instead use an internal introspection query.

      fetch("localhost:8080/graphql") { resp in
        let schema = parseSchema(resp.json)
      }

    The Kitchen Sink

    GraphQLRouteCollection("graphql", enableGraphiQL: true, enableIntrospectionQuery: true) { req in (
        schema: schema,
        rootValue: [:],
        context: ["dataLoaders": createDataLoaders(req)]
    )}

    License

    This project is released under the MIT license. See LICENSE for details.

    Visit original content creator repository https://github.com/StevenLambion/GraphQLRouteCollection
  • ArchPy

    ArchPy

    Documentation Status logo

    A hierarchical stochastic geological modeling tool in Python

    Installation

    ArchPy can be installed with pip :

    pip install geoarchpy
    

    This will install ArchPy and the necessary dependencies. To install all the dependencies (including optional ones) :

    pip install geoarchpy[all]
    

    ArchPy can also be installed from the source code. To do so, clone the repository and run the following command in the main directory :

    pip install .
    

    Alternatively, it is possible to add ArchPy path directly in the python script with sys :

    sys.path.append("path where ArchPy is") 
    

    and then import ArchPy. In such case, it is necessary to install all the dependencies manually.

    Concerning the interactivity of the plots, it is necessary to install trame as well as some trame subpackages. This can be done with the following command :

    pip install trame
    pip install trame-vuetify
    pip install trame-vtk
    

    Requirements

    Works and tested with 3.8 <= python <= 3.11

    The following python packages are absolutely necessary:

    • Geone
    • matplotlib (tested with 3.10.5)
    • numpy (tested with 1.26.4)
    • scipy (tested with 1.16.1)
    • sklearn (tested with 1.7.1)
    • pandas (tested with 2.3.1)
    • shapely (tested with 2.1.1)

    These are not required but highly recommanded. They are installed with ArchPy by default.

    • pyvista (tested with 0.46.1)
    • yaml (tested with 6.0.2)
    • rasterio (tested with 1.4.3)
    • geopandas (tested with 1.1.1)
    • ipywidgets (tested with 8.1.7)
    • flopy (tested with 3.9.3)

    Examples

    There is some example notebooks :

    • 01_basic : a folder where simple and basics ArchPy functionnalities are described
    • 02_3D_ArchPy : a complete 3D ArchPy model example
    • 03_Article_example : a synthetical example shown in ArchPy article
    • 04_hierarchies : an exemple with many hierarchical units to test ArchPy capabilities
    • 05_mps_surfaces : an example how to use MPS to simulate the units surfaces
    • 06_cross_validation : a notebook that present how to perform a cross-validation directly with ArchPy
    • 07_geological_map : this notebook presents how to integrate and use a geological in an ArchPy model
    • 08_inference : little guide how to use archpy inference tools to estimate surface parameters (no facies parameters for now) –> Note that for now, the interface is not working due to incompatibilities issues with ipywidgets.
    • 09_interface : little exemple of an interface to call an preexisting archpy model as well as drawing a new model extension.
    • 10_rotation : an example of how to create a rotated model
    • 11_modflow_coupling : an example of how to couple ArchPy with Modflow

    Paper

    A paper was published on the ArchPy concept and its different capabilities. The paper was written with the version 0.1 of ArchPy. It is available with the following link.

    list of references using ArchPy

    Schorpp, L., Straubhaar, J., & Renard, P. (2024). From lithological descriptions to geological models: an example from the Upper Aare Valley. Frontiers in Applied Mathematics and Statistics, 10, 1441596 link.

    Neven, A., & Renard, P. (2023). A novel methodology for the stochastic integration of geophysical and hydrogeological data in geologically consistent models. Water Resources Research, 59(7). link

    Neven, A., Schorpp, L., & Renard, P. (2022). Stochastic multi-fidelity joint hydrogeophysical inversion of consistent geological models. Frontiers in Water, 4, 989440. link

    Contact

    For any questions regarding ArchPy, please contact me at ludovic.schorpp@unine.ch

    Visit original content creator repository https://github.com/randlab/ArchPy
  • VirAm

    VirAm – Your Virtual Friend

    The Virtual Friend made by team of Mount Carmel School for the competition Ignite. You can visit this on https://mcs-vf.herokuapp.com
    Introductory Video
    Click to view the video

    About

    VirAm is a virtual chatbot designed to help Indian students studying abroad, to help them understand their surroundings, and to make them feel at home. This bot was made keeping simplicity in mind, and to make the user feel comfortable using this.

    To make this chatbot effective in helping you adapt to the new places you are going to, VirAm has a number of features that make it easy to use. You can get these features listed here: https://mcs-vf.herokuapp.com/features.

    Instructions on how to set it up

    1. Create a Dialogflow agent, and put it’s service account JSON file in the root directory by the name: viram.json
    2. Create it’s commands and responses as per your requirements.
    3. Install python if not installed.
    4. Make sure you can run pip --version and python --version in the Terminal
    5. Run pip install -r requirements.txt with the terminal opened in the project’s root directory
    6. Run python main.py to start the app server.
    7. Open http://localhost:2000 in your browser.

    Which files are for what purposes

    • media/*: Graphics and Video used in the official YouTube demonstration for the project.
    • static/*: Static files for the web interface like images, css, js, etc.
    • templates/*: HTML templates.
    • .env: Sets the path of dialogflow credentials.
    • Procfile: The file for providing instructions to Heroku on how to run the app.
    • commands.py: Specialized commands to interpret dialogflow reponses and evaluate dynamic content (Currency conversion, Translation).
    • features.py: A file containing a list of features, and some of it’s dynamic content generators for feature pages.
    • main.py: Starts the app server.
    • predict.py: Predicts the output of a given text.
    • requirements.txt: The python libraries required by the app.

    How do commands work?

    When we wish to implement dynamic content in the response, we make the dialogflow agent respond with a special command whose syntax is like: cmd:function_name <space separated or "--arg val" type arguments>

    Credits

    This project was made collaboratively by 2 students of Mount Carmel School:

    Visit original content creator repository https://github.com/Nalin-Angrish/VirAm
  • typed-duration

    Typed Duration

    Node.js CI npm version

    A Zero-dependency typed duration library for JavaScript/TypeScript. Express and convert time durations with type-safety.

    This library uses Value Object Typing to allow you to express time durations in a type-safe way, and perform conversion between different units.

    Note: requires TypeScript 3.8 or later

    Version 1.x works on Node 10+ Version 2.x requires Node 16+

    Installation

    Install the library to your project:

    npm i typed-duration
    

    Use

    Consider the following code:

    setTimeout(doSomething, 1000)

    It’s pretty clear that these are milliseconds, because you know the API. Typically, developers might do something like:

    setTimeout(doSomething, 5 * 60 * 1000) // In Five Minutes

    With this library, you can do this:

    import { Duration } from 'typed-duration'
    const { milliseconds, minutes } = Duration
    
    const period = minutes.of(5)
    
    setTimeout(doSomething, milliseconds.from(period)) // Every Five Minutes

    Well, that looks like more code. Yes, it is. It is also more semantically expressive of the programmer’s intent, which makes it better for maintenance.

    The situation is exacerbated when you expose a programming API that takes a time duration as a number. We all know that setTimeout takes milliseconds, but how do you communicate to consumers of your API what the time units are for timeout in your API call?

    You should, of course, document it, and put it in JSDoc comments so that they can get hinting in their IDE.

    You could call it timeoutSeconds to make it clear that it expects seconds.

    Or you could make it take a TimeDuration and allow them to pass in whatever they want, and convert it to the units you need, like this:

    import { Duration, TimeDuration } from 'typed-duration'
    
    function executeLater(fn: () => void, delay: TimeDuration) {
        setTimeout(fn, Duration.milliseconds.from(delay))
    }

    Now, consumers of this function can call it like this:

    import { Duration } from 'typed-duration'
    const { milliseconds, seconds, minutes, hours, days } = Duration
    
    // After 2.5 seconds
    executeLater(doSomething, milliseconds.of(2500))
    
    // After 10 seconds
    executeLater(doSomething, seconds.of(10))
    
    // After 15 minutes
    executeLater(doSomething, minutes.of(15))
    
    // After 3 hours
    executeLater(doSomething, hours.of(3))
    
    // After 6 days
    executeLater(doSomething, days.of(6))

    #winning

    Backward-compatible API

    If you have an existing API you want to add this to, you can use the MaybeTimeDuration type, like this:

    import { Duration, MaybeTimeDuration } from 'typed-duration'
    
    function executeLater(fn: () => void, period: MaybeTimeDuration) {
        setTimeout(fn, Duration.milliseconds.from(period))
    }
    
    // You can pass in a typed duration, and it will convert to a number of milliseconds
    executeLater(doSomething, Duration.seconds.from(20))
    
    // a number will be allowed by the MaybeTimeDuration type
    // and the milliseconds.from() call will simply pass it through
    executeLater(doSomething, 2500)

    Logging

    You can log times for user information in the format that the user specified them, including units, with Duration.value.of. You can supply an optional default unit to be used for untyped numbers (if you don’t, it will just print the number).

    For example:

    import { Duration, MaybeTimeDuration } from 'typed-duration'
    
    function executeLater(fn: () => void, delay: MaybeTimeDuration) {
        console.log(`Executing in ${Duration.value.of(delay, "ms")}...`)
        setTimeout(fn, Duration.milliseconds.from(delay))
    }
    
    executeLater(doSomething, Duration.seconds.from(20))
    // Executing in 20s...
    
    executeLater(doSomething, Duration.milliseconds.from(350))
    // Executing in 350ms...
    
    executeLater(doSomething, Duration.hours.from(3))
    // Executing in 3h...
    
    executeLater(doSomething, 2500)
    // Executing in 2500ms...

    Feature Requests, Bug Reports

    See the GitHub repo.

    Visit original content creator repository https://github.com/jwulf/typed-duration
  • Magma

    🚀 Bot Setup Instructions

    Welcome to the bot setup guide! Follow the steps below to install and configure the bot correctly. This guide is designed to be beginner-friendly, with clear explanations for each step.

    Termux guides if you run on mobile


    Table of Contents

    1. Prerequisites
    2. Installation Steps
    3. Configuration Files
    4. Running the Bot
    5. Contact and Support

    Prerequisites

    Before running the bot, make sure you have the following installed:

    • Node.js (Version: 22.11.0)
    • npm (Version: 10.9.0)

    Download Node.js and npm here: Download Link.

    -> Double click on run.bat for windows or run.sh for linux/mac if you want to run automatically, remember to fill all the necessary data.


    Installation Steps

    1. Download and Extract the Bot Files:

      • Extract the bot package into a folder on your computer.
    2. Install Dependencies:
      Open your terminal or command prompt, navigate to the folder where the bot files are located, and run:

      npm install --force user-agents axios colors https-proxy-agent socks-proxy-agent ethers web3 

      If you encounter an Execution Policy error on Windows, run:

      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

      Then, run the npm install command again.

    3. Prepare Configuration Files:

      • Ensure all configuration files are set up correctly before running the bot (see Configuration Files section).

    Configuration Files

    1. configs.json – 📜 Adjust Bot Settings

    This file controls the bot’s behavior. Below is an example configuration:

    {
      "rotateProxy": false,
      "skipInvalidProxy": false,
      "proxyRotationInterval": 2,
      "delayEachAccount": [1, 1],
      "timeToRestartAllAccounts": 300,
      "howManyAccountsRunInOneTime": 1,
    
      "howManyMONtoStake": 0.001,
      "howManyGMAGMAtoUnstake": 0.001
    }
    
    • Fields Explained:
      • timeZone: Time zone setting (e.g., “en-US”).
      • rotateProxy: Enable or disable proxy rotation.
      • skipInvalidProxy: Skip invalid proxies if true.
      • proxyRotationInterval: Time interval (in minutes) for rotating proxies.
      • delayEachAccount: Random delay range (in seconds) between accounts.
      • timeToRestartAllAccounts: Time (in seconds) to restart all accounts.
      • howManyAccountsRunInOneTime: Number of accounts to run simultaneously.
      • howManyMONtoStake: How many gMON do you want to stake.
      • howManyGMAGMAtoUnstake: How many gMON do you want to unstake.

    2. privateKeys.txt – 🗂️ User’s EVM wallet privatekey

    • Wallets generator: Link

    evm privatekey
    evm privatekey
    evm privatekey

    Note: Each row for each account

    3. proxies.txt – 🌐 Proxy List (Optional)

    If you are using proxies, add them here. Leave the file blank if you are not using proxies. Supported formats:

    http://host:port
    https://host:port
    socks4://host:port
    socks5://host:port
    http://user:password@host:port
    https://user:password@host:port
    socks4://user:password@host:port
    socks5://user:password@host:port

    Note: each row for each account


    Running the Bot

    1. Navigate to the folder containing the bot files:

      cd /path/to/magma
    2. Run the bot using the following command:

      node meomundep.js

    Contact and Support

    If you encounter any issues or have questions, feel free to reach out:

    Your support is greatly appreciated! 🐱


    Enjoy using the bot! 🚀

    Visit original content creator repository
    https://github.com/MeoMunDep/Magma

  • Magma

    🚀 Bot Setup Instructions

    Welcome to the bot setup guide! Follow the steps below to install and configure the bot correctly. This guide is designed to be beginner-friendly, with clear explanations for each step.

    Termux guides if you run on mobile


    Table of Contents

    1. Prerequisites
    2. Installation Steps
    3. Configuration Files
    4. Running the Bot
    5. Contact and Support

    Prerequisites

    Before running the bot, make sure you have the following installed:

    • Node.js (Version: 22.11.0)
    • npm (Version: 10.9.0)

    Download Node.js and npm here: Download Link.

    -> Double click on run.bat for windows or run.sh for linux/mac if you want to run automatically, remember to fill all the necessary data.


    Installation Steps

    1. Download and Extract the Bot Files:

      • Extract the bot package into a folder on your computer.
    2. Install Dependencies:
      Open your terminal or command prompt, navigate to the folder where the bot files are located, and run:

      npm install --force user-agents axios colors https-proxy-agent socks-proxy-agent ethers web3 

      If you encounter an Execution Policy error on Windows, run:

      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

      Then, run the npm install command again.

    3. Prepare Configuration Files:

      • Ensure all configuration files are set up correctly before running the bot (see Configuration Files section).

    Configuration Files

    1. configs.json – 📜 Adjust Bot Settings

    This file controls the bot’s behavior. Below is an example configuration:

    {
      "rotateProxy": false,
      "skipInvalidProxy": false,
      "proxyRotationInterval": 2,
      "delayEachAccount": [1, 1],
      "timeToRestartAllAccounts": 300,
      "howManyAccountsRunInOneTime": 1,
    
      "howManyMONtoStake": 0.001,
      "howManyGMAGMAtoUnstake": 0.001
    }
    
    • Fields Explained:
      • timeZone: Time zone setting (e.g., “en-US”).
      • rotateProxy: Enable or disable proxy rotation.
      • skipInvalidProxy: Skip invalid proxies if true.
      • proxyRotationInterval: Time interval (in minutes) for rotating proxies.
      • delayEachAccount: Random delay range (in seconds) between accounts.
      • timeToRestartAllAccounts: Time (in seconds) to restart all accounts.
      • howManyAccountsRunInOneTime: Number of accounts to run simultaneously.
      • howManyMONtoStake: How many gMON do you want to stake.
      • howManyGMAGMAtoUnstake: How many gMON do you want to unstake.

    2. privateKeys.txt – 🗂️ User’s EVM wallet privatekey

    • Wallets generator: Link

    evm privatekey
    evm privatekey
    evm privatekey

    Note: Each row for each account

    3. proxies.txt – 🌐 Proxy List (Optional)

    If you are using proxies, add them here. Leave the file blank if you are not using proxies. Supported formats:

    http://host:port
    https://host:port
    socks4://host:port
    socks5://host:port
    http://user:password@host:port
    https://user:password@host:port
    socks4://user:password@host:port
    socks5://user:password@host:port

    Note: each row for each account


    Running the Bot

    1. Navigate to the folder containing the bot files:

      cd /path/to/magma
    2. Run the bot using the following command:

      node meomundep.js

    Contact and Support

    If you encounter any issues or have questions, feel free to reach out:

    Your support is greatly appreciated! 🐱


    Enjoy using the bot! 🚀

    Visit original content creator repository
    https://github.com/MeoMunDep/Magma