Blog

  • meteor-base64

    Isomorphic Base64 implementation

    Highly efficient isomorphic implementation of Base64 string encoding and decoding. With the support of Unicode, and non-blocking execution via WebWorker. This library has 100% tests coverage, including speed tests.

    Features

    1. 100% tests coverage;
    2. Isomorphic, same API for Server and Browser;
    3. Blazing fast, see speed tests;
    4. Non-blocking browser experience, via WebWorkers;
    5. No external dependencies;
    6. Can replace default Meteor’s base64 package.

    Installation

    meteor add ostrio:base64

    ES6 Import

    import { Base64 } from 'meteor/ostrio:base64';

    Native code support

    Native code is disabled by default for Browser. Native code represented as atob, btoa (with extension to support Unicode) in a browser, and Buffer at NodeJS.

    Although native code is 10x times faster, its support is enabled only on Server, as natively base64 encoding supports only ASCII symbols in a Browser. To enable native code – pass { useNative: true } in constructor:

    import { Base64 } from 'meteor/ostrio:base64';
    const nativeB64 = new Base64({ useNative: true });

    Non-blocking via WebWorker

    WebWorker is disabled by default, enable it with passing { allowWebWorker: true } in new Base64() constructor. Once enabled it will be used for all encode/decode calls with the callback. WebWorker is used only if supported by a browser, otherwise, it will fall-back to the main thread. In the real-world application WebWorker, usage will gain you extra FPS, and UI will act more smoothly.

    API

    .encode()

    base64Instance.encode(plainString [, callback]);
    import { Base64 } from 'meteor/ostrio:base64';
    const base64 = new Base64();
    
    base64.encode('My Plain String'); // Returns 'TXkgUGxhaW4gU3RyaW5n'
    
    // Async, non-blocking via WebWorker (if supported) at browser:
    base64.encode('My Plain String', (error, b64) => {
      // b64 === 'TXkgUGxhaW4gU3RyaW5n'
    });

    .decode()

    base64Instance.decode(base64EncodedString [, callback]);
    import { Base64 } from 'meteor/ostrio:base64';
    const base64 = new Base64();
    
    base64.decode('TXkgUGxhaW4gU3RyaW5n'); // Returns 'My Plain String'
    
    // Async, non-blocking via WebWorker (if supported) at browser:
    base64.decode('TXkgUGxhaW4gU3RyaW5n', (error, str) => {
      // str === 'My Plain String'
    });

    Constructor new Base64()

    import { Base64 } from 'meteor/ostrio:base64';
    new Base64({ allowWebWorker, useNative, supportNonASCII, ejsonCompatible });
    • opts.allowWebWorker {Boolean} – Default: false. Use WebWorker in a Browser if available;
    • opts.useNative {Boolean} – Default in Browser: false; Default on Server: true. Use native atob, btoa and Buffer.from, when available;
    • opts.supportNonASCII {Boolean} – Default: true. Decreases speed, but gives support for whole utf-8 table;
    • opts.ejsonCompatible {Boolean} – Default: false. Compatible mode with EJSON “binary” format, .encode() method will result as Uint8Array when ejsonCompatible is true.
    import { Base64 } from 'meteor/ostrio:base64';
    // Native with WebWorker
    const nativeB64 = new Base64({ allowWebWorker: true, useNative: true });
    
    // Native without WebWorker
    const mtNativeB64 = new Base64({ allowWebWorker: false, useNative: true });
    
    // Use main thread, no WebWorker
    const mtB64 = new Base64({ allowWebWorker: false });

    Default base64 package replacement

    1. Download base64-replacement package and place into meteor-app/packages directory, that’s it. Run meteor update to make sure new package is applied;
    2. In case of version incompatibility, change base64-replacement version, to the latest available on the mainstream channel;
    3. For more info see base64-replacement package

    100% Tests coverage

    1. Clone this package
    2. In Terminal (Console) go to directory where package is cloned
    3. Then run:
    # Default
    meteor test-packages ./
    
    # With custom port
    meteor test-packages ./ --port 8888

    Tests include synchronous, asynchronous and speed tests for Browser and NodeJS, for cases with/out the Native code and/or WebWorker usage.

    Support this project:

    Visit original content creator repository https://github.com/veliovgroup/meteor-base64
  • react-toast

    @hanseo0507/react-toast

    npm version npm downloads

    alt text

    Installation

    yarn add @emotion/react @emotion/styled framer-motion
    yarn add @hanseo0507/react-toast

    Example

    Demo

    // src/main.tsx
    import React from 'react';
    import ReactDOM from 'react-dom/client';
    
    import { ToastProvider } from '@hanseo0507/react-toast';
    
    import App from './App';
    
    ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
      <React.StrictMode>
        <ToastProvider>
          <App />
        </ToastProvider>
      </React.StrictMode>
    );
    import React from 'react';
    
    import { useToast } from '@hanseo0507/react-toast';
    
    function App() {
      const { toast } = useToast();
    
      return (
        <div>
          <button onClick={() => toast.info('Awesome Toast!')}>๐Ÿž Toast!</button>
        </div>
      );
    }
    
    export default App;

    Use Cases

    useToast

    import { ToastOptions, ToastPosition } from '@hanseo0507/react-toast';
    
    const options: ToastOptions = {
      position: ToastPosition.topRight,
      duration: 3000, // 3s
    };
    
    /// default
    toast({ emoji: '๐ŸŽ‰', emojiBackground: '#ECA0FF', text: 'Awesome Toast!' }, options);
    
    // with linear-gradient
    toast({ emoji: '๐ŸŽ‰', emojiBackground: ['#ECA0FF', '#778DFF'], text: 'Awesome Toast!' }, options);
    
    // linear-gradient with degree
    toast(
      { emoji: '๐ŸŽ‰', emojiBackground: ['70deg', '#ECA0FF', '#778DFF'], text: 'Awesome Toast!' },
      options
    );
    
    // Info Toast -> { emoji: "โ„น๏ธ", emojiBackground: "#A0C9F0" } will be set
    toast.info('Info Tost!', options);
    
    // Success Toast -> { emoji: "โœ…", emojiBackground: "#6AD76A" } will be set
    toast.success('Success Tost!', options);
    
    // Warning Toast -> { emoji: "๐Ÿšง", emojiBackground: "#F3E45C" } will be set
    toast.warn('Warning Tost!', options);
    toast.warning('Warning Toast!', options);
    
    // Error/Danger Toast -> { emoji: "๐Ÿšจ", emojiBackground: "#F3655C" } will be set
    toast.danger('Warning Tost!', options);
    toast.error('Warning Toast!', options);

    ToastProvider

    import { ToastProvider, ToastPosition } from '@hanseo0507/react-toast';
    
    <ToastProvider position={ToastPosition.topRight} duration={3000}>

    API Reference

    ToastOptions

    Required Key Type Default Value Description
    โŒ position ToastPosition ToastPosition.topRight Default toast position
    โŒ duration number 3000 Toast duration time (ms)
    Visit original content creator repository https://github.com/hanseo0507/react-toast
  • react-toast

    @hanseo0507/react-toast

    npm version npm downloads

    alt text

    Installation

    yarn add @emotion/react @emotion/styled framer-motion
    yarn add @hanseo0507/react-toast

    Example

    Demo

    // src/main.tsx
    import React from 'react';
    import ReactDOM from 'react-dom/client';
    
    import { ToastProvider } from '@hanseo0507/react-toast';
    
    import App from './App';
    
    ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
      <React.StrictMode>
        <ToastProvider>
          <App />
        </ToastProvider>
      </React.StrictMode>
    );
    import React from 'react';
    
    import { useToast } from '@hanseo0507/react-toast';
    
    function App() {
      const { toast } = useToast();
    
      return (
        <div>
          <button onClick={() => toast.info('Awesome Toast!')}>๐Ÿž Toast!</button>
        </div>
      );
    }
    
    export default App;

    Use Cases

    useToast

    import { ToastOptions, ToastPosition } from '@hanseo0507/react-toast';
    
    const options: ToastOptions = {
      position: ToastPosition.topRight,
      duration: 3000, // 3s
    };
    
    /// default
    toast({ emoji: '๐ŸŽ‰', emojiBackground: '#ECA0FF', text: 'Awesome Toast!' }, options);
    
    // with linear-gradient
    toast({ emoji: '๐ŸŽ‰', emojiBackground: ['#ECA0FF', '#778DFF'], text: 'Awesome Toast!' }, options);
    
    // linear-gradient with degree
    toast(
      { emoji: '๐ŸŽ‰', emojiBackground: ['70deg', '#ECA0FF', '#778DFF'], text: 'Awesome Toast!' },
      options
    );
    
    // Info Toast -> { emoji: "โ„น๏ธ", emojiBackground: "#A0C9F0" } will be set
    toast.info('Info Tost!', options);
    
    // Success Toast -> { emoji: "โœ…", emojiBackground: "#6AD76A" } will be set
    toast.success('Success Tost!', options);
    
    // Warning Toast -> { emoji: "๐Ÿšง", emojiBackground: "#F3E45C" } will be set
    toast.warn('Warning Tost!', options);
    toast.warning('Warning Toast!', options);
    
    // Error/Danger Toast -> { emoji: "๐Ÿšจ", emojiBackground: "#F3655C" } will be set
    toast.danger('Warning Tost!', options);
    toast.error('Warning Toast!', options);

    ToastProvider

    import { ToastProvider, ToastPosition } from '@hanseo0507/react-toast';
    
    <ToastProvider position={ToastPosition.topRight} duration={3000}>

    API Reference

    ToastOptions

    Required Key Type Default Value Description
    โŒ position ToastPosition ToastPosition.topRight Default toast position
    โŒ duration number 3000 Toast duration time (ms)
    Visit original content creator repository https://github.com/hanseo0507/react-toast
  • Predicting-Coup-Outcomes-in-R

    Can Big Data Predict Revolutions? An Investigation in R

    • Public dataset from the Cline Center at the University of Illinois, listing details of all known coups d’etat from the 1940s through 2004
    • Data is almost entirely “one-hot encoded” as binary values (1 or 0) describing categorical variables
    • New variables were constructed, e.g., decade, season
    • A second dataset consisting of country-by-country global economic history data was merged with coup data
    • Exploratory data analysis with correlations and visualizations
    • Two R scripts were created using only the Cline Center coup dataset to predict the following outcomes:
      • The success or failure of attempted coups
      • The violence or lack thereof of attempted coups
    • Another R script was created to predict coup events based on country-by-country economic indicators over time
    • Numerous machine learning algorithms were used to model these outcomes
      • Logistic regression
      • Stepwise forward selection of model features for logistic regression
      • Naive Bayes classification
      • Decision trees classification
      • Random Forest ensemble learning
    • Lastly, out-of-sample data on recent coups provides another, mostly successful, test of the models
    • The correlation matrix for coup success is visualized as follows:

    Visit original content creator repository https://github.com/pscharfe/Predicting-Coup-Outcomes-in-R
  • task-api

    Task Manager API

    API responsible for creating and managing tasks.

    Introduction

    The API itself is for study purposes, and aims to be a simple API for crud and task management, using Docker and Redis for more perfomatic queries.

    ๐Ÿ›  Main libraries used

    • pgxpool – A package from the pgx library, pgxpool provides a connection pool for PostgreSQL databases. It allows efficient management of database connections and helps in handling multiple concurrent requests to the database with reduced latency and resource consumption.

    • github.com/google/uuid – This library provides utilities for generating and working with UUIDs (Universally Unique Identifiers). It supports the creation of various types of UUIDs, including UUIDv1, UUIDv4, and UUIDv5, and is used to ensure unique identifiers in distributed systems and databases.

    • github.com/redis/go-redis/v9 – This is a Go client library for interacting with Redis, a popular in-memory data structure store. The go-redis library provides support for various Redis commands and features, including caching, pub/sub messaging, and data persistence, allowing Go applications to efficiently communicate with Redis servers.

    For a complete list of dependencies see the file go.mod.

    ๐Ÿš€ Development build

    To be able to run the project as a developer, follow the steps:

    • Clone the repository to your machine.
    • Remember to checkout the branch you are developing.

    From there you can run the following command to run the project and test the application

      docker-compose up --build

    That’s it, the API is running, be happy!

    Suport

    For support, please email me felipeversiane09@gmail.com

    Visit original content creator repository
    https://github.com/felipeversiane/task-api

  • nico.drive.client

    nico.drive.client

    This web application is a client for the nico.drive WebDAV server.
    It features a convenient yet visually appealing user interface to get the most of your Nico.Drive webDAV server.

    Features

    • Compatible with any WebDAV compliant server.
    • Browse you webDAV drive anywhere
    • Download files
    • Basic file details

    Exclusive nico’s drive server features

    When connected to a nico.drive webDAV server, the following additional features are available:

    • Displays image thumbnails thanks to the thumb REST API of nico.drive’s server.
    • Enhanced file meta-data from the nico.drive’s server REST API : image exif and xmp.
    • Download a directory contents in a ZIP archive.

    How-to use

    Nico’s drive web client is meant to be embedded into the nico.drive’s server. Just point your favorite browser on the
    web url of nico’s drive server and you should be asked for your credentials.

    However, if you want to use the latest version of the web interface you might want to serve nico’s drive client
    from a separated place. See deployment intructions below.

    To use the nico’s drive web client to connect to another WebDAV server, see deployment instructions below.

    Developer info

    Getting started

    • Get the code from GitHub
    • npm install
    • npm run start

    This will launch the development server for testing against you webdav server.

    Deployment

    • Get the code from GitHub
    • npm run build

    Then copy or embed the build directory on your production server.

    or

    • sudo npm install -g serve
    • serve -s dist

    More info : https://cra.link/deployment

    Visit original content creator repository
    https://github.com/hironico/nico.drive.client

  • mdns-alias

    Publish mDNS-SD Aliases

    This is a small C program that publishes mDNS CNAMEs using Avahi. It runs as a UNIX daemon, ensuring the CNAME records are published as long as the daemon runs.

    Currently the program takes its CNAME aliases on the command line:

    mdns-alias foo.local bar.local
    

    At least one name, including .local, must be given on the command line.

    Dependencies

    At run time: a running avahi-daemon

    Build time: avahi client library and header files, and to detect it, the pkg-config tool. You also need a C compiler and make.

    Ubuntu, Mint, or other Debian based Linux distributions:

    sudo apt install libavahi-client-dev pkg-config
    

    Building

    This project is built using configure and make. The configure script generates the Makefile for your host system, or your embedded target system. Usually setting --host=toolchain-prefix- is all you need for the configure script to find your cross compiler.

    ./configure
    make
    

    By default the configure script prepares for installing in /usr/local, if you want to change that, please see ./configure --help. To install type:

    sudo make install
    

    Some systems no longer have sudo, alternatives include su to root, or tools like doas.

    Note: if you do not like pre-packaged, and properly versioned, release tarballs, you need to have GNU autoconf and automake installed to be able run the autogen.sh script. It creates the configure script and Makefile template, which are included in the portable release tarballs.

    Motivation

    For some reason the de facto standard mDNS-SD daemon in Linux, Avahi, does not support CNAME (DNS alias) records in the configuration files or using any of its tools. This has been covered in many repos, but none did it better than George Hawkins, I believe.

    Visit original content creator repository https://github.com/troglobit/mdns-alias
  • KidVPN

    KidVPN

    The world’s smallest VPN server and client (For SylixOS and Linux).

    Configure File

    • Configure file is a ini format:

    keywords description
    mode KidVPN run mode, 'server' or 'client'
    key_file KidVPN AES Key file
    iv_file Cipher initial vector (Optional default use ECB)
    vnd_id Virtual network device ID (Only for SylixOS)
    tap_name Virtual network device name (Only for Linux)
    mtu 1280 ~ 1472 (Optional default: 1464)
    local_ip Local IP address (Only for Server)
    server Server IP address (Only for Client)
    port Local port (Optional default: 10088)
    hole_punching UDP Hole punching (Optional default: 0)

    * If too many client in one VPN net you can use UDP hole punching to reduce server forwarding pressure.

    • Server configure like this:

    [server_0]
    mode=server
    key_file=serv.key
    iv_file=serv.iv
    vnd_id=0
    tap_name=tap0
    mtu=1464
    local_ip=192.168.0.1
    port=10088
    • Client configure like this:

    [client_0]
    mode=client
    key_file=cli.key
    iv_file=cli.iv
    vnd_id=0
    tap_name=tap0
    mtu=1464
    server=123.123.123.123
    port=10088

    * KidVPN daemon allow dynamic update of IV parameters using SIGUSR1 signal.*

    For SylixOS

    • Step 1: Add vnd interface parameter in /etc/ifparam.ini

    [vnd-X]
    # X is a number of vnd ID)
    enable=1
    # Enable(up) this interface
    ipaddr=x.x.x.x
    # Virtual network ip address
    netmask=x.x.x.x
    # Virtual network netmask
    mac=xx:xx:xx:xx:xx:xx
    # Virtual network MAC address, If not, the system will use random numbers
    • Step 2: Use ‘vnd’ command add a virtual net device.

    vnd add X
    # X is a number of vnd ID
    • Step 3: Use ‘kidvpn’ to create a VPN connect.

    kidvpn x.ini sector password
    # 'x.ini' is vpn config file, 'sector' is ini sector which we will use, 'password' is password
    • Step 4: Use ‘route’ command add some route entry to system, make route rules.

    For Linux

    • Prepare for work:

    sudo apt-get install openssl
    # Install OpenSSL library
    
    sudo apt-get install libssl-dev
    # Install OpenSSL develop library
    
    make
    # Build kidvpn target
    • Step 1: Add tap interface

    sudo tunctl -t tapX -u root
    # X is tap number
    
    sudo ifconfig tapX up
    # Enable tapX network
    • Step 2: Use ‘ifconfig’ command set tapX address
    ifconfig tapX inet x.x.x.x netmask x.x.x.x
    • Step 3: Use ‘kidvpn’ to create a VPN connect.

    sudo ./kidvpn x.ini sector password
    # 'x.ini' is vpn config file, 'sector' is ini sector which we will use, 'password' is password
    • Step 4: Use ‘route’ command add some route entry to system, make route rules.

    Enjoy yourself ^_^

    Visit original content creator repository
    https://github.com/hanhui03/KidVPN

  • whois7

    Whois7

    Welcome to your new gem! In this directory, you’ll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/whois7. To experiment with that code, run bin/console for an interactive prompt.

    TODO: Delete this and the text above, and describe your gem

    Installation

    Add this line to your application’s Gemfile:

    gem 'whois7'

    And then execute:

    $ bundle
    

    Or install it yourself as:

    $ gem install whois7
    

    Usage

    TODO: Write usage instructions here

    Development

    After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

    To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

    Contributing

    Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/whois7.

    Visit original content creator repository
    https://github.com/vs-adm/whois7

  • Plataforma-HealtCare

    1. ๐Ÿค– Introduรงao
    2. โš™๏ธ Stack
    3. ๐Ÿ”‹ Funcionalidades
    4. ๐Ÿคธ Iniciar
    • Next.js
    • Appwrite
    • Typescript
    • TailwindCSS
    • ShadCN
    • Twilio

    ๐Ÿ‘‰ Register as a Patient: Users can sign up and create a personal profile as a patient.

    ๐Ÿ‘‰ Book a New Appointment with Doctor: Patients can schedule appointments with doctors at their convenience and can book multiple appointments.

    ๐Ÿ‘‰ Manage Appointments on Admin Side: Administrators can efficiently view and handle all scheduled appointments.

    ๐Ÿ‘‰ Confirm/Schedule Appointment from Admin Side: Admins can confirm and set appointment times to ensure they are properly scheduled.

    ๐Ÿ‘‰ Cancel Appointment from Admin Side: Administrators have the ability to cancel any appointment as needed.

    ๐Ÿ‘‰ Send SMS on Appointment Confirmation: Patients receive SMS notifications to confirm their appointment details.

    ๐Ÿ‘‰ Complete Responsiveness: The application works seamlessly on all device types and screen sizes.

    ๐Ÿ‘‰ File Upload Using Appwrite Storage: Users can upload and store files securely within the app using Appwrite storage services.

    ๐Ÿ‘‰ Manage and Track Application Performance Using Sentry: The application uses Sentry to monitor and track its performance and detect any errors.

    and many more, including code architecture and reusability

    Prerequisitos

    Instale na sua maquina

    Clone este repositorioi

    https://github.com/PhelipeG/Plataforma-HealtCare.git
    cd Plataforma-HealtCare
    

    Instalaรงao

    Instale as dependencias usando npm:

    npm install

    Configure as variaveis de ambiente

    crie um arquivo .env.local na pasta root do projeto contendo :

    #APPWRITE
    NEXT_PUBLIC_ENDPOINT=https://cloud.appwrite.io/v1
    PROJECT_ID=
    API_KEY=
    DATABASE_ID=
    PATIENT_COLLECTION_ID=
    APPOINTMENT_COLLECTION_ID=
    NEXT_PUBLIC_BUCKET_ID=
    
    NEXT_PUBLIC_ADMIN_PASSKEY=111111

    Rodando projeto

    npm run dev

    Abrir http://localhost:3000 no seu browser

    Visit original content creator repository https://github.com/PhelipeG/Plataforma-HealtCare