Author: yxrkcegqe6ty

  • react-weather

    React-Weather

    React-Weather is a user-friendly weather application built using React, React-Router, Redux, and powered by LocationIQ and RESTCountries APIs. This documentation will guide you through the app’s features, technologies, setup, and usage.

    React-Weather

    Features

    • Weather Information: Get current weather details, temperature, humidity, wind speed, and conditions for a specified location.
    • Location Autocomplete: Utilize LocationIQ API for location autocomplete and efficient search functionality.
    • Country Information: Display country information using RESTCountries API based on the user’s location.
    • Responsive Design: Enjoy a seamless experience on both desktop and mobile devices.
    • State Management: Leverage Redux for state management, ensuring a smooth and synchronized user experience.

    App Screenshot

    App Screenshot


    Technologies Used

    • React: A JavaScript library for building user interfaces, offering reusable components and dynamic rendering.
    • React-Router: A routing library for React, enabling efficient navigation and URL handling.
    • Redux: A state management library, centralizing and synchronizing data across the app.
    • LocationIQ API: Access geolocation data, location details, and autocomplete suggestions.
    • RESTCountries API: Retrieve country information and details.
    • React-Bootstrap: Styling with CSS for a visually appealing and responsive design.

    App ScreenshotApp Screenshot

    App Screenshot

    App Screenshot


    Run Locally

    Clone the project

      git clone https://github.com/hsyntes/react-weather

    Go to the project directory

      cd react-weather

    Install dependencies

      npm install

    Start the server

      npm start

    Credits

    • Location data provided by LocationIQ API.
    • Country information provided by RESTCountries API.

    Thank you for using the React-Weather app! Feel free to explore the source code, contribute, and enhance your weather experience using this intuitive React application.

    🔗 Links

    linkedin

    Visit original content creator repository https://github.com/hsyntes/react-weather
  • infsec-exam-project

    Information Security Project 2021/2022

    An email server and client implemented with Tomcat to test hacking techniques and understand related defence methods.

    Made at the Free University of Bolzano

    Features

    • JWT for authentication and authorization (using SHA-256)
    • End-to-end encryption of emails using RSA (SHA-256, with 4096 bits long keys)
    • Optional digital signature using DSA (SHA-256, with 4096 bits long keys)
    • Password hashing and salting (56 characters long salt encoded in base64)
    • Full UTF-8 support
    • SQL injection prevention
    • Reflected XSS and stored XSS prevention
    • XSRF (aka. CSRF) prevention using the SameSite attribute of cookies
    • Configuration files for both client and server settings

    Architecture

    The source code of this project is not meant to be deployed as it is. Client and server code run on the same Tomcat instance, which would never be the case in a real-world scenario.

    For an actual deployment, the client and the server code would be split on two separate Tomcat instances, making the architecture look like the following.

    architecture

    While the browser is referred to as the client usually, notice that in this case the Tomcat instance running on the user’s machine is called the client. The browser is only used for the GUI, which is unfamiliar to modern conventions and might be confusing when first looking at the project.

    These rules are followed throughout the codebase to keep the client and the server apart:

    • The package client does not use the package server and vice versa.

    But why?

    The complexity and unconventionality of this architecture can justly create some doubts on its appropriateness. The reason for this architecture was to be able to run Java on the client, use it to generate RSA keys, send to the server only the public key. Since Java cannot run in the browser, the only way to achieve this, without switching to JavaScript, is to use a local web server as “the client”.

    Technically, another possibility would have been to write the client as a Java application that uses JavaFX for the GUI. Tomcat would then be used for the server only.

    Setup

    Install Java 11 or later.

    Download Tomcat 10.0.x as zip file and remember where you place the extracted directory.

    Install IntelliJ IDEA and open the project with IntelliJ IDEA. The community edition suffices.

    Install the plugin Smart Tomcat.

    Open IntelliJ IDEA’s settings and go to Tomcat Server. Click on the top-left plus sign to add specify where your local Tomcat files are.

    Set up the SQL server

    Run the container executing the following command from the project’s root directory:

    docker compose up -d

    To connect to the SQL Server in the container and have an interactive shell:

    docker exec -ti mssql bash -c '/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$SA_PASSWORD" -d dev'

    Note: This uses the environment variable SA_PASSWORD of the container, not the one of your shell.

    Enter the SQL statements specified in the file create.sql.

    Quit the interactive shell.

    Run the web server

    In the top right corner, click on the ‘Run Tomcat 1’ button to start the web server. A terminal should open showing Tomcat’s logs and the URL to visit.

    Useful SQL queries

    Listing all tables

    SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES;

    Author

    • Gioele De Vitti (17693)
    Visit original content creator repository https://github.com/devgioele/infsec-exam-project
  • uav_simulator

    TravisCI Docker
    Build Status tag:ros2-iron

    Python – Gazebo Simulation Environment for a UAV with Geometric Control

    This repository includes Python codes for the position control a UAV in a Gazebo simulation environment, using geometric controllers.

    Features

    • Developed using Python
    • Uses a geometric controller that works great with aggressive maneuvers
    • Uses Gazebo as the physics engine
    • Has a nice GUI for controlling the UAV
    • Estimator, controller, and trajectory generators are in their own ROS nodes. If you need to test your own estimator, controller, or a trajectory, you only need to modify the respective node.

    Landing

    Why Python?

    • Python makes developing/debugging easier and shorter (no compiling)
    • Can easily find open-source modules or libraries for different tasks

    Which controller is used for the UAV control?

    • A geometric controller with decoupled-yaw attitude control is used
    • The controller is published in:
      @InProceedings{Gamagedara2019b,
          title={Geometric controls of a quadrotor uav with decoupled yaw control},
          author={Gamagedara, Kanishke and Bisheban, Mahdis and Kaufman, Evan and Lee, Taeyoung},
          booktitle={2019 American Control Conference (ACC)},
          pages={3285--3290},
          year={2019},
          organization={IEEE}
      }
    • Implementation of the same controller in C++ and Matlab can be found at https://github.com/fdcl-gwu/uav_geometric_control

    Which estimator is used for the state estimation?

    • The estimator defined in the following paper is implemented here (except for the sensor bias estimation terms):
      @InProceedings{Gamagedara2019a,
          author    = {Kanishke Gamagedara and Taeyoung Lee and Murray R. Snyder},
          title     = {Real-time Kinematics {GPS} Based Telemetry System for Airborne Measurements of Ship Air Wake},
          booktitle = {{AIAA} Scitech 2019 Forum},
          year      = {2019},
          month     = {jan},
          publisher = {American Institute of Aeronautics and Astronautics},
          doi       = {10.2514/6.2019-2377}
      }
    • Matlab implementation of the above controller can be found at https://github.com/fdcl-gwu/dkf-comparison.
    • Note that the Matlab implementation has a delayed Kalman filter that has not been implemented here. Only the non-delayed parts inside DelayedKalmanFilter.m is utilized here.

    Setting-up

    Releases

    The current main branch has been tested to work on Ubuntu 22.04, running ROS2-Iron. Check releases for different OS/ROS versions.

    1. v1.0: Ubuntu 18.04 with ROS-Melodic
    2. v2.0: Ubuntu 20.04 with ROS-Noetic
    3. v3.0: Ubuntu 22.04 with ROS2-Iron

    ‼️ If you are trying to use an older release, please checkout that release, and use setup instructions there. Each release has different instructions.

    ‼️ If you are running this on a virtual machine, please make sure that Gazebo can run at real-time speed. It is known that this simulation exhibits unintended behavior if the “real-time factor” of the Gazebo simulation is not closer to 1.0 (See issue #3).

    Setting-up the repository

    1. Clone the repository.
      git clone https://github.com/fdcl-gwu/uav_simulator.git
    2. Update the submodules.
      cd uav_simulator
      git submodule update --init --recursive

    Dependencies

    You have to options here:

    1. Installing everything locally
    2. Running a docker container

    Installing everything locally is probably the most straight-forward way, but you have to instal dependencies manually, or may have to deal with package version changes. Docker solves this by streamlining all the dependencies, up-to the OS. For example, if you are on Ubuntu 22.04 and want to test the ROS-Melodic version, docker will be the only way.

    If you want to install everything locally, follow Local Install. If you want to run a docker container instead, skip to Docker Setup.

    Local Install

    1. ROS2: this repository has been developed using ROS2 Iron, on Ubuntu 22.04. If you are on a different version of Ubunto or ROS, please check the previous releases before installing dependencies. We recommend installing the ROS2 full version.

    2. Python modules: these libraries must be installed in the system

      1. NumPy
      2. Pandas
      3. Matplotlib
      python3 -m pip install numpy pandas matplotlib

    Now, skip to Setting-up the plugins and Gazebo.

    Docker Setup

    The instructions here assume you are on Ubuntu. This has not been tested on other OS versions.

    1. Install docker following official instructions.
    2. If you are not already there, cd uav_simulator
    3. Enable xhost (required for Gazebo and GUI): xhost +
    4. Build the docker image: docker build -t uav_simulator . (see following paragraph if you just want to pull the already built image instead)
    5. Run a container: bash docker_run.sh

    The last command will start a docker container, install all the dependencies, and mount the local directory there. The first time you run the build command will take a while as it installs all the libraries.

    You can skip the build command altogether by pulling the built docker from the Docker Hub with the following command. This is NOT required if you are building it locally using the build command.

    docker pull kanishgama/uav_simulator:ros2-iron
    bash docker_run.sh

    After that, you only need to run the bash docker_run.sh every time you need to run the simulation. Since this mounts the local repository inside the docker, you just need to change the code in your local repository, and it will be automatically update inside the docker.

    For running the code, simply follow Setting-up the plugins and Gazebo, and onwards.

    Setting-up the plugins and Gazebo

    You only need to do the followings once (unless you change the Gazebo plugins)

    1. Make the plugging.
      # From uav_simulator
      colcon build
    2. Source the relevant directories (NOTE: you need to do this on every new terminal).
      # From uav_simulator
      source install/local_setup.bash

    Running the simulation environment

    1. In the current terminal window, launch the Gazebo environment:

      # From uav_simulator
      ros2 launch uav_gazebo uav_gazebo.launch.py 
    2. Once the Gazebo is launched, run the UAV code from a different terminal (if you already don’t know, you may find tmux a life-saver):

      # From uav_simulator
      ros2 launch fdcl_uav fdcl_uav_launch.py

      Everytime you change the Python code, run the following commands

      # From uav_simulator
      colcon build --packages-select fdcl_uav
      ros2 launch fdcl_uav fdcl_uav_launch.py

      The code has been tested with Python3.10.12, which comes default with Ubuntu 22.04.

    Terminal

    Tips

    1. Every time you change the simulation environment, you have to kill the program, colcon build and re-run it.
    2. If you do not make any changes to the simulation environment, you only need to kill the Python program.

    Control Guide

    • Simply click on the buttons on the GUI to control the UAV.
    • You can easily switch between each trajectory mode simply clicking on the radio buttons.
    • Stay mode simply commands the UAV to stay at the current position.
    • When take-off, stay, and circle trajectories end, the UAV switches to the “manual” mode.
    • When the UAV is in manual, you can use following keys (these are not case sensitive):
      • WASD: to move in horizontal plane
      • P: increase altitude
      • L: decrease altitude
      • Q: yaw rotation in anti-clockwise direction
      • E: yaw rotation in clockwise direction
    • At any point of the flight, you can use following keys (these are not case sensitive):
      • M: kill motors
      • 0-5: set the flight mode without clicking on the GUI
    • Please not that the GUI must be in focus for any of the above keys to work.
    • If you want to change the above keyboard shortcuts, you can do so by editing on_key_press function in gui.py.

    Running Unit-Tests

    • Make sure you are in the main directory.
    • Run python -m unittest.
    • Unit tests have only been tested on Python 3.9.
    • Currently, unit test only covers the matrix_utils.py module.
    Visit original content creator repository https://github.com/fdcl-gwu/uav_simulator
  • uav_simulator

    TravisCI Docker
    Build Status tag:ros2-iron

    Python – Gazebo Simulation Environment for a UAV with Geometric Control

    This repository includes Python codes for the position control a UAV in a Gazebo simulation environment, using geometric controllers.

    Features

    • Developed using Python
    • Uses a geometric controller that works great with aggressive maneuvers
    • Uses Gazebo as the physics engine
    • Has a nice GUI for controlling the UAV
    • Estimator, controller, and trajectory generators are in their own ROS nodes. If you need to test your own estimator, controller, or a trajectory, you only need to modify the respective node.

    Landing

    Why Python?

    • Python makes developing/debugging easier and shorter (no compiling)
    • Can easily find open-source modules or libraries for different tasks

    Which controller is used for the UAV control?

    • A geometric controller with decoupled-yaw attitude control is used
    • The controller is published in:
      @InProceedings{Gamagedara2019b,
          title={Geometric controls of a quadrotor uav with decoupled yaw control},
          author={Gamagedara, Kanishke and Bisheban, Mahdis and Kaufman, Evan and Lee, Taeyoung},
          booktitle={2019 American Control Conference (ACC)},
          pages={3285--3290},
          year={2019},
          organization={IEEE}
      }
    • Implementation of the same controller in C++ and Matlab can be found at https://github.com/fdcl-gwu/uav_geometric_control

    Which estimator is used for the state estimation?

    • The estimator defined in the following paper is implemented here (except for the sensor bias estimation terms):
      @InProceedings{Gamagedara2019a,
          author    = {Kanishke Gamagedara and Taeyoung Lee and Murray R. Snyder},
          title     = {Real-time Kinematics {GPS} Based Telemetry System for Airborne Measurements of Ship Air Wake},
          booktitle = {{AIAA} Scitech 2019 Forum},
          year      = {2019},
          month     = {jan},
          publisher = {American Institute of Aeronautics and Astronautics},
          doi       = {10.2514/6.2019-2377}
      }
    • Matlab implementation of the above controller can be found at https://github.com/fdcl-gwu/dkf-comparison.
    • Note that the Matlab implementation has a delayed Kalman filter that has not been implemented here. Only the non-delayed parts inside DelayedKalmanFilter.m is utilized here.

    Setting-up

    Releases

    The current main branch has been tested to work on Ubuntu 22.04, running ROS2-Iron. Check releases for different OS/ROS versions.

    1. v1.0: Ubuntu 18.04 with ROS-Melodic
    2. v2.0: Ubuntu 20.04 with ROS-Noetic
    3. v3.0: Ubuntu 22.04 with ROS2-Iron

    ‼️ If you are trying to use an older release, please checkout that release, and use setup instructions there. Each release has different instructions.

    ‼️ If you are running this on a virtual machine, please make sure that Gazebo can run at real-time speed. It is known that this simulation exhibits unintended behavior if the “real-time factor” of the Gazebo simulation is not closer to 1.0 (See issue #3).

    Setting-up the repository

    1. Clone the repository.
      git clone https://github.com/fdcl-gwu/uav_simulator.git
    2. Update the submodules.
      cd uav_simulator
      git submodule update --init --recursive

    Dependencies

    You have to options here:

    1. Installing everything locally
    2. Running a docker container

    Installing everything locally is probably the most straight-forward way, but you have to instal dependencies manually, or may have to deal with package version changes. Docker solves this by streamlining all the dependencies, up-to the OS. For example, if you are on Ubuntu 22.04 and want to test the ROS-Melodic version, docker will be the only way.

    If you want to install everything locally, follow Local Install. If you want to run a docker container instead, skip to Docker Setup.

    Local Install

    1. ROS2: this repository has been developed using ROS2 Iron, on Ubuntu 22.04. If you are on a different version of Ubunto or ROS, please check the previous releases before installing dependencies. We recommend installing the ROS2 full version.

    2. Python modules: these libraries must be installed in the system

      1. NumPy
      2. Pandas
      3. Matplotlib
      python3 -m pip install numpy pandas matplotlib

    Now, skip to Setting-up the plugins and Gazebo.

    Docker Setup

    The instructions here assume you are on Ubuntu. This has not been tested on other OS versions.

    1. Install docker following official instructions.
    2. If you are not already there, cd uav_simulator
    3. Enable xhost (required for Gazebo and GUI): xhost +
    4. Build the docker image: docker build -t uav_simulator . (see following paragraph if you just want to pull the already built image instead)
    5. Run a container: bash docker_run.sh

    The last command will start a docker container, install all the dependencies, and mount the local directory there. The first time you run the build command will take a while as it installs all the libraries.

    You can skip the build command altogether by pulling the built docker from the Docker Hub with the following command. This is NOT required if you are building it locally using the build command.

    docker pull kanishgama/uav_simulator:ros2-iron
    bash docker_run.sh

    After that, you only need to run the bash docker_run.sh every time you need to run the simulation. Since this mounts the local repository inside the docker, you just need to change the code in your local repository, and it will be automatically update inside the docker.

    For running the code, simply follow Setting-up the plugins and Gazebo, and onwards.

    Setting-up the plugins and Gazebo

    You only need to do the followings once (unless you change the Gazebo plugins)

    1. Make the plugging.
      # From uav_simulator
      colcon build
    2. Source the relevant directories (NOTE: you need to do this on every new terminal).
      # From uav_simulator
      source install/local_setup.bash

    Running the simulation environment

    1. In the current terminal window, launch the Gazebo environment:

      # From uav_simulator
      ros2 launch uav_gazebo uav_gazebo.launch.py 
    2. Once the Gazebo is launched, run the UAV code from a different terminal (if you already don’t know, you may find tmux a life-saver):

      # From uav_simulator
      ros2 launch fdcl_uav fdcl_uav_launch.py

      Everytime you change the Python code, run the following commands

      # From uav_simulator
      colcon build --packages-select fdcl_uav
      ros2 launch fdcl_uav fdcl_uav_launch.py

      The code has been tested with Python3.10.12, which comes default with Ubuntu 22.04.

    Terminal

    Tips

    1. Every time you change the simulation environment, you have to kill the program, colcon build and re-run it.
    2. If you do not make any changes to the simulation environment, you only need to kill the Python program.

    Control Guide

    • Simply click on the buttons on the GUI to control the UAV.
    • You can easily switch between each trajectory mode simply clicking on the radio buttons.
    • Stay mode simply commands the UAV to stay at the current position.
    • When take-off, stay, and circle trajectories end, the UAV switches to the “manual” mode.
    • When the UAV is in manual, you can use following keys (these are not case sensitive):
      • WASD: to move in horizontal plane
      • P: increase altitude
      • L: decrease altitude
      • Q: yaw rotation in anti-clockwise direction
      • E: yaw rotation in clockwise direction
    • At any point of the flight, you can use following keys (these are not case sensitive):
      • M: kill motors
      • 0-5: set the flight mode without clicking on the GUI
    • Please not that the GUI must be in focus for any of the above keys to work.
    • If you want to change the above keyboard shortcuts, you can do so by editing on_key_press function in gui.py.

    Running Unit-Tests

    • Make sure you are in the main directory.
    • Run python -m unittest.
    • Unit tests have only been tested on Python 3.9.
    • Currently, unit test only covers the matrix_utils.py module.
    Visit original content creator repository https://github.com/fdcl-gwu/uav_simulator
  • Neural_Artistic_Style_Transfer

    Neural artistic style tranfer


    Based on: Leon A. Gatys, Alexander S. Ecker, Matthias Bethge, A Neural Algorithm of Artistic Style, arXiv:1508.06576
    See also: https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
    See some examples on: https://www.bonaccorso.eu/2016/11/13/neural-artistic-style-transfer-experiments-with-keras/

    Usage

    There are three possibile canvas setup:

    • Picture: The canvas is filled with the original picture
    • Style: The canvas is filled with the style image (resized to match picture dimensions)
    • Random from style: The canvas is filled with a random pattern generated starting from the style image

    Some usage examples (both with VGG16 and VGG19):
    Picture and style over random:
    canvas=’random_from_style’, alpha_style=1.0, alpha_picture=0.25, picture_layer=’block4_conv1′
    Style over picture:
    canvas=’picture’, alpha_style=0.0025, alpha_picture=1.0, picture_layer=’block4_conv1′
    Picture over style:
    canvas=’style’, alpha_style=0.001, alpha_picture=1.0, picture_layer=’block5_conv1′

    For a mix of style transfer and deepdream generation, see the examples below.

    Code snippets

    neural_styler = NeuralStyler(picture_image_filepath='img\\GB.jpg',
                                     style_image_filepath='img\\Magritte.jpg',
                                     destination_folder='\\destination_folder',
                                     alpha_picture=0.4,
                                     alpha_style=0.6,
                                     verbose=True)
    
    neural_styler.fit(canvas='picture', optimization_method='L-BFGS-B')
    
    neural_styler = NeuralStyler(picture_image_filepath='img\\GB.jpg',
                                     style_image_filepath='img\\Magritte.jpg',
                                     destination_folder='\\destination_folder',
                                     alpha_picture=0.25,
                                     alpha_style=1.0,
                                     picture_layer='block4_conv1',
                                     style_layers=('block1_conv1',
                                                   'block2_conv1',
                                                   'block3_conv1',
                                                   'block4_conv1',
                                                   'block5_conv1'))
                                                   
    neural_styler.fit(canvas='random_from_style', optimization_method='CG')
    

    Examples

    (With different settings and optimization algorithms)

    Cezanne

    Magritte

    Dalì

    Matisse

    Picasso

    Rembrandt

    De Chirico

    Mondrian

    Van Gogh

    Schiele

    Mixing style transfer and deep dreams

    I’m still working on some experiments based on loss function which tries to maximize the L2 norm of the last convolutional block (layers 1 and 2). I’ve excluded those from the style_layers tuple and tuned the parameters to render a “dream” together with a styled image. You can try the following snippet:

    # Dream loss function
    dream_loss_function = -5.0*K.sum(K.square(convnet.get_layer('block5_conv1').output)) + \
                          -2.5*K.sum(K.square(convnet.get_layer('block5_conv2').output))
    
    # Composite loss function
    composite_loss_function = (self.alpha_picture * picture_loss_function) + \
                              (self.alpha_style * style_loss_function) + \
                              dream_loss_function
    

    The composite loss function isnt’t “free” to maximize the norm like in Keras DeepDream, because the MSE with the gramian terms forces the filters to get similar to the style, however, it’s possible to obtain interesting results. The following pictures show the famous Tübingen styled with a Braque painting and forced to render “random” elements (they’re similar to animal heads and eyes) like in a dream:

    This example, instead, has been created using a VGG19 with a Cezanne painting and:

    style_layers=('block1_conv1',
                  'block2_conv1',
                  'block3_conv1',
                  'block4_conv1',
                  'block5_conv1',
                  'block5_conv2')
                  
    # Dream loss function
    dream_loss_function = -10.0*K.sum(K.square(convnet.get_layer('block5_conv1').output)) + \
                          -5.0*K.sum(K.square(convnet.get_layer('block5_conv2').output))
    

    (Original image by Manfred Brueckels – Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=6937538)

    Requirements

    • Python 2.7-3.5
    • Keras
    • Theano/Tensorflow
    • SciPy
    Visit original content creator repository https://github.com/giuseppebonaccorso/Neural_Artistic_Style_Transfer
  • veterans

    Veterans Only

    “Veterans Only” (or simply “veterans”) is a Plugin for SourceMod and written with SourcePawn to restrict access of players based on their playtime in a specific game

    Where to download

    To download the latest version of this program, take a look at the releases page.

    PHP Hosting

    It is possible to host the PHP part of the project on your website. To do so, proceed the following steps:

    1. Locate a public folder on a website capable of hosting PHP files and with “php_curl” extension enabled.
    2. Upload the “queryPlaytime.php” file from the “web” directory to that folder.
    3. (Optional, but highly recommended) Create a folder named “WebCache” and give PHP write access to it. (chmod 755 or 777 for Linux)
    4. Edit the plugin configuration file and change the “sm_veterans_url” cvar to the address of the newly uploaded PHP file.

    Donation

    Donations assist development and are greatly appreciated; also always remember that every coffee counts! 🙂

    –OR–

    You can always donate your time by contributing to the project or by introducing it to others.

    License

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

    Visit original content creator repository https://github.com/falahati/veterans
  • ocean.js

    banner

    ocean.js

    JavaScript library to privately & securely publish, exchange, and consume data.

    npm Build Status Maintainability Test Coverage code style: prettier js oceanprotocol

    With ocean.js, you can:

    • Publish data services: downloadable files or compute-to-data. Create an ERC721 data NFT for each service, and ERC20 datatoken for access (1.0 datatokens to access).
    • Sell datatokens for a fixed price. Sell data NFTs.
    • Transfer data NFTs & datatokens to another owner, and all other ERC721 & ERC20 actions using web3.js etc.

    ocean.js is part of the Ocean Protocol toolset.

    This is in alpha state. If you run into problems, please open up a new issue.

    📚 Prerequisites

    🏗 Installation & Usage

    npm install @oceanprotocol/lib
    {
      "moduleResolution": "node",
      "esModuleInterop": true,
      "allowSyntheticDefaultImports": true
    }
    
    • If using Next.js, they may need “moduleResolution”: “bundler” for better compatibility.

    🦑 Development

    The project is authored with TypeScript and compiled with tsc.

    To start compiler in watch mode:

    npm install
    npm start

    ✨ Code Style

    For linting and auto-formatting you can use from the root of the project:

    # lint all js with eslint
    npm run lint
    
    # auto format all js & css with prettier, taking all configs into account
    npm run format

    👩‍🔬 Testing

    Test suite for unit & integration tests is setup with Mocha as test runner, and nyc for coverage reporting. A combined coverage report is sent to CodeClimate via the coverage GitHub Actions job.

    Running all tests requires running Ocean Protocol components beforehand with Barge, which also runs a ganache-cli instance:

    git clone https://github.com/oceanprotocol/barge
    cd barge
    
    ./start_ocean.sh --with-provider2 --no-dashboard --with-c2d

    You can then proceed to run in another terminal.

    Let ocean.js know where to pickup the smart contract addresses, which has been written out by Barge in this location:

    export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
    

    Build metadata:

    npm run build:metadata
    

    Executing linting, type checking, unit, and integration tests with coverage reporting all in one go:

    npm test

    Unit Tests

    You can execute the unit tests individually with:

    npm run test:unit
    # same thing, but with coverage reporting
    npm run test:unit:cover

    Integration Tests

    You can execute the integration tests individually with:

    npm run test:integration
    # same thing, but with coverage reporting
    npm run test:integration:cover

    Sapphire Integration Tests

    We are currently using the live Oasis Sapphire Test network for the integration tests. Please export the PRIVATE_KEY and PRIVATE_KEY_CONSUMER before running the tests.

    export PRIVATE_KEY='0x<YOUR_PRIVATE_KEY>'
    export PRIVATE_KEY_CONSUMER='0x<YOUR_CONSUMER_PRIVATE_KEY>'

    Then, you can execute the tests individually with:

    npm run test:sapphire

    Note: On macOS, changes to the provider, metadataCache and subgraph URLs are required, as their default barge IPs can not be accessed due to network constraints on macOS. Instead use http://127.0.0.1 for each direct call to the mentioned services, but keep the internal provider URL (http://172.15.0.4:8030) hardcoded inside all DDO’s serviceEndpoint, and when calling nft.setMetadata().

    🛳 Production

    To create a production build, run from the root of the project:

    npm run build

    ⬆️ Releases

    Releases are managed semi-automatically. They are always manually triggered from a developer’s machine with release scripts.

    Production

    From a clean main branch you can run the release task bumping the version accordingly based on semantic versioning:

    npm run release

    The task does the following:

    • bumps the project version in package.json, package-lock.json
    • auto-generates and updates the CHANGELOG.md file from commit messages
    • creates a Git tag
    • commits and pushes everything
    • creates a GitHub release with commit messages as description
    • Git tag push will trigger a GitHub Action workflow to do a npm release

    For the GitHub releases steps a GitHub personal access token, exported as GITHUB_TOKEN is required. Setup

    Pre-Releases

    For pre-releases, this is required for the first one like v0.18.0-next.0:

    ./node_modules/.bin/release-it major|minor|patch --preRelease=next

    Further releases afterwards can be done with npm run release again and selecting the appropriate next version, in this case v0.18.0-next.1 and so on.

    🏛 License

    Copyright ((C)) 2023 Ocean Protocol Foundation
    
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    
       http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    
    Visit original content creator repository https://github.com/oceanprotocol/ocean.js
  • MaslOS-2

    MaslOS-2

    MaslOS but 2

    This is essentially MaslOS on the outside, but completely different on the inside. The main difference being a working scheduler and support for ELF execution!

    Of course it is 64bit and boots using BIOS. And it works on real hardware!

    Features

    • Basics
      • Scheduler
      • Elf loading
      • User Space
      • Inter Process Communication
      • Stdio using IPC
      • Multithreading (still experimental?)
    • GUI
      • MaslOS GUI Framework port
      • Mouse/Keyboard interaction
      • MaslOS Desktop / WM
      • Taskbar
      • Start Menu
    • Apps
      • Tic Tac Toe
      • Flappy Rocc
      • Terminal
      • Explorer
      • Image Viewer
      • Music Player (You can see a demo here)
      • MAAB interpreter
        • Pong
        • Maalbrot
      • Notepad
      • Paint (mostly working)
      • Doom
      • Minesweeper
        • Can be launched in 3 modes (easy, medium, hard)
        • Example: run minesweeper.elf medium
      • Connect Four
      • MicroEdit (has some issues)
      • 3D Cube Renderer (has some issues)
      • CalcRocc (has some issues)
      • Snake (soon)
      • Dialogs
        • Open File Dialog
        • Save File Dialog (soon)
        • Generic Information Dialog (soon)
        • Generic Text Input Dialog (soon)
        • Generic Information YES/NO Dialog (soon)
      • Other Apps ported from MaslOS and some extra ones (not yet)
    • Audio
      • Drivers
        • PC-Speaker
        • AC97
      • Audio System (exists, still a bit wip)
    • Other
      • SMP (not added yet)
      • idk more stuff

    How to use

    Start Menu

    You can click on the start menu button in the bottom left corner, to open the start menu.

    In the start menu, you can click on the programs and it will open them.

    Taskbar

    • You can left click on one of the tabs to select it.
    • You can middle click a tab to close it.

    Desktop / Windows

    • You can click on a window to select it.
    • You can drag the window around by holding its top bar.
    • You can also resize it, if allowed, by dragging the sides/corners.
    • You can also minimize the window by clicking the minimize button.
    • You cannot currently maximize the window.
    • To close a window, you can click on the X button.
    • You can quit the whole process of the window by holding SHIFT and pressing the close button.
    • You can also close the window by pressing ALT + F4.

    Mouse Capture

    A window can capture your mouse. This makes sense for games and such.

    You can escape the capture by pressing CONTROL and ESCAPE.

    All Shortcuts

    Here are all the shortcuts for quick reference: (including debug ones)

    • Press F10 to open the explorer
    • Press F12 to open a shell (there is a help command)
    • Press F11 to redraw the desktop (eg. If you get an error)
    • Press F5 to launch an empty elf
    • Press F6 to launch a mini window test
    • Press ALT + F4 to force close a program
    • Press CTRL + ESC to escape mouse capture

    How to build (Linux)

    • Install qemu-system if you haven’t.
    • Install make if you haven’t.
    • Install gcc if you haven’t.
    • Install g++ if you haven’t.
    • Install binutils if you haven’t.
    • Install nasm if you haven’t.
    • Install xorriso if you haven’t.

    Go into the MaslOS2 Folder and run the CRUN.sh file

    If you are trying this and getting weird compiler/linker errors, please let me know!

    gcc and ld like to break things in newer versions for some reason. 😀

    How to run (No need to build)

    How to run (Linux)

    Install QEMU if you haven’t.

    Download/clone the repo.

    Run the cDisk.sh file to generate an empty disk so QEMU can boot correctly.

    Run the JUST RUN OS.sh file to run it!

    You can also use the JUST RUN OS_KVM.sh file to run it faster if you are natively on linux.

    How to run (Windows)

    QEMU

    Install QEMU if you haven’t.

    Add QEMU To your PATH variable. If you need help, click here!

    Then download/clone the repo and run the run.cmd file

    Other

    You can also boot the ISO in other software like Virtualbox and it tends to run way faster there.

    Hardware

    You can flash the ISO to a usb drive using tools like Rufus and if you are lucky, your device should boot MaslOS2 fine.

    NOTE: As MaslOS2 uses PS/2 for mouse and keyboard input, it could happen that you cannot use it without actual PS/2 devices if your bios does not emulate them.

    Contributing

    I am still working on quite a few things that need to be done for MaslOS2 to be in a good state.

    Meaning that not everything is 100% implemented yet and some needed things could be missing.

    The Docs can be found here.

    If you want to contribute by adding your own little apps/tools/games/ports I would be very happy!

    If you need any help / have any questions or are curious about MaslOS2, feel free to contact me per discord. (@marceldarcel)

    Screenshots

    Showing off some apps MaslOS2 on display at my schools day of open doors Minesweeper The start menu Doom More apps ported Working more on the terminal Working on the terminal Taskbar yes WM almost on par with MaslOS More WM progress WM progress Beginning to work on WM A Bootscreen yes

    Thanks to:

    Visit original content creator repository https://github.com/marceldobehere/MaslOS-2
  • MaslOS-2

    MaslOS-2

    MaslOS but 2

    This is essentially MaslOS on the outside, but completely different on the inside. The main difference being a working scheduler and support for ELF execution!

    Of course it is 64bit and boots using BIOS. And it works on real hardware!

    Features

    • Basics
      • Scheduler
      • Elf loading
      • User Space
      • Inter Process Communication
      • Stdio using IPC
      • Multithreading (still experimental?)
    • GUI
      • MaslOS GUI Framework port
      • Mouse/Keyboard interaction
      • MaslOS Desktop / WM
      • Taskbar
      • Start Menu
    • Apps
      • Tic Tac Toe
      • Flappy Rocc
      • Terminal
      • Explorer
      • Image Viewer
      • Music Player (You can see a demo here)
      • MAAB interpreter
        • Pong
        • Maalbrot
      • Notepad
      • Paint (mostly working)
      • Doom
      • Minesweeper
        • Can be launched in 3 modes (easy, medium, hard)
        • Example: run minesweeper.elf medium
      • Connect Four
      • MicroEdit (has some issues)
      • 3D Cube Renderer (has some issues)
      • CalcRocc (has some issues)
      • Snake (soon)
      • Dialogs
        • Open File Dialog
        • Save File Dialog (soon)
        • Generic Information Dialog (soon)
        • Generic Text Input Dialog (soon)
        • Generic Information YES/NO Dialog (soon)
      • Other Apps ported from MaslOS and some extra ones (not yet)
    • Audio
      • Drivers
        • PC-Speaker
        • AC97
      • Audio System (exists, still a bit wip)
    • Other
      • SMP (not added yet)
      • idk more stuff

    How to use

    Start Menu

    You can click on the start menu button in the bottom left corner, to open the start menu.

    In the start menu, you can click on the programs and it will open them.

    Taskbar

    • You can left click on one of the tabs to select it.
    • You can middle click a tab to close it.

    Desktop / Windows

    • You can click on a window to select it.
    • You can drag the window around by holding its top bar.
    • You can also resize it, if allowed, by dragging the sides/corners.
    • You can also minimize the window by clicking the minimize button.
    • You cannot currently maximize the window.
    • To close a window, you can click on the X button.
    • You can quit the whole process of the window by holding SHIFT and pressing the close button.
    • You can also close the window by pressing ALT + F4.

    Mouse Capture

    A window can capture your mouse. This makes sense for games and such.

    You can escape the capture by pressing CONTROL and ESCAPE.

    All Shortcuts

    Here are all the shortcuts for quick reference: (including debug ones)

    • Press F10 to open the explorer
    • Press F12 to open a shell (there is a help command)
    • Press F11 to redraw the desktop (eg. If you get an error)
    • Press F5 to launch an empty elf
    • Press F6 to launch a mini window test
    • Press ALT + F4 to force close a program
    • Press CTRL + ESC to escape mouse capture

    How to build (Linux)

    • Install qemu-system if you haven’t.
    • Install make if you haven’t.
    • Install gcc if you haven’t.
    • Install g++ if you haven’t.
    • Install binutils if you haven’t.
    • Install nasm if you haven’t.
    • Install xorriso if you haven’t.

    Go into the MaslOS2 Folder and run the CRUN.sh file

    If you are trying this and getting weird compiler/linker errors, please let me know!

    gcc and ld like to break things in newer versions for some reason. 😀

    How to run (No need to build)

    How to run (Linux)

    Install QEMU if you haven’t.

    Download/clone the repo.

    Run the cDisk.sh file to generate an empty disk so QEMU can boot correctly.

    Run the JUST RUN OS.sh file to run it!

    You can also use the JUST RUN OS_KVM.sh file to run it faster if you are natively on linux.

    How to run (Windows)

    QEMU

    Install QEMU if you haven’t.

    Add QEMU To your PATH variable. If you need help, click here!

    Then download/clone the repo and run the run.cmd file

    Other

    You can also boot the ISO in other software like Virtualbox and it tends to run way faster there.

    Hardware

    You can flash the ISO to a usb drive using tools like Rufus and if you are lucky, your device should boot MaslOS2 fine.

    NOTE: As MaslOS2 uses PS/2 for mouse and keyboard input, it could happen that you cannot use it without actual PS/2 devices if your bios does not emulate them.

    Contributing

    I am still working on quite a few things that need to be done for MaslOS2 to be in a good state.

    Meaning that not everything is 100% implemented yet and some needed things could be missing.

    The Docs can be found here.

    If you want to contribute by adding your own little apps/tools/games/ports I would be very happy!

    If you need any help / have any questions or are curious about MaslOS2, feel free to contact me per discord. (@marceldarcel)

    Screenshots

    Showing off some apps MaslOS2 on display at my schools day of open doors Minesweeper The start menu Doom More apps ported Working more on the terminal Working on the terminal Taskbar yes WM almost on par with MaslOS More WM progress WM progress Beginning to work on WM A Bootscreen yes

    Thanks to:

    Visit original content creator repository https://github.com/marceldobehere/MaslOS-2
  • DEPRECATION NOTICE

    DEPRECATION NOTICE

    I’ll archive the repo by the end of August 2021.

    The main reason is Hugo pipes are built-in and pretty much cover what Hugulp does.

    I think the only part missing is image optimization, but I think you can build a pipe to do it.

    The other reason is it badly needs an update to gulp 4 and although it doesn’t seem like that hard a task, I don’t have the appetite to do it.

    hugulp 2

    v2 Breaking changes

    If you’re using hugulp v1, please take note of the following changes:

    • hugo is no longer invoked by hugulp

      use hugo as per its docs, then invoke hugulp build

    • put your assets in the static folder

      for example, static/styles, static/images, static/scripts

    • themes are supported out of the box

    Note: If you need sass/less/js pre-processing, read v2 docs below

    Description

    hugulp is a tool to optimize the assets of a Hugo website.

    The main idea is to recreate the famous Ruby on Rails Asset Pipeline, which minifies, concatenates and fingerprints the assets used in your website.

    This leads to less and smaller network requests to your page, improving overall user experience.

    Read this blog post and this article for additional context.

    Note: These articles refer to v1

    It’s internally driven by Gulp.

    This project Includes the following tools, tasks and workflows:

    Installation

    Node needs to be installed in your system.

    Then just

    $ npm install -g hugulp

    Or you can build and run using docker:

    # Default docker setup:
    $ ./scripts/create-docker-machine-and-run-it
    
    # -- OR --
    
    # Run with custom machine name, specific hugo version, specific node version and run docker in detached mode:
    $ ./scripts/create-docker-machine-and-run-it -a app-devel -g 0.20.6 -n 6.10.0 -d

    Note: You only run the ./scripts/create-docker-machine-and-run-it if you want to create a new docker machine. Once the docker machine is created, you have to use docker commands to manage it. Please be familiar with docker in this regard.

    Getting Started

    The most common usage scenario would be:

    $ hugo new site yoursite
    $ cd yoursite
    $ hugulp init
    # create content
    # add images (static/images), css (static/styles) and javascript (static/scripts)
    $ hugo server -D # for development
    # development is done, ready to publish
    $ rm -rf public # clean up public folder, it will be re-generated by hugo
    $ hugo # for release/production/deployment
    $ hugulp build # optimize the site by running the asset pipeline

    Another scenario would be to include sass/less pre-processing:

    $ hugo new site yoursite
    $ cd yoursite
    $ hugulp init
    # create content
    # add images (static/images), and javascript (static/scripts)
    # add sass/less (assets/styles)
    $ hugo server -D # for development
    $ hugulp watch # to convert sass/less (assets/styles) into css (static/styles)
    # development is done, ready to publish
    $ rm -rf public # clean up public folder, it will be re-generated by hugo
    $ hugo # for release/production/deployment
    $ hugulp build # optimize the site by running the asset pipeline

    In both cases, you could chain the last 3 commands:

    $ rm -rf public && hugo && hugulp build

    hugulp requires a configuration file (.hugulprc), which is created by the hugulp init command (you can create the file manually if you want).

    This is the default .hugulprc:

    {
      "version": 2,
      "pipeline": ["images", "styles", "scripts", "fingerprint", "html"],
      "path": {
        "styles": "styles",
        "images": "images",
        "scripts": "scripts"
      },
      "watch": {
        "source": "assets",
        "target": "static"
      },
      "build": {
        "source": "public",
        "target": "public"
      },
      "autoprefixer": {
        "browsers": ["last 2 versions"]
      },
      "cleancss": {
        "advanced": false
      },
      "htmlmin": {
        "collapseWhitespace": true
      },
      "gifsicle": { "interlaced": true },
      "jpegtran": { "progressive": true },
      "optipng": { "optimizationLevel": 5 },
      "svgo": {
        "plugins": [{ "removeViewBox": true }, { "cleanupIDs": false }]
      }
    }

    You can easily customize hugulp‘s behavior, by modifying this configuration file, as described below.

    Available Commands

    hugulp watch

    hugulp will assist you if you’re using sass/less (and javascript), which require pre-processing.

    It will watch for changes to styles or script files, process them and write them to hugo’s static folder, according to the following table

    In Folder Looks for Operation Written to
    assets/styles s[a|c]ss, less, css Convert sass/less to css static/styles
    assets/scripts js Lint javascript code (soon babelify) static/scripts

    Note: It searches the folders recursively

    The table above applies to hugulp run with a default .hugulprc.

    You can customize the folder names: resources instead of assets, js instead of scripts and so on.

    This is described in the .hugulprc section below.

    hugulp build

    It optimizes the site that hugo built, by running the asset pipeline as defined in .hugulprc (field pipeline).

    Additionally, files are not watched for changes

    hugulp version

    Display installed version.

    hugulp init

    Create a default .hugulprc.

    Configuration

    By editing the .hugulprc configuration file, you can customize almost anything about hugulp.

    Description of each field follows:

    pipeline

    Defines which tasks of the asset pipeline will be executed (hugulp build command)

    Type: array
    Default:

    "pipeline": ["images", "styles", "scripts", "fingerprint", "html"]

    Task Description
    images minify images with imagemin
    styles pre-process sass/less/css, then clean-css
    scripts jshint, then uglify
    fingerprint fingerprint with rev, then replace references with rev-replace
    html minify html with htmlmin

    Let’s say you don’t want to fingerprint the assets. Just set pipeline to

    "pipeline": ["images", "styles", "scripts", "html"]

    By removing the fingerprint task, it will not be executed.

    Note that tasks are executed sequentially.

    path

    Defines the name of the folders where your assets are located/will be transferred to.

    Type: object
    Default:

    "path": {
      "styles": "styles",
      "images": "images",
      "scripts": "scripts"
    }

    So if you prefer your styles folder to be called css, and scripts to be called js, you would change it to:

    "path": {
      "styles": "css",
      "images": "images",
      "scripts": "js"
    }

    watch

    Define which folders to watch for changes, for the hugulp watch command.

    Type: object
    Default:

    "watch": {
      "source": "assets",
      "target": "static"
    }

    This field works together with the path field.

    With a default .hugulprc, it will watch assets/styles and assets/scripts (recursively).

    If you customized path as per above, it will watch assets/css and assets/js.

    If you additionally want the assets folder to be called resources, change source to resources

    "watch": {
      "source": "resources",
      "target": "static"
    }

    then it will watch resources/css and resources/js

    Finally, the changes will be written to the well-known hugo static folder.

    With a default .hugulprc, files will be written to static/styles and static/scripts.

    build

    Defines the folders referenced during the hugulp build command

    Type: object
    Default:

    "build": {
      "source": "public",
      "target": "public"
    }

    This should generally be left unchanged.

    hugo will output to the public folder by default, so hugulp build will process the files in-place.

    autoprefixer

    Options for autoprefixer. Check gulp-autoprefixer for documentation.

    Task: styles

    Type: object
    Default:

    "autoprefixer": {
      "browsers": ["last 2 versions"]
    }

    cleancss

    Options for clean-css. Check gulp-clean-css for documentation.

    Task: styles

    Default:

    "cleancss": {
      "advanced": false
    }

    htmlmin

    Options for htmlmin. Check gulp-htmlmin for documentation.

    Task: html

    Default:

    "htmlmin": {
      "collapsedWhitespace": true
    }

    gifsicle

    Options for gifsicle. Check gulp-imagemin for documentation.

    Task: images

    Default:

    "gifsicle": {
      "interlaced": true
    }

    jpegtran

    Options for jpegtran. Check gulp-imagemin for documentation.

    Task: images

    Default:

    "jpegtran": {
      "progressive": true
    }

    optipng

    Options for optipng. Check gulp-imagemin for documentation.

    Task: images

    Default:

    "optipng": {
      "optimizationLevel": 5
    }

    svgo

    Options for svgo. Check gulp-imagemin for documentation.

    Task: images

    Default:

    "svgo": {
      "plugins": [{ "removeViewBox": true }, { "cleanupIDs": false }]
    }

    How to update

    Whenever a new hugulp version becomes available, you can update it by running

    $ npm install -g hugulp

    PR

    Pull Requests are welcome 👍.

    Share

    Made by Juan B. Rodriguez, with a MIT License.

    Please share the article or leave your comments.

    Visit original content creator repository
    https://github.com/jbrodriguez/hugulp