Blog

  • blender-lineart-node

    blender-lineart-node

    this repository is scripts for blender.
    blender 2.8が公開されましたが、現在 EEVEE レンダーにおける view layer のフィルタ出力が未実装のため
    このリポジトリのアップデートを見合わせています。実装され次第対応します

    blender の、主に漫画背景制作用途に作ったスクリプトです

    comicLineartNode.py / comicLineartNodeDivided.py / comicLineartNodeMass.py

    レイヤを使って前中後景に別々にレンダリングします。手前側、奥側と言ったふうに分離することでキャラが間に挟まる構図に使えると同時に、情報量が多いデータの場合でも、blender が落ちるリスクを軽減できると考えています

    comicLineartNode.py 分割をせずレンダリングします(主に小物類に使用)
    comicLineartNodeDivided.py 3枚の前中後に分割してレンダリング(中背景に使用)
    comicLineartNodeMass.py 15のレイヤに分割したものを1枚に結合して処理(情報量の多い背景に使用)
    comicLineartGroup.py 使用するノードグループ生成   comicLineartMulti.py ノード生成に関係なさそうな処理を分けました。出力先フォルダの指定はここでやっています

    addon になっています
    実行すると レンダリング設定用のノードを生成します
    出力先はデスクトップの rendering/1 フォルダに設定されます
    レンダラーを Blender Render に自動設定されます
      解説動画   https://www.youtube.com/watch?v=9hE5PdFVeTA&t=2s

    file name 出力される画像
    rendering_base001 Material Pass Index に準じた基本配色
    rendering_lineart001 線画のみ
    rendering_shadow001 陰影のみ
    rendering_render001 rendering画像

    作成の経緯

    単純に一枚の画像にレンダリング出力されると、clip studio paint で作業する際に不便を感じることが多かったため、後処理の利便の向上のために作成しました
    ex.

    • この線だけ太くしたい
    • 基本配色部分だけ薄くしたいor濃くしたい
    • 陰影を(物理法則通りではないけど、見た目上よくするために)調整したい

    陰影の調整

    node editor の colorRamp node で調整します
    corlor ramp corlor ramp
    backdrop を on にしておくと楽です

    現状、ランプは点光源一つを前提としています
    複雑な光源の配置や、cycles render でも利用は可能です

    layer による前景・中景・後景に分解 (comicLineartNodeDivided.py)

    1-5番目のレイヤに属するオブジェクトを中景、6-10番目のレイヤに属するオブジェクトを背景、11-15番目のレイヤに属するオブジェクトを手前側の前景としてレンダリング出力し、最終的に合成したものを出力します。16-20番目のレイヤに属するオブジェクトはすべてのレンダリング画像に作用します(ランプなどを配置) lineart それぞれに分割レンダリングすることにより、いっぺんにやるよりも負荷を抑えます
    また、前景・後景の間にキャラクターの絵が入る場合、マンガ制作ソフト側で扱いやすくなります

    15分割 (comicLineartNodeMass.py)

    1-15番レイヤに属するオブジェクトをそれぞれレンダリングし、ノードで結合して出力します   街の景観など、情報量の多くメモリ等の問題からレンダリングが困難な場合に使用します
    景観   景観
    景観

    material pass index の関係

    material pass index は properties -> material -> options -> pass index で設定します
    マンガ原稿側で、10% トーンを割り振るマテリアルに pass index を 1に、 20% を割り振るマテリアルに pass indx を 2に、という具合に割り振ります。(現状、1:10%, 2:20%, 3:30%, 4:40% に対応付けしてあります)

    line style の設定

    現状は前景線画を5.5 / 中景 2.2 / 後景 1.1 として freestyle_front|freestyle_middle|freestyle_back という名前のline style を生成して割り振っています.linestyle modifier の along strokeに使用する curve object を apiからは作ることができないようだったので、スクリプトからの生成は見送りにしています.実用上、line style はimport /append やf初期設定ファイルから使用したほうがよいと考えているのでここは当面踏み込まないでおく方針です

    comicLineartNodeAO.py

    comicLineartNode.pyの前のバージョン
    comicLineartAO.py AO出力用ノードを生成します(すでに同スクリプトにて生成済みの場合、再生成します)node を生成後に、新たにsceneにオブジェを追加した場合、再生成しないとao 出力画像に反映されません
    使いにくかったので凍結

    その他のファイル

    makeLineart.py 線画変換用の初期バージョン
    comicResources.py 漫画背景用データ出力の別バージョン(不使用)
    saveName.py ちょっとした文字列データをテキストブロックに保存するため。そのうち改良したい
    whiteMaterialize.py 元々あるマテリアルとランプを全て削除し、まっさらのマテリアルを割り振りします
    proxify.py link して取り込んだデータを proxy に変換し、group にまとめます   softenMirrorMergeLimit.py ミラー モディファイアのマージリミットを一括して設定します。
    softenArrayMergeLimit.py アレイ モディファイアのマージリミットを一括して設定します。

    Visit original content creator repository https://github.com/kuromook/blender-lineart-node
  • rust-chip8

    Multi-platform XO-CHIP Emulator

    Build action Build action

    An XO-CHIP emulator written in Rust using Macroquad for rendering, meant to be compiled to WASM. Includes support for CHIP-8 predecessors as well

    Currently supported extensions:

    Live Demo

    Play with the live demo here: https://dustinbowers.com/rust-chip8

    Screenshots

    What is CHIP-8?

    Chip-8 is a simple, interpreted, programming language which was first used on some do-it-yourself computer systems in the late 1970s and early 1980s. The COSMAC VIP, DREAM 6800, and ETI 660 computers are a few examples. These computers typically were designed to use a television as a display, had between 1 and 4K of RAM, and used a 16-key hexadecimal keypad for input. The interpreter took up only 512 bytes of memory, and programs, which were entered into the computer in hexadecimal, were even smaller.

    (source)

    Build

    The Makefile includes various targets:

    Target Description
    make build Build debug binary
    make release Build release binary
    make wasm Build debug WASM
    make wasm-release Build release WASM
    make web-server Run basic-http-server from the ./dist directory at http://localhost:4000
    make build-test-web Build debug WASM and run webserver from ./dist
    make build-test-web-release Build release WASM and run webserver from ./dist

    Usage

    Binary:

    Usage: chip8 <Filename> <CHIP Mode> <Ticks-per-frame>
    
    <Filename> - path to ROM File
    <CHIP Mode>
            1 - CHIP-8
            2 - SuperChip Modern
            3 - SuperChip Legacy
            4 - XO-Chip
    <Ticks-per-frame> - Number of instructions emulated per frame
    

    Locally hosted WASM:

    make build-test-web-release
    

    and browse to http://localhost:4000

    Note

    All ROMs in this repo were gathered together from various places around the internet, and credit for each goes to their respective authors

    Useful links

    Visit original content creator repository https://github.com/dustinbowers/rust-chip8
  • nacos

    Nacos: Dynamic Naming and Configuration Service

    Gitter License Gitter Ask DeepWiki


    What does it do

    Nacos (official site: nacos.io) is an easy-to-use platform designed for dynamic service discovery and configuration and service management. It helps you to build cloud native applications and microservices platform easily.

    Service is a first-class citizen in Nacos. Nacos supports almost all type of services,for example,Dubbo/gRPC service, Spring Cloud RESTFul service or Kubernetes service.

    Nacos provides four major functions.

    • Service Discovery and Service Health Check

      Nacos makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Nacos also provides real-time health checks of services to prevent sending requests to unhealthy hosts or service instances.

    • Dynamic Configuration Management

      Dynamic Configuration Service allows you to manage configurations of all services in a centralized and dynamic manner across all environments. Nacos eliminates the need to redeploy applications and services when configurations are updated, which makes configuration changes more efficient and agile.

    • Dynamic DNS Service

      Nacos supports weighted routing, making it easier for you to implement mid-tier load balancing, flexible routing policies, flow control, and simple DNS resolution services in the production environment within your data center. It helps you to implement DNS-based service discovery easily and prevent applications from coupling to vendor-specific service discovery APIs.

    • Service and MetaData Management

      Nacos provides an easy-to-use service dashboard to help you manage your services metadata, configuration, kubernetes DNS, service health and metrics statistics.

    Quick Start

    It is super easy to get started with your first project.

    Deploying Nacos on cloud

    You can deploy Nacos on cloud, which is the easiest and most convenient way to start Nacos.

    Use the following Nacos deployment guide to see more information and deploy a stable and out-of-the-box Nacos server.

    Start by the provided startup package

    Step 1: Download the binary package

    You can download the package from the latest stable release.

    Take release nacos-server-1.0.0.zip for example:

    unzip nacos-server-1.0.0.zip
    cd nacos/bin 

    Step 2: Start Server

    On the Linux/Unix/Mac platform, run the following command to start server with standalone mode:

    sh startup.sh -m standalone

    On the Windows platform, run the following command to start server with standalone mode. Alternatively, you can also double-click the startup.cmd to run NacosServer.

    startup.cmd -m standalone
    

    For more details, see quick-start.

    Quick start for other open-source projects:

    Documentation

    You can view the full documentation from the Nacos website.

    You can also read this online eBook from the NACOS ARCHITECTURE & PRINCIPLES.

    All the latest and long-term notice can also be found here from GitHub notice issue.

    Contributing

    Contributors are welcomed to join Nacos project. Please check CONTRIBUTING about how to contribute to this project.

    How can I contribute?

    • Take a look at issues with tags marked good first issue or contribution welcome.
    • Answer questions on issues.
    • Fix bugs reported on issues, and send us a pull request.
    • Review the existing pull request.
    • Improve the website, typically we need
      • blog post
      • translation on documentation
      • use cases around the integration of Nacos in enterprise systems.

    Other Related Project Repositories

    • nacos-spring-project provides the integration functionality for Spring.
    • nacos-group is the repository that hosts the eco tools for Nacos, such as SDK, synchronization tool, etc.
    • spring-cloud-alibaba provides the one-stop solution for application development over Alibaba middleware which includes Nacos.

    Contact

    • Gitter: Nacos’s IM tool for community messaging, collaboration and discovery.
    • Twitter: Follow along for latest nacos news on Twitter.
    • Weibo: Follow along for latest nacos news on Weibo (Twitter of China version).
    • Nacos Segmentfault: Get latest notice and prompt help from Segmentfault.
    • Email Group:
    • Join us from DingDing(Group 1: 21708933(full), Group 2: 30438813(full), Group 3: 31222241(full), Group 4: 12810027056).

    DingDing Group QR Code

    DingDing MCP Group QR Code

    WeChat Group QR Code

    Enterprise Service

    If you need Nacos enterprise service support, or purchase cloud product services, you can join the discussion by scanning the following DingTalk group. It can also be directly activated and used through the microservice engine (MSE) provided by Alibaba Cloud. https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0

    Download

    Who is using

    These are only part of the companies using Nacos, for reference only. If you are using Nacos, please add your company here to tell us your scenario to make Nacos better.

    Alibaba Group 虎牙直播 ICBC 爱奇艺
    平安科技 华夏信财 优客工场 贝壳找房
    瑞安农村商业银行 司法大数据 搜易贷 平行云
    甘肃紫光 海云天 Acmedcare+ 北京天合互联信息有限公司
    上海密尔克卫化工 大连新唯 立思辰 东家
    上海克垚 联采科技 南京28研究所 凤凰网-汽车
    中化信息 一点车 明传无线 妙优车
    蜂巢 华存数据 数云 广通软件
    菜菜 科蓝公司 浩鲸 未名天日语
    金联创 同窗链 顺能 百世快递
    汽车之家 鲸打卡 时代光华 康美
    环球易购 Nepxion chigua 宅无限
    天阙 联合永道 明源云 DaoCloud
    美菜 松格科技 集萃智能 吾享
    拓深科技 长亮科技 深圳易停车库 武汉日创科技
    易管智能 云帐房 三诺生物
    郑州山水 知氏教育
    Visit original content creator repository https://github.com/alibaba/nacos
  • domain-manager

    About Domain Manager

    This domain manager is a solution for people who manage multiple domains in a linux environment. After installation, this system will help to automate some of your tasks as follows:

    • Suppose you just built your project and deployed it. Your project is now ready for launch, but it is currently running on 192.168.123.456:8000 but you want it accessible through example.com. Lucky for you, you have this domain manager up and running.

    • You log into the system and create a domain called example.com and its proxy you set as 192.168.123.456:8000. Having done that, you open a new tab and go to example.com, and voila! Your project is ready for launch!

    • When you create a domain in the system, a reverse proxy and a service file will be created automatically for the domain. Therefore, if your project is running on 192.168.123.456:8000 and you have created its domain as example.com, you will now be able to access the it through example.com

    How To Install

    This project was built using Laravel 10. Therefore, you need to have composer in your environment. If you do not have composer installed read here for more information about composer.

    You may clone this project on github directly or using composer
    composer create-project jessyledama/domain-manager

    Once the installation process is complete, you may cd into your project
    cd domain-manager

    Migrate your database
    php artisan migrate

    Seed test data
    php artisan db:seed

    Start the project
    php artisan serve

    Once the system runs, it will be available on localhost:8000 or as displayed in the terminal.

    Setting Up Domains

    Once your server is running, you can access it on the browser then follow the following steps:

    • Log in
    • Create a path for your proxy file (default is /etc/apache2/sites-available/domain.conf)
    • Create a path for your service file (default is /etc/systemd/system/domain.service)
    • Create a domain.
    • The system creates a sites-available file (/etc/apache2/sites-available/domain.conf) aka reverse proxy.
    • The system creates a service (/etc/systemd/system/domain.service).

    Once these steps have been completed, your project is now accessible on domain.com and www.domain.com

    Why Domain Manager

    This domain manager keeps a list of your domains in the database. As such, should any file be deleted, the system will automatically recreate the files.
    This ensures that all your domains run smoothly.

    From The Author

    This domain manager was developed and is maintained by Jessy Ledama as a free open source solution. You are free to use it as you please.

    Security Vulnerabilities

    If you discover a security vulnerability within this package, please send an e-mail to Jessy Ledama via sirjayliste@gmail.com. All security vulnerabilities will be promptly addressed.

    License

    This Domain Manager is open-sourced software licensed under the MIT license.

    Visit original content creator repository
    https://github.com/JessyLedama/domain-manager

  • assert-is-null

    About stdlib…

    We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we’ve built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

    The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

    When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

    To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

    isNull

    NPM version Build Status Coverage Status

    Test if a value is null.

    Installation

    npm install @stdlib/assert-is-null

    Alternatively,

    • To load the package in a website via a script tag without installation and bundlers, use the ES Module available on the esm branch (see README).
    • If you are using Deno, visit the deno branch (see README for usage intructions).
    • For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the umd branch (see README).

    The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.

    To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.

    Usage

    var isNull = require( '@stdlib/assert-is-null' );

    isNull( value )

    Tests if a value is null.

    var bool = isNull( null );
    // returns true

    Examples

    var isNull = require( '@stdlib/assert-is-null' );
    
    var bool = isNull( null );
    // returns true
    
    bool = isNull( 'beep' );
    // returns false
    
    bool = isNull( 5 );
    // returns false
    
    bool = isNull( void 0 );
    // returns false
    
    bool = isNull( true );
    // returns false
    
    bool = isNull( {} );
    // returns false
    
    bool = isNull( [] );
    // returns false
    
    bool = isNull( function foo() {} );
    // returns false

    See Also


    Notice

    This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

    For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

    Community

    Chat


    License

    See LICENSE.

    Copyright

    Copyright © 2016-2025. The Stdlib Authors.

    Visit original content creator repository https://github.com/stdlib-js/assert-is-null
  • ameba-arduino-d

    Ameba Arduino SDK (ambd_arduino)

    1. About dev & master branch

    Branch Usage json links
    master stable release https://github.com/Ameba-AIoT/ameba-arduino-d/raw/master/Arduino_package/package_realtek_amebad_index.json
    dev merge Pull Request & early release https://github.com/Ameba-AIoT/ameba-arduino-d/raw/dev/Arduino_package/package_realtek_amebad_early_index.json

    For all release information, please visit this link.

    2. How to add Realtek Ameba Arduino package to Arduino IDE:

    You can refer to this link to get started: http://www.amebaiot.com/ameba-arduino-getting-started/
    , or follow the steps below.

    1. Add Ameba Arduino SDK link to Arduino IDE Additional Boards Manager

      Arduino IDE 1.6.5 and above versions support third party hardware so please make sure to use the latest Arduino IDE for better experience.

      Therefore, you need to add Ameba Arduino SDK link in

      “File” -> “Preferences” -> “Additional Boards Manager URLs:”

      Copy and paste the following link into the field and click “OK”,

      https://github.com/Ameba-AIoT/ameba-arduino-d/raw/master/Arduino_package/package_realtek_amebad_index.json

      We also suggest to enable “Show verbose output” options on “compilation” and “upload” in Preference for easier debugging.

    2. Install Ameba board in “Board Manager”

      Open “Tools” -> “Board” -> “Board Manager”, wait for it to update additional hardware configurations, then type “ameba” in the search bar, you will see Realtek Ameba in the list.

      Press “Install” to start the installation.

    3. Select your Ameba model in “Tools” -> “Board” -> “AmebaD ARM (32-bits) Boards”

      Make sure you select the correct model for your board, otherwise your program might not work properly

      Now you are ready to develop and upload firmware onto Ameba.

      For more information, please refer to https://www.amebaiot.com/en/ameba-arduino-summary/

    3. Contributing to Ameba

    Please spend 5 mins to read the Coding Style and Contribution Guideline at here before you contribute.

    Visit original content creator repository
    https://github.com/Ameba-AIoT/ameba-arduino-d

  • raspberry-metrics

    Raspberry metrics

    Expose raspberry PI metrics using Grafana and Prometheus:

    Example

    About

    Visualise your Raspberry PI metrics. Very easy installation – requires single command. Supports multiple Raspberries.

    This project contains Ansible playbook which installs four services on Raspberry:

    Scheme

    Prerequisites

    • Raspberry PI with ARMv7 processor (Tested on Raspberry PI 2 Model B)
    • Debian installed on Raspberry (like Raspbian Buster)
    • open port 22 on raspberry (SSH)
    • open port 3000 on raspberry (Grafana)

    How to install

    Ansible is required for installation.

    If you don’t have Ansible installed, see Ansible installation.

    1. Configure Raspberry IP address

    Checkout project.

    Edit file ansible/hosts and set Raspberry IP address in main-raspberry group.

    If you have more than one Raspberry PI, configure additional Raspberry PI addresses in additional-raspberries group.

    Here is the example:

    IP_config

    The “main” Raspberry will have all 4 services installed (Prometheus, Node exporter, rpi_exporter and Grafana), and the “additional Raspberries” will have Node exporter and rpi_exporter service installed.

    The main Raspberry will collect metrics from all additional Raspberries (if configured), so they must be accessible from the main Raspberry.

    2. Run ansible playbook

    Run Ansible playbook with password authentication:

        cd ansible/
        ansible-playbook raspberry.yml -i hosts -u pi -D -k -K
    

    Or run Ansible playbook with SSH keys authentication:

        cd ansible/
        ansible-playbook raspberry.yml -i hosts -u pi -D
    

    3. Check metrics

    Dashboard

    • If you have more than one Raspberry configured, you can select another Raspberry using instance dropdown:

    Instance

    Visit original content creator repository https://github.com/bhemar/raspberry-metrics
  • QQ

    QQ

    composer require socialiteproviders/qq

    Installation & Basic Usage

    Please see the Base Installation Guide, then follow the provider specific instructions below.

    Add configuration to config/services.php

    'qq' => [    
      'client_id' => env('QQ_CLIENT_ID'),  
      'client_secret' => env('QQ_CLIENT_SECRET'),  
      'redirect' => env('QQ_REDIRECT_URI') 
    ],

    Add provider event listener

    Laravel 11+

    In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your AppServiceProvider boot method.

    • Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.

    Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
        $event->extendSocialite('qq', \SocialiteProviders\QQ\Provider::class);
    });
    Laravel 10 or below

    Configure the package’s listener to listen for `SocialiteWasCalled` events.

    Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for detailed instructions.

    protected $listen = [
        \SocialiteProviders\Manager\SocialiteWasCalled::class => [
            // ... other providers
            \SocialiteProviders\QQ\QQExtendSocialite::class.'@handle',
        ],
    ];

    Usage

    You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

    return Socialite::driver('qq')->redirect();

    Returned User fields

    • id
    • unionid
    • nickname
    • avatar

    Visit original content creator repository
    https://github.com/SocialiteProviders/QQ

  • SPARSE_PLS

    Sparse Partial Least Squares (Sparse PLS) Regression


    Introduction

    The Sparse Partial Least Squares (Sparse PLS) project implements a regression model that combines dimensionality reduction with variable selection. This model is particularly useful for high-dimensional datasets where interpretability and feature selection are important. By incorporating sparsity into the Partial Least Squares (PLS) regression framework, the model selects the most relevant features while capturing the underlying relationship between predictors and responses.


    Features

    • Dimensionality Reduction: Reduces the dataset to a lower-dimensional latent space.
    • Variable Selection: Introduces sparsity to select the most relevant features.
    • Customizable Scaling: Supports data preprocessing with different scaling methods.
    • Hyperparameter Optimization: Includes methods for cross-validation and hyperparameter tuning.
    • Scikit-learn Compatibility: Designed to integrate seamlessly with scikit-learn’s ecosystem.

    Table of Contents


    Installation

    To install the required packages, you can use the following command:

    pip install -r requirements.txt

    Alternatively, you can install the packages individually:

    pip install numpy pandas scikit-learn scipy joblib

    Dependencies

    • Python 3.12.4
    • numpy==1.26.4
    • pandas==2.2.2
    • scikit-learn==1.5.1
    • scipy==1.13.1
    • joblib==1.4.2

    Ensure that all dependencies are installed before running the project. The requirements.txt file contains all the necessary packages and their versions.


    Usage

    Example Workflow

    import pandas as pd
    from model import SparsePLS
    from preprocessing import DataPreprocessor
    from sklearn.model_selection import train_test_split
    
    # Load your dataset
    data = pd.read_csv('your_dataset.csv')
    X = data.drop('target_column', axis=1)
    y = data['target_column']
    
    # Split into training and testing sets
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, test_size=0.2, random_state=42
    )
    
    # Initialize the model
    model = SparsePLS(n_components=2, alpha=0.5)
    
    # Fit the model
    model.fit(X_train, y_train)
    
    # Transform the data
    X_scores = model.transform(X_test)
    
    # Predict target values
    y_pred = model.predict(X_test)
    
    # Optimize hyperparameters
    param_grid = {
        'n_components': [1, 2, 3],
        'alpha': [0.1, 0.5, 1.0]
    }
    model.optimize_parameters(
        X_train, y_train,
        param_grid=param_grid,
        cv=5,
        scoring='neg_mean_squared_error',
        n_jobs=-1,
        verbose=1
    )
    
    # Access selected variables
    selected_features = model.feature_names_in_[model.selected_variables_]
    print("Selected Features:")
    print(selected_features)

    Classes and Methods

    SparsePLS Class

    Overview

    The SparsePLS class implements the Sparse Partial Least Squares regression model. It performs both dimensionality reduction and variable selection by introducing sparsity into the PLS framework.

    Initialization Parameters

    • n_components (int, default=2): Number of components to extract.
    • alpha (float, default=1.0): Regularization parameter controlling sparsity.
    • max_iter (int, default=500): Maximum number of iterations.
    • tol (float, default=1e-6): Tolerance for convergence.
    • scale (bool, default=True): Whether to scale the data.
    • scale_method (str, default=’standard’): Scaling method to use.
    • **kwargs: Additional keyword arguments for the scaler.

    Key Methods

    • fit(X, Y): Fits the model to the data.
    • transform(X): Transforms new data using the learned components.
    • fit_transform(X, Y): Fits the model and transforms the data.
    • predict(X): Predicts target values for new data.
    • optimize_parameters(X, Y, param_grid, cv, scoring, n_jobs, verbose, return_models): Optimizes hyperparameters using cross-validation.

    Attributes

    • x_weights_: Weights for predictors.
    • y_weights_: Weights for responses.
    • x_loadings_: Loadings for predictors.
    • y_loadings_: Loadings for responses.
    • x_scores_: Scores for predictors.
    • y_scores_: Scores for responses.
    • coef_: Regression coefficients.
    • selected_variables_: Indices of selected variables.
    • feature_names_in_: Feature names seen during fitting.
    • cv_results_: Cross-validation results.

    DataPreprocessor Class

    Overview

    The DataPreprocessor class handles data scaling and preprocessing. It supports different scaling methods and ensures that the data is appropriately transformed before modeling.

    Initialization Parameters

    • method (str, default=’standard’): Scaling method to use.
    • **kwargs: Additional arguments specific to the scaling method.

    Key Methods

    • fit(X): Fits the scaler to the data.
    • transform(X): Transforms the data using the fitted scaler.
    • fit_transform(X): Fits the scaler and transforms the data.
    • inverse_transform(X_scaled): Reverts the data to its original scale.

    Mathematical Background

    Partial Least Squares (PLS)

    PLS regression seeks to find latent components that capture the maximum covariance between predictors (X) and responses (Y). It projects both X and Y into a lower-dimensional space.

    Introducing Sparsity

    Sparse PLS incorporates sparsity by applying an $\ell_1$-norm penalty on the weight vectors, encouraging many coefficients to be zero. This results in variable selection and enhances interpretability.

    Optimization Problem

    The optimization problem in Sparse PLS can be formulated as:

    $$
    \max_{\mathbf{w}, \mathbf{c}} \ \mathbf{w}^\top \mathbf{X}^\top \mathbf{Y} \mathbf{c} – \alpha (|\mathbf{w}|_1 + |\mathbf{c}|_1)
    $$

    Subject to:

    $$
    |\mathbf{w}|_2 = 1, \quad |\mathbf{c}|_2 = 1
    $$

    Where:

    • $\mathbf{w}$ and $\mathbf{c}$ are weight vectors.
    • $\alpha$ controls the level of sparsity.
    • $|\cdot|_1$ is the $\ell_1$-norm.
    • $|\cdot|_2$ is the $\ell_2$-norm.

    Contributing

    We welcome contributions to improve the Sparse PLS project. If you’d like to contribute, please follow these steps:

    1. Fork the Repository: Create a fork of this repository to your GitHub account.
    2. Clone the Fork: Clone your forked repository to your local machine.
    3. Create a Feature Branch: Create a new branch for your feature or bug fix.
    4. Make Changes: Implement your changes and ensure that the code is well-documented.
    5. Test Your Changes: Run existing tests and add new ones if necessary.
    6. Commit and Push: Commit your changes and push them to your fork.
    7. Submit a Pull Request: Open a pull request to the main repository with a clear description of your changes.

    License

    This project is licensed under the MIT License. You are free to use, modify, and distribute this software in accordance with the license terms.


    Contact Information

    If you have any questions, suggestions, or issues, please feel free to open an issue on the GitHub repository or contact the project maintainers.


    Author and Acknowledgments

    Author and Owner of this repository : Younes AJEDDIG, Ph.D in Process & Chemical Engineering

    Thanks to ChatGPT o1-preview, it’s nice to have someone that do things you do not like to do even if you need it.


    Additional Resources


    Note: Ensure that the preprocessing.py file containing the DataPreprocessor class is included in your project directory. This file should define the class and methods as used in the SparsePLS class.


    Disclaimer: This README provides a high-level overview of the project. For detailed information, please refer to the code documentation and docstrings within the codebase.

    Visit original content creator repository
    https://github.com/yajeddig/SPARSE_PLS

  • nocpp

    Logo of NOCPP

    nocpp (No Charge Point Protocol)

    📋 Description

    NOCPP is the result of a project at the Ostwestfalen-Lippe University of Applied Sciences. It was developed by students of the Computer Engineering course. The client for this project is the company rt-solutions.de, which provides advice and solutions in information and OT security.

    Logo of rt-solutions.de

    NOCPP is an application for targeted pentesting of a charging station. The OCPP connection between the Charge Point (CP) and the Charge Station Management System (CSMS) is used as an attack parameter. In addition to various selected fuzzing attack scenarios, information gathering is also implemented. New attack scenarios can be easily implemented using a state machine. The results of the attacks, configurations and tests are exported in a results PDF.

    This project is based on the Open-Source OCPP implementation in Python by The Mobility House, which you can find here.

    ⚠️ Further Project Development

    The version of nocpp published here is the first development of this software. Future developments will be published exclusively on Gitlab, in this repository..

    💾 Charge Point support

    Currently OCPP 1.6-J (JSON) is the only supported version.

    The application was tested on a charging station from the manufacturer Weidmüller, model AC Smart Advanced.

    🚀 System Requirements

    Please make sure you use Python version 3.10 or higher.

    NOCPP only works with the websockets library in the specific version 12.0.

    ✅ Getting Started

    At this point I would like to emphasize once again that this software is only a prototype as a proof of concept. It cannot therefore be ruled out that it may contain errors.

    To execute the application, run Main.py. For automation, the following console arguments can be passed to the script for execution.

    • skip-websocket-config (Skips the manual WebSocket setup and uses default values. This argument blocks the set arguments.)
    • set-ip-address=[ipv4-address] (Set a specific IPv4 Address, uses default if the specified address is invalid.)
    • set-port=[port] (Set a specific port, uses default if the specified port is invalid.)

    💣 Attack Szenarios

    NOCPP uses various attack techniques, including inserting different data types and data values, as well as code injection. Please note that the effectiveness of this tool varies depending on the charging station. NOCPP recognizes successful system requests as well as error messages. In the event of a connection interruption (timeout), this is noted and the program is safely shut down. Due to the asynchronous program structure, this process can take significantly longer than the generation of the result PDF.

    The execution of the attack scenarios can be variably adapted in the state machine contained in the CSMS.py file. New attack scenarios can also be easily added.

    For the implementation of the attack scenarios, I recommend using the OCPP specification. However, the implementation on the respective charging stations can differ (significantly).

    Visit original content creator repository https://github.com/leonard-voss/nocpp