Giter Site home page Giter Site logo

pynezz / pynezzentials Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 55 KB

Pynezzentials is a Go package that provides some utilities for my personal projects. It is not intended to be a general-purpose library, but it may be useful for some people.

License: MIT License

Go 100.00%

pynezzentials's Introduction

Pynezzentials

GitHub go.mod Go version Go Report Card License

Pynezzentials is a Go package that provides some utilities for my personal projects. It is not intended to be a general-purpose library, but it may be useful for some people.

Features

  • cryptoutils: A set of utilities for encrypting and decrypting data.
  • fsUtils: A set of utilities for working with files.
  • ansi: A set of utilities for working with ANSI escape codes.

Installation

To install Pynezzentials, run:

go get -u github.com/pynezz/pynezzentials

Usage

package main

import (
    "fmt"
    utils "github.com/pynezz/pynezzentials"
)

func main() {
    fmt.Println(utils.Bold("Hello, world!"))
}

IPC

UNIX Domain sockets inter process communication (IPC) is a mechanism for exchanging data between processes running on the same host operating system. Pynezzentials provides a simple way to create a server and client for IPC.

Server

package main

import (
    "fmt"
    "github.com/pynezz/pynezzentials/ipc"
)

func main() {
    server := ipc.NewIPCServer("servername", [4]byte{0, 0, 0, 1})  // Identifier for the server

    server.LoadModules("config.txt")

    server.Listen(func(data []byte) []byte {
        fmt.Println("Received data:", string(data))
        return []byte("Hello, client!")
    })
}

Client

package main

import (
    "fmt"
    "github.com/pynezz/pynezzentials/ipc"
)

func main() {
    client := ipc.NewIPCClient("client1", [4]byte{0, 0, 0, 1})   // Identifier must match the server's identifier
    err := client.Connect()
    if err != {
        fmt.Println("Error:", err)
    }

    msg := client.CreateGenericReq([]byte("Hello, server!"), ipc.MSG_MSG, icp.DATA_JSON)

    response, err = client.SendIPCMessage(msg)
    if err != nil {
        fmt.Println("Error:", err)
    } else {
        fmt.Println("Received response:", string(response))
    }
}

License

LICENSE

pynezzentials's People

Contributors

pynezz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.