Category: Blog

  • dialogue-system

    Simple Dialogue System for Unity

    Hello! I wanted to share some of my work starting today! You will learn how to create a simple dialogue system with Unity Coroutines and ScriptableObjects.

    Using ScriptableObject

    Create a ScriptableObject on Project folder using Create > ScriptableObjects > DialogueSystem

    Scriptable Object Example

    Script side

    Make it single system:

    // Make sure to drag the scriptable object here!
    [SerializeField]
    private DialogueSystem dialogueSystem;
    
    //...
    
    void Start()
    {
       StartCoroutine(StartDialogue);
    }
    
    private IEnumerator StartDialogue()
    {
        // Get first dialog
        var firstDialog = dialogueSystem.contexts[0].dialogue;
    
        // Or loop through
        for(int i=0;i<dialogueSystem.contexts.length;i++)
        {
            var dialogue = dialogueSystem.contexts[i].dialogue;
            yield return new WaitForSeconds(dialogueSystem.contexts[i].contextReadTime);
        }
         
        // ...
    }

    Or if you want to create sequences, make it an array:

    [SerializeField]
    private DialogueSystem[] dialogueSystems;
    
    //...
    int currentSequence=0;
    
    void Start()
    {
       StartCoroutine(StartDialogue());
    }
    
    private IEnumerator StartDialogue()
    {
        // Get sprite for talking person
        var talkerSprite = dialogueSystem[currentSequence].talkerSprite;
    
        // Loop through
        for(int i=0;i<dialogueSystem[currentSequence].contexts.length;i++)
        {
            var dialogue = dialogueSystem[currentSequence].contexts[i].dialogue;
            yield return new WaitForSeconds(dialogueSystem[currentSequence].contexts[i].contextReadTime);
        }
         
        // ...
    }

    If you want to divide sprites for each dialogue, simply move public Sprite talkerSprite inside Context class.

    Check out the full example here.

    Visit original content creator repository https://github.com/harrycarriers/dialogue-system
  • udpTunnel

    Basic UDP Bridge v1.0.0

    System Nodes

    Server-tunnel:

    This is the UDP bridge as such, it is executed like next example:
    $node ./tunnel/app.js -s 0.0.0.0:5000 -c 0.0.0.0:4000 -t 500 -e 100

    • Where:
      -s: means server-tunnel endpoint to listening to streamer, default value if omit 0.0.0.0:5000.

      -c: means server-tunnel endpoint to listening to client, default value if omit 0.0.0.0:4000.

      -t: means time to expire cache data in miliseconds, default value if omit 500 ms.

      -e: means interval time to send all cache available to clients connected, default if omit 100 ms.

    Client:

    This is the client which will get the cache data from server, execute as:
    $node ./client/app.js -s 127.0.0.1:4000 -k 30 -i 1234.

    • Where:
      -s: means server-tunnel endpoint which is listening to the client, especial attention to port parameter, it has to be the same as the tunnel has for this client, default if omit 127.0.0.1:4000.

      -k: means time interval in miliseconds to send keepalive message to the tunnel, default if omit 1000 ms.

      -i: means a unique id amount all client connected to the server-tunnel, it is a way to identify the client no matter if he changed its endpoint through NAT/PAT, it could be any string.

    Streamer:

    This is a mock streamer, used to test but can be used in production if you want, example:
    $node ./streamer/app.js -s 127.0.0.1:5000 -t 100

    • Where:

      -s: means server-tunnel endpoint which is listening to the streamer, especial attention to port parameter, it has to be the same as the tunnel has for the streamer, default if omit 127.0.0.1:5000.

      -t: means time interval to send mocked cache data to server, defautl if omit 100 ms.

    Quick localhost running:

    As can be noted default values match with each others, so only execute following commands in differents terminal and enjoy:

    $node ./tunnel/app.js
    $node ./client/app.js
    $node ./streamer/app.js

    Notes:

    • Feel free to modify, use and improve this first approach.

    • Currently the client is sending a json {id: [-id parameter], data: "k"} as keepalive message and the mock streamer is sending the string "Hello" as cahce info.

    • There is no a real concept of connection or server-client protocol in UDP-style sockets, in this application the clients connected will be concidered who have sent a keepalive before, it’ll be identified inside the server-tunnel by the id set in scripts parameters, if there are ids repeated the last keepalive will be got as current connected client for that id, be sure set diferents id parameters for diferents clients.

    • All line in the project preceded by a "//DEBUG" comment can be deleted or commented.

    Visit original content creator repository
    https://github.com/gamilr/udpTunnel

  • ct-aws-cognito-spring-security

    AWS Cognito Integration with Spring Security

    Introduction

    This Spring Boot project demonstrates web and method security using ct-iam-spring-security. This repository is only available to sponsors (Anbu level).

    How it Works

    Maven Dependency

    This module is available in GitHub and can be added to your Maven project as a dependency.

    <dependency>
      <groupId>com.czetsuyatech</groupId>
      <artifactId>ct-iam-spring-security</artifactId>
      <version>${ct-iam-spring-security.version}</version>
    </dependency>
    

    Make sure to define the ct-iam-spring-security.version property with the latest release version.

    Security Configuration Data

    Cognito

    We need to define the following Spring application configs to connect to our AWS Cognito instance to decode and verify the JWT token.

    app:
      security:
        jwt:
          cognito:
            pool-id: ${AWS_COGNITO_POOL_ID}
            region: ${AWS_COGNITO_REGION}
    
    spring:
      security:
        oauth2:
          resourceserver:
            jwt:
              issuer-uri: https://cognito-idp.${app.security.jwt.cognito.region}.amazonaws.com/${app.security.jwt.cognito.pool-id}
    

    Enabling Web and Method Security

    To enable the web and method security in your microservice. Create a new Java class CtAppSecurityConfiguration and annotate it with EnableCtSecurity. In this class, we define the custom beans that generates the HttpSecurity and add it to the filter chain as well as the custom method security expression handler.

    @Configuration
    @RequiredArgsConstructor
    @EnableCtSecurity
    public class CtAppSecurityConfiguration {
    
      @Bean
      public CtHttpSecurityConfigurer httpSecurityConfig() {
    
        return http ->
            http
                .authorizeHttpRequests(authz -> authz
                    .antMatchers(HttpMethod.GET, "/actuator/**").permitAll()
                    .antMatchers("/api/**").authenticated()
                    .anyRequest().permitAll()
                );
      }
    
      @Bean
      public CtMethodSecurityExpressionHandlerFactory methodSecurityFactory() {
        return CtAppMethodSecurityExpressionRoot::new;
      }
    }
    

    In CtWebSecurityConfiguration:

    @Configuration
    @EnableWebSecurity
    @RequiredArgsConstructor
    public class CtWebSecurityConfiguration {
    
      private final CtHttpSecurityConfigurer httpSecurityConfig;
    
      @Bean
      public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
    
        http.csrf().disable()
            .cors()
    
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .sessionAuthenticationStrategy(new NullAuthenticatedSessionStrategy())
    
            .and()
            .httpBasic().disable()
            .formLogin().disable()
            .oauth2ResourceServer().jwt();
    
        httpSecurityConfig.configure(http);
    
        return http.build();
      }
    }
    

    Class Diagram

    Method Security

    Class Diagram

    Testing

    I have created this Spring Boot project that use this library available at https://github.com/czetsuya/ct-aws-cognito-spring-security. This project contains the Security configuration, custom method expression handler, and sample controllers.

      @GetMapping("/hello")
      @ResponseStatus(HttpStatus.OK)
      public String hello(@CurrentSecurityContext(expression = "authentication") Authentication auth) {
    
        log.debug("" + auth.getPrincipal());
        log.debug("" + auth.getCredentials());
        log.debug("" + auth.getDetails());
    
        return "Hello " + auth.getPrincipal();
      }
    
      @GetMapping("/api/testing/authenticated")
      @PreAuthorize("isAuthenticated()")
      @ResponseStatus(HttpStatus.OK)
      public String authenticated(@CurrentSecurityContext(expression = "authentication") Authentication auth) {
    
        log.debug("" + auth.getPrincipal());
        log.debug("" + auth.getCredentials());
        log.debug("" + auth.getDetails());
    
        return "Hello " + auth.getPrincipal();
      }
    
      @GetMapping("/api/testing/authorized")
      @PreAuthorize("isAuthorized()")
      @ResponseStatus(HttpStatus.OK)
      public String authorized() {
        return "authorized";
      }
    
      @GetMapping("/api/testing/unauthorized")
      @PreAuthorize("isUnAuthorized()")
      @ResponseStatus(HttpStatus.FORBIDDEN)
      public String unAuthorized() {
        return "unauthorized";
      }
    

    Endpoints

    • /hello – This endpoint is not secured, therefore it is available even without an authenticated token.
    • /api/testing/authenticated – This endpoint needs an authenticated user.
    • /api/testing/authorized – This endpoint needs an authenticated user and performs the validation in. CtAppMethodSecurityExpressionExtension.isAuthorized which return a hard-coded true. Thus, it should be accessible.
    • /api/testing/unauthorized – This endpoint needs an authenticated user and performs the validation in CtAppMethodSecurityExpressionExtension.isUnAuthorized which return a hard-coded false. Thus, it should not be accessible.

    You can add custom authorization rules in CtAppMethodSecurityExpressionExtension, and it will be automatically added to the Spring security context.

    Postman

    Get a Token

    To get a token, create a new request in Postman and under the authorization tab, fill-up the “Configure New Token” tab. Configure a New Oauth Token in Postman

    Click the Get New Access Token and enter a valid credential.

    Follow this guide: How to Generate Amazon Cognito Access Using Postman if you are not familiar with AWS Cognito.

    And then you can copy and use the generated bearer-token to create new requests inside Postman.

    Other Clients

    Visit original content creator repository https://github.com/czetsuyatech/ct-aws-cognito-spring-security
  • news_paper

    Blogpaper

    Description

    A blog-style web application built with Django. Users can create, publish, edit and delete their articles, as well as comment on other users’ posts.

    Try it

    Click here to try it. Enjoy 😊

    Current features

    User Authentication

    • Users can create accounts and log in securely.
    • Password reset functionality is available to help users regain access to their accounts if they forget their passwords.

    Article Management

    • Authenticated users can write and publish articles.
    • Authors have the ability to edit and delete their own articles.
    • Articles display the author’s name, publication date, and a title.
    • Visitors can not read articles without an account.

    Comment System

    • Authenticated users can leave comments on articles.
    • Comments show the commenter’s name and content.
    • Only superuser can moderate and delete comments on articles.

    Next Features

    • User can upload image on their article
    • Visitors can read articles without needing an account.

    Setup

    To run this Django application locally, follow these steps:

    1 . Clone the repository to your local machine:

    git clone https://github.com/LudoTreb/news_paper.git

    2 . Create a virtual environment and activate it & install dependencies:

    python -m venv .venv 
    source .venv/bin/activate
    pip install -r requirements.txt 

    Run the code

    Run the server from the root folder

    python manage.py runserver
    

    and open in browser this adress: http:/127.0.0.1:8000/

    How to use it

    You can create an account with the signup button or you can use this account ⬇️
    Username: fake_user0
    Password: fake_password0

    Visit original content creator repository
    https://github.com/LudoTreb/news_paper

  • php-websocket-server

    Gomoob WebSocket server

    WebSocket server with tags management, forward messages on the right clients with ease !

    Total Downloads Latest Stable Version Build Status Coverage Code Climate License

    Introduction

    The Gomoob WebSocket server is a simple Ratchet server which works with custom tags to easily forward messages to clients depending on custom tags.

    As an example let’s suppose we have a Web Application with English and French users. English users should receive English messages, French users should receive French messages.

    Each application opens a Web Socket with a particular language tag.

    // Web Application in English mode
    var enWebSocket = new WebSocket('ws://localhost:8080?tags={"language":"EN}');
    
    ...
    
    // Web Application in French mode
    var frWebSocket = new WebSocket('ws://localhost:8080?tags={"language":"FR}');
    
    ...

    On server side the Gomoob WebSocket server keeps track of the associations between tags and WebSocket connections. For example this simple PHP peace of code allows to easily forward a message to all clients connected with the language=FR tag.

    // PHP Server (in most cases a Web Server) to Web Socket server client, allows to send one message which is forwared to
    // several opened WebSocket connections
    $phpClient = new WebSocketClient('ws://localhost:8080');
    $phpClient->send(WebSocketRequest::create($message, ['language' => 'FR']);

    Installation

    Server side (run the server)

    Running a server requires only one line of code.

    require __DIR__ . '/vendor/autoload.php';
    
    echo "WebSocket server started, enter Ctrl+C to stop server." . PHP_EOL;
    \Gomoob\WebSocket\Server\WebSocketServer::factory()->run();

    Client side (PHP)

    First pull the project with composer using the following dependency.

    {
        "require": {
            "gomoob/php-websocket-server": "^1.0.0"
        }
    }

    Then simply use the \Gomoob\WebSocket\Client\WebSocketClient class to send your messages.

    // Open a Server / Server WebSocket connection
    $phpClient = new WebSocketClient('ws://localhost:8080');
    
    // Forward a message to all the WebSocket client connections associated to 'tag1' and 'tag2'
    $response = $phpClient->send(
        WebSocketRequest::create(
            $message, 
            [
                'tag1' => 'tag1Value',
                'tag2' => 'tag2Value'
            ]
        )
    );

    If you want to write solid unit tests we also provide the \Gomoob\WebSocket\Client\WebSocketClientMock class. This class is a utility mock which is very easy to use.

    // Somewhere in our code we use a \Gomoob\WebSocket\IWebSocketClient ...
    // We suppose this code is implemented in MyPowerfulService->serviceMethod();
    $phpClient->send(WebSocketRequest::create('Message 0.')->setTags(['tag0' => 'tag0Value']));
    $phpClient->send(WebSocketRequest::create('Message 1.')->setTags(['tag1' => 'tag0Value']));
    $phpClient->send(WebSocketRequest::create('Message 2.')->setTags(['tag0' => 'tag0Value', 'tag1' => 'tag1Value']));
    		
    // Then we write a test case by replacing the real WebSocket client implementation with the mock one
    class SampleTestCase extends TestCase
    {
        public function setUp() {
            $this->webSocketClient = new WebSocketClientMock();
            $this->myPowerfulService->setWebSocketClient($this->webSocketClient);
        }
    
        public function testServiceMethod() {
        
            // Calls the method to test
            $this->myPowerfulService->serviceMethod();
        
            // Checks the right requests were sent
            $webSocketRequests = $this->webSocketClient->findByTags(['tag0' => 'tag0Value']);
    		$this->assertCount(2, $webSocketRequests);
    		$this->assertContains($webSocketRequest0, $webSocketRequests);
    		$this->assertNotContains($webSocketRequest1, $webSocketRequests);
    		$this->assertContains($webSocketRequest2, $webSocketRequests);
        }
    }

    Advanced configuration

    The default behavior of the Gomoob WebSocket server is the following !

    • Expose port 8080 and authorize connections from all IP addresses (i.e 0.0.0.0) ;
    • Accept only plain string messages (exceptions are encountered if JSON messages are sent / received) ;
    • Use a default PSR logger which output messages on the terminal ;
    • Do not manage any authorization checks.

    If one of those behaviors does not fit your need please read the following sub sections. You can also read the src/test/server.php file which shows how to start a server with custom message parsing and authorizations.

    Message parser

    By default the WebSocket server will accept plain string messages, if you try to send a JSON object then you’ll encounter the following exception.

    The 'message' property is not a string, you must configure a message parser to parse messages !
    

    This is the expected behavior, if you want the server to manage custom PHP object messages then you have to :

    • Make your PHP object messages extends \JsonSerializable and implement the jsonSerialize() method correctly ;
    • Implement a custom message parser to create your custom PHP object messages when a plain JSON object is received.

    A sample message object is provided in the \Gomoob\WebSocket\Message\Message class, feel free to read the associated source code to understand how it works. You’ll also found a sample message parser in the \Gomoob\WebSocket\Message\MessageParser.

    To explain how to manage custom PHP object messages let’s suppose we have the following message object to send.

    class MyMessage {
        private $messageProperty1;
        public function __construct($messageProperty1) {
            $this->messageProperty1 = $messageProperty1; 
        }
        public function getMessageProperty1() {
            return $this->messageProperty1;
        }
    }

    Sending such a message in a browser on Javascript would require the following code.

    var socket = new WebSocket('ws://localhost:8080');
    socket.send(
        JSON.stringify(
            {
                message : {
                    messageProperty1 : "Hello !"
                },
                tags : {
                    tag1 : 'tag1Value'
                }
            }
        )
    );

    Or in PHP with the client we provide.

    WebSocketClient::factory('ws://localhost:8080')->send(WebSocketRequest::create(new MyMessage('Hello !')));

    As this this will not work because on server side the Gomoob WebSocket server will not know how to parse the messages and how to re-create those messages to forward them to clients who opened WebSocket connections.

    The first thing to do is to implement the \JsonSerializable class and the jsonSerializeMethod() in our MyMessage class.

    class MyMessage implements \JsonSerializable {
       ...
       public function jsonSerialize() {
           return [
               'messageProperty1' => $this->messageProperty1;
            ];
       }
    }

    Then we have to implement a message parser by extending the \Gomoob\WebSocket\IMessageParser class.

    use Gomoob\WebSocket\IMessageParser;
    
    class MyMessageParser implement IMessageParser {
        public function parse(array $arrayMessage)
        {
            // Ensure the array contains only valid key names
            foreach (array_keys($arrayMessage) as $key) {
                if (!is_string($key) || !in_array($key, ['messageProperty1'])) {
                    throw new \InvalidArgumentException('Unexpected property \'' . $key . '\' !');
                }
            }
            
            // The 'messageProperty1' property is mandatory
            if (!array_key_exists('messageProperty1', $arrayMessage)) {
                throw new \InvalidArgumentException('No \'messageProperty1\' property found !');
            }
            
            return new MyMessage($arrayMessage['messageProperty1']);
        }
    }

    Finally we have to provide our parser when we create our WebSocket server.

    WebSocketServer::factory(
        [
        	'messageParser' => new MyMessageParser()
        ]
    )->run();

    Authorization Manager

    By default the WebSocket server will accept all connections and message sendings, in most cases this behavior is not expected because anybody could open a WebSocket on your server and try to forward messages to all connected clients without authorization.

    You can implement a custom authorization manager by implementing the \Gomoob\WebSocket\IAuthManager interface, this interface has the following signature.

    /**
     * Interface which defines an authorization manager. An authorization manager allows to control authorization while
     * opening Web Socket connections and sending messages over Web Sockets.
     *
     * @author Baptiste Gaillard (baptiste.gaillard@gomoob.com)
     */
    interface IAuthManager
    {
        /**
         * Function used to indicate if connection opening is authorized.
         *
         * @param \Ratchet\ConnectionInterface $connection the current Ratchet connection.
         *
         * @return boolean `true` if the connection opening is authorized, `false` otherwise.
         */
        public function authorizeOpen(ConnectionInterface $connection);
    
        /**
         * Function used to indicate if message sending is authorized.
         *
         * @param \Ratchet\ConnectionInterface $connection the current Ratchet connection.
         * @param \Gomoob\WebSocket\IWebSocketRequest $webSocketRequest the current Gomoob WebSocket request.
         */
        public function authorizeSend(ConnectionInterface $connection, IWebSocketRequest $webSocketRequest);
    }

    So its very easy to manage authorizations, just return true or false with the authorizeOpen(...) or authorizeSend(...) functions.

    The ApplicationsAuthManager

    To easier authorization we provide an authorization manager which allows to declare several applications with key and secret properties.

    This authorization manager is available in the \Gomoob\WebSocket\Auth\ApplicationsAuthManager class, it works with a very simple YAML configuration file.

    Here is a sample instanciation of the manager with a WebSocket server.

    WebSocketServer::factory(
        [
        	'authManager' => ApplicationsAuthManager::factory(
        	    [
        	        'authorizeOpen' => false,
        	    	'configurationFile' => __DIR__ . '/auth.yml'
        	    ]
        	)
        ]
    )->run();

    The content of the auth.yml file could be the following.

    applications:
      - 
        key: application1
        secret: B4ajW3P7jfWEYPZsQV8mnteHg97G67uW
        authorizeOpen: true
      - key: application2
        secret: 33yLWdynhaqm9tYjDFKf8gB8zmAPKdDP
        authorizeOpen: false

    Then the followig Javascript peace of code will apply.

    // Does not work because required 'key' and 'secret' URL parameters are not provided
    var socket1 = new WebSocket('wss://myserver.org:8080'); 
    
    // Works because the 'key' and 'secret' URL parameters provided are valid
    var socket2 = new WebSocket('wss://myserver.ord:8080?key=application1&secret=B4ajW3P7jfWEYPZsQV8mnteHg97G67uW');
    
    // Does not work because the request does not provide the 'key' and 'secret' properties
    socket2.send(
        JSON.stringify(
            {
                message : {
                    messageProperty1 : "Hello !"
                }
            }
        )
    );
    
    // Works because the request provides valid 'key' and 'secret' properties
    socket2.send(
        JSON.stringify(
            {
                message : {
                    messageProperty1 : "Hello !"
                },
                metadata : {
                    key : 'application2',
                    secret : '33yLWdynhaqm9tYjDFKf8gB8zmAPKdDP'
                }
            }
        )
    );

    The same rules are also applicable with the PHP client we provide.

    WebSocketClient::factory('ws://localhost:8080')->send(
        WebSocketRequest::create(
            new MyMessage('Hello !')
        )->setMetadata(
            [
                'key' => 'application2',
                'secret' => '33yLWdynhaqm9tYjDFKf8gB8zmAPKdDP'
            ]
        )
    );

    Docker container

    To help you start quickly we also provide a Docker container here https://hub.docker.com/r/gomoob/php-websocket-server.

    Release history

    1.2.0 (2016-08-23)

    • Moves the TagsTree class to \Gomoob\WebSocket\Util\TagsTree ;
    • Add a new TagsTree->reset() method ;
    • Add a new \Gomoob\WebSocket\Client\WebSocketClientMock class to easier unit testing ;
    • Update composer dependencies.

    1.1.0 (2016-08-18)

    • Add more PHP Documentor documentation about the goals of metadata in the \Gomoob\WebSocket\IWebSocketRequest interface and the \Gomoob\WebSocket\Request\WebSocketRequest class ;
    • Add management of defaultMetadata in the \Gomoob\WebSoscket\IWebSocketClient interface and the \Gomoob\WebSocket\Client\WebSocketClient class ;
    • Add management of defaultTags in the \Gomoob\WebSocket\IWebSocketClient interface and the \Gomoob\WebSocket\Client\WebSocketClient class ;
    • Improve \Gomoob\WebSocket\Message\Message serialization ;
    • Improve \Gomoob\WebSocket\Request\WebSocketRequest serialization ;
    • Now all the factory methods can be calls with a factory(...) method or an alias create(...) method.

    1.0.3 (2016-08-17)

    • Fix port and address options problems while creating a WebSocketServer, the parameter were not transmitted to the Ratchet server ;
    • Now the default port number is 80 which is the default Ratchet server port.

    1.0.2 (2016-08-17)

    • Add missing symfony/yaml composer dependency, otherwise problems was encountered while running composer update --no-dev ;
    • Add missing monolog/monolog composer dependency, , otherwise problems was encountered while running composer update --no-dev.

    1.0.1 (2016-08-17)

    • Configure specific Eclipse validator rules ;
    • Add MIT license.

    1.0.0 (2016-08-17)

    • First release.

    About Gomoob

    At Gomoob we build high quality software with awesome Open Source frameworks everyday. Would you like to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible !

    You can contact us by email at contact@gomoob.com or by phone number (+33) 6 85 12 81 26 or (+33) 6 28 35 04 49.

    Visit also http://gomoob.github.io to discover more Open Source softwares we develop.

    Visit original content creator repository https://github.com/gomoob/php-websocket-server
  • REACTION-resources

    REACTION

    alt text

    This repository contains some of the resources developed by REACTION (Retrieval, Extraction and Aggregation Computing Technology for Integrating and Organizing News) an initiative for developing a computational journalism platform (mostly) for Portuguese.

    SentiLex-PT

    POWER-PT

    • File: POWER-PT
    • Description: An ontology of Portuguese politics.
    • Cite:
      • Tracking politics with POWER Silvio Moreira, David S Batista, Paula Carvalho, Francisco M Couto, and Mario J Silva. In Program: electronic library and information systems, 47(2), 2013.
      • POWER – Politics Ontology for Web Entity Retrieval Silvio Moreira, David Batista, Paula Carvalho, Francisco M Couto, and Mário J Silva. In Advanced Information Systems Engineering Workshops. Springer, 2011.

    DBpediaRelations-PT

    • File: DBpediaRelations-PT
    • Description: a corpus of semantic relationships extracted from the Portuguese Wikpedia and DBpedia.
    • Cite: Exploring DBpedia and Wikipedia for Portuguese Semantic Relationship Extraction David Soares Batista, David Forte, Rui Silva, Bruno Martins, and Mário J. Silva.Linguamática, 5(1), 2013.

    Parliamentary Data

    • Data crawled by Bruno Martins from the Italian Senate and the Portuguese Parliament

    Others

    • DBpediaEntities-PT: corpus of entities extracted from the Portuguese DBpedia.

    • Twitter-BrownClusters-PT: word clusters induced from Portuguese Twitter messages.

    • NomesLex-PT: lexicon of person names from Portugal.

    • SentiCorpus-PT: comments in Portuguese manually annotated with sentiment and opinions about politicians.

    • SentiTuites-PT: corpus of tweets posted by Portuguese users during the 2011 election campaign.

    Visit original content creator repository https://github.com/davidsbatista/REACTION-resources
  • GemBot

    Gembot 🤖

    Gembot is an advanced AI-powered chatbot designed to engage users in natural language conversations using state-of-the-art machine learning models. Built on top of the Gemini architecture, it supports features such as summarization, streaming responses, and custom dialogue management.

    Features

    • 💬 Natural language understanding: Responds to user queries with contextual understanding.
    • 🔄 Real-time conversation: Supports asynchronous and real-time chat interactions.
    • 📜 Summarization: Can summarize text passages dynamically.
    • 🌐 Web Integration: Can be deployed and integrated into web applications easily.
    • 📈 Scalable: Built for both lightweight personal projects and large-scale implementations.

    Demo

    Check out a live demo of Gembot here.

    Installation

    To install Gembot locally, follow the steps below.

    Prerequisites

    • Node.js 16.x or later
    • npm or yarn

    Step 1: Clone the repository

    git clone https://github.com/gaureshpai/Gembot.git
    cd Gembot

    Step 2: Install dependencies

    npm install

    Step 3: Run the application

    npm run dev

    Web Interface

    Gembot also comes with a web UI:

    1. Start the server using npm run dev.
    2. Open http://localhost:3000 in your browser.
    3. Interact with Gembot using the web-based interface.

    API

    If you wish to integrate Gembot into another system, it offers a flexible API:

    • POST /api/chat: Sends a message to Gembot and returns a response.

    Example API request:

    {
      "message": "What is AI?"
    }

    Response:

    {
      "response": "AI stands for Artificial Intelligence..."
    }

    Contributing

    We welcome contributions! Feel free to open issues or submit pull requests.

    Visit original content creator repository
    https://github.com/gaureshpai/GemBot

  • MakeItSimple

    MakeItSimple – Makefiles for C++/C Projects

    Features

    This github repository has a set of simple makefiles that may be useful for small or medium sized C and C++
    projects without any further build system. The scripts build executable targets from c-, c++- and
    assembler source files in the current project directory and create a JSON Compilation Database for
    the clang language server.
    These makefiles only use functions that are available in a standard GNU Linux installation and do
    not require any additional build tools to be installed. They are therefore ideally suited to get a
    quick introduction to the C/C++ world.

    Together with an editor that can use the capabilities of the Clang language server, it is possible to
    support code completion and code navigation in the best possible and interactive way.

    An interactive project wizard allows a convenient and quick creation of the project skeleton for 5
    different project types.

    The project wizard can generate artifacts for full integration into the Kate Editor build plugin.

    Make automatically determines which pieces of a program need to be recompiled, and issues commands
    to recompile them. For maximum performance, all make scripts support parallel build.

    The scripts keeps track of the last used configuration and perform a complete build, if changes in
    the build configuration have been detected.

    The scripts come with a comprehensive set of warning compiler options for the GNU C++ compiler and clang.
    These options can be controlled in 6 levels.

    All make files support 2 build modes run and debug. In build mode run an optimized executable without
    debug information is built. In build mode debug the executable contains debug information.

    All compiler options are valid for GNU C++ compiler and clang, if you use an alternative compiler
    adapt the options and warning flags accordingly.

    Project Types

    • One To One: C++ project – Build executable targets from each %.cpp and %.cc source file in the project directory.
    • In Place Build: C++ project – Build one executable from all %.cpp and %.cc source files in the project directory.
    • Out Place Build: C++ project – Build one executable from all %.cpp and %.cc source files in all project source directories.
    • Out Place Build: C project – Build one executable from all %.c source files in all project source directories.
    • Out Place Build: C/C++ project – Build one executable from all C++, C and assembler source files in all project source directories.

    Installation

    You can execute this tool directly from the cloned/downloaded source-repository or you can install the tool.

    If you want to install the tool, download the installation script of the latest release Releases
    and run it. The release package is a self extracting script. Execute it and follow the instructions on the screen.
    You can install the tool into an arbitrary place. The preferred way is to run this script as root user
    and to install the tool into a system directory.

    • The default installation place for the root user is /usr/local
    • The default installation place for other users is ~/mktsimple

    Quick Start

    • After installation you can start the project wizard mktsimple from your installation directory.
    • Follow the instructions and select the option ‘Create a hello world project’.
    • Then open the created project directory in a shell and execute make all.
    • To find out more about the possible options of the tool execute make help
    • If the tool is not installed in the default location (/usr/local) and the project has no local copy
      of the warning.xxx.mk files it is necessary to add the option -I with the path to the include directory
      of your installation e. g.: make -I ~/mktsimple/include

    Samples

    Samples are available in the source repository.

    The directories

    • OneToOne
    • ProjectInPlaceBuild
    • ProjectOutPlaceBuildCpp
    • ProjectOutPlaceBuildC
    • ProjectOutPlaceBuild
      contain sample projects.

    Use the following commands to complete these project fragments withe the project wizard:

    cd OneToOne; ../bin/mktsimple --project-dir . --type otocpp --noprompt --overwrite; make all
    
    cd ProjectInPlaceBuild; ../bin/mktsimple --project-dir . --type ipbcpp --noprompt --overwrite; make all
    
    cd ProjectOutPlaceBuildCpp; ../bin/mktsimple --project-dir . --type opbcpp --noprompt --overwrite; make all
    
    cd ProjectOutPlaceBuildC; ../bin/mktsimple --project-dir . --type opbc --noprompt --overwrite; make all
    
    cd ProjectOutPlaceBuild; ../bin/mktsimple --project-dir . --type opb --noprompt --overwrite; make all
    

    Kate integration

    The Build Utility provides files that allow you to take full advantage of the Clang Language Server with
    the Kate Editor.
    To do this, you need to install the following plugins in ‘Kate’:

    • Build & Run,
    • LSP Client,
    • Project Plugin,
    • Terminal
      When creating a new project skeleton with the project wizard ‘mktsimple’, activate the option:
      ‘Create a Kate Project’. The project wizard can also be used to add the Kate-Project-File to an existing
      C/C++ project.
      The first build attempt creates the compilation database that is needed by the Language Server, even
      if the build itself fails. From now on, all the functions of the Language Server are available.

    If you have any suggestions or bug reports please write a Github Issue.

    Learn more about MakeItSimple here.

    Visit original content creator repository
    https://github.com/joergboe/MakeItSimple

  • marketplace-api.adoptium.net

    Adoptium marketplace

    This repo contains:

    • adoptium-marketplace-schema
      • Schema definition for vendors to advertise their binaries
    • adoptium-marketplace-client
      • Client library for reading a repository with vendor data
    • adoptium-marketplace-server
      • Implementation of the adoptium marketplace API
    • exampleRepositories
      • Examples of a vendor repository

    Build

    Build with

    ./mvnw clean install

    Testing

    Tests rely on the data inside the exampleRepositories directory in order for tests to pass they must be signed. If you wish to modify test assets they need to be re-signed once they have been modified. The procedure would be as follows:

    • Generate test keys
      • Look in the exampleRepositories/keys directory for scripts that detail generating keys
    • Re-sign assets
      • Run SignTestAssets in the adoptium-marketplace-utils project.

    Repository validation

    A repository can be validated using the MarketplaceClient. The client pulls a repository and validates its contents. For example:

        String publicKey = "-----BEGIN PUBLIC KEY-----\n" +
        // Public key string here
        "-----END PUBLIC KEY-----";
        String repoUrl = "http://localhost:8080/repo";
    
        try {
            MarketplaceClient client = MarketplaceClient.build(repoUrl, SignatureType.BASE64_ENCODED, publicKey);
            ReleaseList releaseList = client.readRepositoryData();
        
            System.out.println("Found: " + releaseList.getReleases().size() + " releases");
        } catch (Exception e) {
            System.err.println("Validation failed");
            e.printStackTrace();
        }

    Note that in this example we have used the default SignatureType.BASE64_ENCODED which specifies that the signature files are
    base64 encoded. If you require non-base64 encoded use SignatureType.SIG.

    An example of running this can be seen in RepoTest class in the adoptium-marketplace-client module. To validate your repo using this test,
    edit it to add your public key and repo location, then run with:

    VALIDATE_REPO=true ../mvnw test -Dtest=RepoTest#validateRepo
    

    from inside the adoptium-marketplace-client directory.

    Visit original content creator repository
    https://github.com/adoptium/marketplace-api.adoptium.net

  • Lispy

    Lispy

    Description

    A lisp-like language made with Python

    Documentation : https://alexishuvier.github.io/Lispy-Docs/

    Dependencies

    • Python 3.8+

    Installation

    • Download last release or master (unstable)
    • Launch any lispy file with python .\Lispy.py <file>.lpy [--debug] or launch interpreter with python .\Lispy.py [--debug]
    • Enjoy

    Features

    • Basic mathematic operators : +, -, *, /, //, %

    • Basic logic operators : =, !=, <=, >=, <, >, !

    • Basic functions :

      • Variables management with def, set, del
      • display to print something
      • input to get input from user
      • Conditions with if
      • Loop with for and while
      • Get type of object with type
      • Assertions with assert
      • Import to import other lispy file or native module or python module
    • Native modules (import <name>):

      • str : Manage string (9 constants, 22 functions)
      • list : Manage list (23 functions)
      • dict : Manage dictionnary (7 functions)
      • math : Many functions and constants for mathematics (5 constants, 27 functions)
      • stats : Get mean, median, mode and variance (4 functions)
      • rand : Get random numbers or choice in list (5 functions)
      • sys : Get internal system informations (3 functions)
      • os : Some operations with operating system (5 functions)
      • path : Manage, read or write file, directory or path (12 functions)
      • turtle : Based on python’s turtle (36 functions)
      • sqlite : Connection with sqlite DB (5 functions)
      • csv : Read, Write and Manage CSV File (19 functions)
    • Additive modules (import <python:name>):

      • lpygame : Make you own game based on python’s pygame (WIP) (87 functions) (must install pygame)
      • lrequests : Based on python’s requests (WIP) (8 functions) (must install requests)
      • lpycord : Make you own discord bot (WIP) (82 functions) (must install discord.py)

    Changelog

    V 1.0.0 : XXX Update – XX/XX/XX (INDEV)

    • First version

    Visit original content creator repository
    https://github.com/AlexisHuvier/Lispy