Author: 199opwmai497

  • stackly-ui

    Stackly

    Stackly is a Next.js Cloudflare mono repo project that implements Dollar Cost Averaging using CoW protocol.

    Prerequisites

    Before you can run this project, make sure you have the following software installed:

    • Node.js 18 or higher
    • Bun
    • Git

    Getting Started

    To get started with Stackly, follow these steps:

    1. Clone the repository:
    git clone https://github.com/SwaprHQ/stackly-ui.git
    
    1. Install the dependencies:

    cd stackly-ui
    bun install
    bun build:dev
    
    1. Start the development server:
    bun dev
    

    The development server will start at http://localhost:3000.

    Subgraph

    To update the subgraph.yaml, go to bin/build-subgraph.ts and update the subgraph json. This script will run before deployment to create a new subgraph.yaml.

    Make sure that, bin/config.ts is updated to reflect the latest changes for contract address and startBlock.

    To deploy the Subgraph, you need to run the following commands:

    bun build
    bun deploy
    

    Deployment

    To deploy the Stackly project to production, you can use the following command:

    bun build
    

    This command will create a production build of the project in the dist directory. You can then deploy the contents of this directory to your server or hosting provider.

    Supporting new chains

    1. Update the SDK.
      • You’ll need the following smart contract addresses in the target chain:
        • Stackly OrderFactory
        • Stackly DCAOrder singleton
        • Stackly TheGraph subgraph endpoint
        • CoW Protcol’s settlement address
      • Add that information in packages\sdk\src\vaults\constants.ts
      • cd packages/sdk
      • bun typechain
      • bun build
    2. Update the Subraph.
      • Go to packages\subgraph\bin\config.ts and update the config object with the Factory contract address and startBlock
      • Go to packages\subgraph\bin\build-subgraph.ts and update the SUPPORTED_NETWORKS variable
      • In packages\subgraph\package.json create the relevant build and prepare commands for the new chain
    3. Update the UI app
      • Create some tokens for the integrated chain in packages/app/models/token/tokens.ts
      • Add a default token pair for the chain in packages/app/utils/constants.ts
      • Update the WAGMI chains config in packages/app/providers/wagmi-config.ts with the chain info and a RPC
      • Add some common tokens for the new chain in packages/app/components/token-picker/constants.ts
    4. Try to create a new stack in the UI

    Code Guidelines

    React Contexts

    React Context checks values using simple equality (==). For that reason, we need to stabilize our contexts or we would be triggering a re-render for any update on Context values, even irrelevant changes. For that purpose, we use the useMemo() hook always for custom Contexts, as most of the time we will wrap the whole app with our custom Contexts and re-rendering might get really cumbersome at times.

    Troubleshooting

    • Unhandled Runtime Error for NextJS

      This usually happens on NextJS v13.2.4 and up, when you export a client component (using the "use client" directive) using a normal function. A quick fix for this bug is to turn the normal function into an arrow function.

    • app-index.js:31 Warning: Extra attributes from the server: data-new-gr-c-s-check-loaded,data-gr-ext-installed or similar

      This may happen due to different browser extensions like Grammarly and LanguageTool passing down extra attributes that will make a mismatch between server and client renders. Disabling/configuring the troublesome extensions to not run in the development ports (like port 3000) should fix this issue.

    • Cannot read properties of undefined (reading Component).

      This may happen due to circular dependencies between imports. Check if you have three or more components creating a circle of imports which may lead to a component being invoked before its initialization. A quick way to solve this would be to check the way you’re exporting the problematic component. Check packages/app/components/index.ts to see an example of how to solve these exports.

    • Error fetching generated/contracts.

      This may happen due to app build failures. Try deleting node_modules, then re-install and rebuild the app before launching it again. Note that if you don’t rebuild the app (bun build:app) you may get some errors due to generated code during the build step not being present.

      rm -rf node_modules
      bun install
      bun build:app
      bun dev

    Contributing

    We welcome contributions to Stackly! To get started, fork this repository and create a new branch for your changes.

    Before submitting a pull request, make sure that your code passes the linting and formatting checks:

    bun lint
    bun typecheck
    

    License

    Stackly is released under the MIT License. See the LICENSE file for more information.

    Visit original content creator repository

  • fem-social-proof-section-master

    Frontend Mentor – Social proof section solution

    This is a solution to the Social proof section challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

    Table of contents

    Overview

    The challenge

    Users should be able to:

    • View the optimal layout for the section depending on their device’s screen size.

    Screenshot

    Links

    My process

    I began mobile first and using a one Grid column, then I set the responsive expansion media query at 70rem. I created one header and two sections. One section was five star review section created with small cards using CSS Flexbox. The second section was a testimonial section with three cards. In mobile version everything stacked in one column. For desktop it was two columns.

    Built with

    • Semantic HTML5 markup
    • CSS custom properties
    • Flexbox
    • CSS Grid
    • Mobile-first workflow

    What I learned

    Primarily this project was aimed at furthering my CSS Grid skills. Placing cards within a container in a laddered/staggered way was tricky, I had to create multiple rows for one and multiple columns for the other section. What was cool was that in creating the container with multiple rows, implicit rows kicked in when I commented out my proposed solution! Also, I once again managed to create a sticky footer with the attribution within it. It stays at the bottom of the viewport no matter what. Also, I used a class to maintain a consistent width throughout each section.

    Below is an example of code to keep the content aligned and justified centrally. This works well.

    .container {
      min-height: 100vh;
      max-width: 36rem;
      margin: 4rem auto;
      background: var(--clr-secondary-3-white);
    }

    Below is the CSS Grid for the five star review section with multiple columns to make a laddered/staggered effect. This was created for the desktop version with media query set at 70rem, as mobile version only required cards to be stacked.

    .five-star-reviews {
      padding: 4rem 0 2rem 0;
      display: grid;
      grid-template-columns: repeat(15, 1fr);
      max-height: 20rem;
    }

    Continued development

    This is my third project using CSS Grid. It was more complex than the last couple and took a bit research. I am going to continue focusing on learning Grid and Javascript simultaneously.

    Useful resources

    Author

    Acknowledgments

    Thanks to Florin.Porut06, Daniel Moraes Mariz, and AlexKMarshall in the Frontend Mentor community for answering my questions.

    Visit original content creator repository
  • WebUI-API

    MMRL JavaScript Library for WebUI

    This is a JavaScript library designed to provide an interface for interacting with the MMRL environment. It includes classes and types to facilitate the integration and manipulation of MMRL objects.

    Table of Contents

    Installation

    To install MMRL-V4, clone the repository and install the dependencies:

    npm install mmrl

    Usage

    Types

    The types.ts file defines various types used throughout the library:

    export type Scope = `$${string}`;
    export type ObjectScope = Scope | object;
    export type MimeType = `${string}/${string}`;
    
    export interface Manager {
        name: string;
        versionName: string;
        versionCode: number;
    }

    MMRLObjectAccessor

    The MMRLObjectAccessor class provides a base class for accessing MMRL objects. It handles the parsing of the scope and provides utility methods for interacting with the MMRL environment.

    Example usage:

    import { MMRLObjectAccessor } from "mmrl";
    
    const accessor = new MMRLObjectAccessor("net-switch");
    console.log(accessor.interface);

    MMRLInterface

    The MMRLInterface class extends MMRLObjectAccessor to provide additional functionality specific to MMRL. It includes methods for injecting stylesheets, accessing manager information, and interacting with the MMRL environment.

    Example usage:

    import { MMRLInterfaceFactory } from "mmrl";
    
    const mmrl = MMRLInterfaceFactory("net-switch");
    mmrl.injectStyleSheets();
    console.log(mmrl.manager);

    FileSystem

    The FileSystem class provides methods for interacting with the file system within the MMRL environment. It includes methods for reading, writing, and deleting files.

    Example usage:

    import { FileSystem } from "mmrl";
    
    const fs = new FileSystem("net-switch");
    fs.write("example.txt", "Hello, MMRL!");
    const content = fs.read("example.txt");
    console.log(content);
    fs.delete("example.txt");

    VersionInterface

    The VersionInterface class provides access to version information about the MMRL environment. It includes properties for application and root configuration details.

    Example usage:

    import { mmrl } from "mmrl";
    
    console.log(mmrl.app.versionName);
    console.log(mmrl.root.platform);

    Toast

    The Toast class provides methods for creating and displaying native toast notifications within the MMRL environment. It includes methods for setting text, duration, gravity, and showing or canceling the toast.

    Example usage:

    import { Toast } from "mmrl";
    
    const toast = Toast.makeText("Hello, MMRL!", Toast.LENGTH_LONG);
    toast.show();

    Visit original content creator repository

  • educationDataApp

    Getting Started with Create React App

    This project was bootstrapped with Create React App.

    Available Scripts

    In the project directory, you can run:

    npm start

    Runs the app in the development mode.
    Open http://localhost:3000 to view it in your browser.

    The page will reload when you make changes.
    You may also see any lint errors in the console.

    npm test

    Launches the test runner in the interactive watch mode.
    See the section about running tests for more information.

    npm run build

    Builds the app for production to the build folder.
    It correctly bundles React in production mode and optimizes the build for the best performance.

    The build is minified and the filenames include the hashes.
    Your app is ready to be deployed!

    See the section about deployment for more information.

    npm run eject

    Note: this is a one-way operation. Once you eject, you can’t go back!

    If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

    Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

    You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

    Learn More

    You can learn more in the Create React App documentation.

    To learn React, check out the React documentation.

    Code Splitting

    This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

    Analyzing the Bundle Size

    This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

    Making a Progressive Web App

    This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

    Advanced Configuration

    This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

    Deployment

    This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

    npm run build fails to minify

    This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

    Visit original content creator repository

  • fm–time-tracking-dashboard

    Frontend Mentor – Time tracking dashboard

    Design preview for the Time tracking dashboard coding challenge

    Welcome! 👋

    Thanks for checking out this front-end coding challenge.

    Frontend Mentor challenges help you improve your coding skills by building realistic projects.

    To do this challenge, you need a basic understanding of HTML, CSS and JavaScript.

    The challenge

    Your challenge is to build out this dashboard and get it looking as close to the design as possible.

    You can use any tools you like to help you complete the challenge. So if you’ve got something you’d like to practice, feel free to give it a go.

    If you would like to practice working with JSON data, we provide a local data.json file for the activities. This means you’ll be able to pull the data from there instead of using the content in the .html file.

    Your users should be able to:

    • View the optimal layout for the site depending on their device’s screen size
    • See hover states for all interactive elements on the page
    • Switch between viewing Daily, Weekly, and Monthly stats

    Want some support on the challenge? Join our community and ask questions in the #help channel.

    Expected behaviour

    • The text for the previous period’s time should change based on the active timeframe. For Daily, it should read “Yesterday” e.g “Yesterday – 2hrs”. For Weekly, it should read “Last Week” e.g. “Last Week – 32hrs”. For monthly, it should read “Last Month” e.g. “Last Month – 19hrs”.

    Where to find everything

    Your task is to build out the project to the designs inside the /design folder. You will find both a mobile and a desktop version of the design.

    The designs are in JPG static format. Using JPGs will mean that you’ll need to use your best judgment for styles such as font-size, padding and margin.

    If you would like the design files (we provide Sketch & Figma versions) to inspect the design in more detail, you can subscribe as a PRO member.

    You will find all the required assets in the /images folder. The assets are already optimized.

    There is also a style-guide.md file containing the information you’ll need, such as color palette and fonts.

    Building your project

    Feel free to use any workflow that you feel comfortable with. Below is a suggested process, but do not feel like you need to follow these steps:

    1. Initialize your project as a public repository on GitHub. Creating a repo will make it easier to share your code with the community if you need help. If you’re not sure how to do this, have a read-through of this Try Git resource.
    2. Configure your repository to publish your code to a web address. This will also be useful if you need some help during a challenge as you can share the URL for your project with your repo URL. There are a number of ways to do this, and we provide some recommendations below.
    3. Look through the designs to start planning out how you’ll tackle the project. This step is crucial to help you think ahead for CSS classes to create reusable styles.
    4. Before adding any styles, structure your content with HTML. Writing your HTML first can help focus your attention on creating well-structured content.
    5. Write out the base styles for your project, including general content styles, such as font-family and font-size.
    6. Start adding styles to the top of the page and work down. Only move on to the next section once you’re happy you’ve completed the area you’re working on.

    Deploying your project

    As mentioned above, there are many ways to host your project for free. Our recommended hosts are:

    You can host your site using one of these solutions or any of our other trusted providers. Read more about our recommended and trusted hosts.

    Create a custom README.md

    We strongly recommend overwriting this README.md with a custom one. We’ve provided a template inside the README-template.md file in this starter code.

    The template provides a guide for what to add. A custom README will help you explain your project and reflect on your learnings. Please feel free to edit our template as much as you like.

    Once you’ve added your information to the template, delete this file and rename the README-template.md file to README.md. That will make it show up as your repository’s README file.

    Submitting your solution

    Submit your solution on the platform for the rest of the community to see. Follow our “Complete guide to submitting solutions” for tips on how to do this.

    Remember, if you’re looking for feedback on your solution, be sure to ask questions when submitting it. The more specific and detailed you are with your questions, the higher the chance you’ll get valuable feedback from the community.

    Sharing your solution

    There are multiple places you can share your solution:

    1. Share your solution page in the #finished-projects channel of the community.
    2. Tweet @frontendmentor and mention @frontendmentor, including the repo and live URLs in the tweet. We’d love to take a look at what you’ve built and help share it around.
    3. Share your solution on other social channels like LinkedIn.
    4. Blog about your experience building your project. Writing about your workflow, technical choices, and talking through your code is a brilliant way to reinforce what you’ve learned. Great platforms to write on are dev.to, Hashnode, and CodeNewbie.

    We provide templates to help you share your solution once you’ve submitted it on the platform. Please do edit them and include specific questions when you’re looking for feedback.

    The more specific you are with your questions the more likely it is that another member of the community will give you feedback.

    Got feedback for us?

    We love receiving feedback! We’re always looking to improve our challenges and our platform. So if you have anything you’d like to mention, please email hi[at]frontendmentor[dot]io.

    This challenge is completely free. Please share it with anyone who will find it useful for practice.

    Have fun building! 🚀

    Visit original content creator repository

  • chartopia

    Maven Central Version Kotlin Compose gradle-version License

    Website X/Twitter


    Black background White background


    Chartopia

    Chartopia is a Kotlin/Compose Multiplatform library that provides a variety of customizable charts to visually represent data.


    Be sure to show your support by starring ⭐️ this repository, and feel free to contribute if you’re interested!


    🌟 Features

    • 🍩 DonutChart: A circular chart for visualizing proportional data, with smooth animations and extensive customization options. Add a list of segments to represent categories, making it perfect for percentages or distribution comparisons.
    • 📈 LineChart: A versatile chart for displaying trends and patterns, fully customizable with animated transitions. Supports multiple lines on the same chart, enabling clear and effective comparisons of different datasets on shared axes.

    🛠️ Installation

    Add the dependency in your common module’s commonMain sourceSet:

    In your settings.gradle.kts file, add Maven Central to your repositories:

    repositories {
        mavenCentral()
    }

    Then add Chartopia dependency to your module:

    • With version catalog, open libs.versions.toml:
    [versions]
    chartopia = "2.0.0" // Check latest version
    
    [libraries]
    chartopia = { group = "io.github.tweener", name = "chartopia", version.ref = "chartopia" }

    Then in your module build.gradle.kts add:

    dependencies {
        implementation(libs.chartopia)
    }
    • Without version catalog, in your module build.gradle.kts add:
    dependencies {
        val chartopia_version = "2.0.0" // Check latest version
    
        implementation("io.github.tweener:chartopia:$chartopia_version")
    }

    The latest version is: Maven Central Version

    🧑‍💻 Usage

    🍩 Donut chart

    A DonutChart requires a list of Segments, with the first segment starting from the given startAngleFromOrigin in degrees. Each segment is defined by an angle, its color and an optional progress option.

    See .degrees to easily use float angles in degrees.

    val green = Color(0xFF04C700)
    val orange = Color(0xFFFF8850)
    val red = Color(0xFFFF3434)
    val darkRed = Color(0xFFA40000)
    val yellow = Color(0xFFFFF534)
    val darkYellow = Color(0xFF746F0E)
    val blue = Color(0xFF3437FF)
    
    DonutChart(
        segments = listOf(
            Segment(angle = 40f.degrees, progress = 0.33f, baseColor = green),
            Segment(angle = 20f.degrees, progress = 0.7f, baseColor = yellow, backgroundColor = darkYellow),
            Segment(angle = 90f.degrees, progress = 0.66f, baseColor = green),
            Segment(angle = 60f.degrees, progress = 0.7f, baseColor = red, backgroundColor = darkRed),
            Segment(angle = 50f.degrees, progress = 0.8f, baseColor = orange),
            Segment(angle = 100f.degrees, progress = 1f, baseColor = blue),
        ),
        startAngleFromOrigin = 270f.degrees,
        sizes = DonutChartDefault.chartSizes(strokeWidth = 12.dp, selectedStrokeWidth = 22.dp),
        animationDurationMillis = 800,
    )

    This code gives the following output:

    📈 Line chart

    A LineChart is a versatile chart used to visualize data points connected by straight or curved lines. It is ideal for displaying trends, relationships, or changes over time.

    LineChart(
        modifier = Modifier
            .fillMaxWidth()
            .height(200.dp),
        lines = lines,
        xAxis = xAxis,
        yAxis = yAxis,
        textStyle = MaterialTheme.typography.labelLarge,
        gridVisibility = LineChartDefaults.gridVisibility(
            showXAxis = true,
            showYAxis = true,
        ),
        colors = LineChartDefaults.chartColors(
            xAxisValues = MaterialTheme.colorScheme.onBackground,
            xAxisGrid = MaterialTheme.colorScheme.outline,
            yAxisValues = MaterialTheme.colorScheme.onBackground,
            yAxisGrid = MaterialTheme.colorScheme.outline,
        ),
        sizes = LineChartDefaults.chartSizes(
            axisStrokeWidth = 1.dp,
            axisDashOn = 8.dp,
            axisDashOff = 8.dp,
            axisXValuesPadding = Size.Padding.Small,
            axisYValuesPadding = Size.Padding.ExtraSmall,
        )
    )

    Some examples of output with straight or curved lines:

    linechart


    👨‍💻 Contributing

    We love your input and welcome any contributions! Please read our contribution guidelines before submitting a pull request.


    🙏 Credits


    📜 Licence

    Chartopia is licensed under the Apache-2.0.

    Visit original content creator repository
  • youchat-google-extension

    YouChat for Google

    Chrome Web Store Add-on Firefox Add-on

    A browser extension to display YouChat response – like ChatGPT, but with knowledge of recent events and source citation – alongside Google and other search engines results, supports Chrome/Edge/Firefox

    Supported Search Engines

    Google, Baidu, Bing, DuckDuckGo, Brave, Yahoo, Naver, Yandex, Kagi, Searx

    Screenshot

    Screenshot

    Why YouChat?

    YouChat has some advantages over ChatGPT:

    • Does not need login
    • Knows about recent events
    • Cites sources
    • Faster response time

    Screenshot

    However, YouChat does not provide answers as elaborate as ChatGPT. The best way may be to run it alongside the ChatGPT extension on which this project based, as shown above! Note this is an unofficial implementation and YouChat is not affiliated with this project.

    Installation

    Install to Chrome/Edge/Brave/Opera

    Notice: Brave/Opera users please follow Troubleshooting section after install

    Install from Chrome Web Store (Preferred)

    Chrome Web Store Link

    Local Install

    1. Download chromium.zip from Releases.
    2. Unzip the file.
    3. In Chrome/Edge go to the extensions page (chrome://extensions or edge://extensions).
    4. Enable Developer Mode.
    5. Drag the unzipped folder anywhere on the page to import it (do not delete the folder afterwards).

    Install to Firefox

    Install from Mozilla Add-on Store (Preferred)

    Mozilla Add-ons Store Link

    Local Install

    1. Download firefox.zip from Releases.
    2. Unzip the file.
    3. Go to about:debugging, click “This Firefox” on the sidebar.
    4. Click “Load Temporary Add-on” button, then select any file in the unzipped folder.

    Build from source

    1. Clone the repo
    2. Install dependencies with npm
    3. npm run build
    4. Load build/chromium/ or build/firefox/ directory to your browser

    Troubleshooting

    Answer errors

    You may try a few steps to fix the errors:

    • Make sure to pass the Cloudflare challenge here.
    • When passing the challenge, remember to reload the page.
    • you.com may have implemented a login system; if this is the case you may login here.
    • If nothing works: you.com sometimes changes their API, in this case you may try to fix the extension yourself (see below) or wait for an update (please report the issue here).

    API changes

    An API change happens when the request URL or the response format changes. For instance, as of February 2023, an example request is as follows: https://you.com/api/streamingSearch?q=hi&domain=youchat . If you.com changes their API, you may try to fix the extension yourself by following these steps:

    • Open you.com and go into the chat. You will need to login first.
    • Open the developer tools (F12) and go to the Network tab.
    • Submit your query and look for a request to the API.
    • Modify it and strip it down to the bare minimum until it works. At this point, you can modify this line to point to your modified request.

    How to make it work in Brave

    Screenshot

    Disable “Prevent sites from fingerprinting me based on my language preferences” in brave://settings/shields

    How to make it work in Opera

    Screenshot

    Enable “Allow access to search page results” in the extension management page

    Credit

    This project is heavily based on wong2/chat-gpt-google-extension, give it a try – you can even use both YouChat and ChatGPT at the same time! Also: ZohaibAhmed/ChatGPT-Google

    Contributing

    Feel free to open an issue or pull request if you have any questions or suggestions!

    Visit original content creator repository
  • Turing-Machine-Simulator

    FLP-PROJECT 2020 – LOGICAL PROJECT – TURING MACHINE

    EXAMPLE OF THE USAGE

    • BUILD: make
    • EXAMPLE RUN: make run
    • ARBITRARY RUN: ./flp20-log < /tests/04.in

    PROGRAM DESCRIPTION

    A program implements the simulation of the non-deterministic Turing Machines.
    The program reads the transitions and initial content of the machine tape
    from the standard input. The transitions have to be in the required following
    format: State, Symbol, NewState, NewSymbol, where State and NewState are
    in the range [A-Z], Symbol and NewSymbol are within the range [a-z],
    or they can be also space, which represents the blank symbol on the
    machine tape. Moreover, the NewSymbol can be equal to L or R, which
    represents the shift of the machine head to the left or right. The states
    S and F represents the starting respectively the finish state of the
    given machine. The initial content of the machine tape has to be symbols
    within the range [a-z] and it has to be in the last line of the input.
    The example inputs you can find in the test directory, respectively in
    the *.in files.

    IMPLEMENTATION

    In the beginning, the given input is loading and subsequently, it is stored
    to the internal representation. We note, when some transition has not the
    required format, then it will ignore during the simulation of the given
    machine. The correctly loaded transitions are storing to the database before
    the start of the simulation (transition). Into the database is also stored
    the initial configuration, which consists of the initial state S and
    given initial content of the machine tape (paths). In the first step, the
    simulation finds all firing transitions from this configuration. Subsequently,
    these transitions are fired and are constructed the new reachable
    configurations. These newly constructed configurations are appended to the
    stored paths in the database. After the first step will be in the database
    stored only the paths with the length equal to two. When some newly
    constructed configuration includes the final state F, then the computation
    halts, otherwise, the next step is performed for these configurations.
    Thus, in this way, after each step, we obtain all reachable configurations
    after the relevant number of performed transitions, and in the database
    will be stored the paths from the initial configuration to these reachable
    configurations. In this iterative way, we will research all reachable
    computation paths, and we are so guaranteed that if there is any path to
    the final state F, the simulation will find it. At the end of the
    computation, when was founded path to the final state, then it is written
    out to the standard output.

    END OF THE SIMULATION

    The simulation of the computation of the Turing Machine can terminate in the
    following different way. When exists the path from the initial configuration
    to the configuration which including the final state, then it will be found
    and write out to the standard output. When such the path does not exist
    and the machine does not offer any other fireable transitions, then
    the computation will halt with the message about the abnormally stopping.
    To this option also belongs the not allowed the shift of the machine head
    to the left outside the machine tape. The last possibility is that the
    machine contains an infinite path where infinitely many transitions are
    fired, in which case the simulation does not end spontaneously.

    AUTOMATION TESTS

    The test directory contains the shell script that serves
    to automatic testing the correctness of this program. In total, the
    test directory includes 13 different inputs, which are considered
    to various aspects of the simulation such as possible infinite iterating
    when the final path exists (test_10), potential delta symbols within
    transitions (test_6) or inputs that do not include the finite
    final paths (test_3), and much more. To run the shell script
    you can use the following command:

    make test
    

    The output will be contained the resulting summaries from tested suites.
    When some test is not successful, then is also printed the expected
    solution in comparison to the solution generated by the program.

    RUNNING TIMES

    We list the run-times of the simulation at the individual testing
    inputs from the attached directory:

    • 01: 0.080s (2); 02: 0.071s (4); 03: 0.066s (e)
    • 04: 0.083s (8); 05: 0.056s (5); 06: 0.066s (4)
    • 07: 0.054s (5); 08: 0.086s (e); 09: 2.814s (35)
    • 10: 0.069s (8); 11: 0.061s (4); 12: 0.065s (8)
    • 13: 0.055s (e)

    Visit original content creator repository

  • College-Major-Recommender

    College-Major-Recommender

    Many high school students run into a dilemma upon graduation. They don’t know where to even begin when trying to select a college major.
    And it is not just graduating high school students; according to the National Center for Education Studies, 30% of college students in
    undergraduate programs had changed their major at least once and 10% of undergraduate students changed their major two or more times.

    In order to help these student make better, well informed decisions, our group has set out to create a tool to aid in this decision making
    process.

    Programming language

    R

    Authors

    • Kai-Duan Chang
    • Li-Ci Chuang
    • Sri Manogna Gurijala
    • Ryan Egbert
    • Meghan Harris

    About the Shinyapp

    The app contains both descriptive and predictive analysis.

    On the first two pages (Explore and Compare), the user can see many different charts and graphs that explain what is going on with the data. A user can compare the rates between salary and employment rate, for example.

    Another thing the user will be able to do is receive a recommendation for which college major category they should select. This is followed up by a list of majors in that category for the user to select from.

    Shinyapps.io Link

    https://regbert.shinyapps.io/college-major-recommender/

    Presentation link

    https://www.youtube.com/watch?v=c2F5gqk18QQ

    Conclusion

    With our Shiny app, students have a guide that helps them choose a college major based on their actual
    interests. While we can’t say for a fact that our Shiny app rivals the combined 1.8 billion google results from
    “What should my major be?”, we firmly believe our project is a great starting place in tackling this challenging
    question.

    References

    We based our Shiny app on Zimin Luo’s and Lasha Gochiashvili’s project “Graduate Employment in
    Singapore” to build our UI from. We really thought their GUI design was perfect for how we wanted our
    interface to be for our project.

    Visit original content creator repository

  • dailyge-infra



    Dailyge Infra 저장소 입니다.
    서비스 소개는 해당 링크를 참조해주세요. 😃

    Release Release
    Release


    Table of Contents.

    1. Skills
    2. CI/CD
    3. Architecture
    4. Contents
    5. Modules


    1. Skills.

    서비스 구축을 위해 AWS를 활용했으며, Terraform을 사용해 자원을 프로비저닝 했습니다. Terraform으로 관리되는 자원은 Route53, CloudFront, S3, ALB, ECS, EC2(Application), RD 이며, 일부 자원들은 설치형으로 사용하고 있습니다. 모니터링은 Prometheus와 Grafana를 사용하고 있으며, 운영 및 시스템 로그는 모두 AWS CloudWatch로 관리하고 있습니다.

    image

    운영 과정에서 발생하는 이슈는 Grafana Alert 또는 AWS Lambda를 통해 슬랙으로 보고받고 있으며, Lambda와 같은 일부 서비스는 Python을 사용 중입니다.


    2. CI/CD

    PR이 생성되면 자동으로 정적 분석을 시작하며, Slack으로 결과를 보고받습니다. 팀원 간 코드 리뷰를 거친 후, dev 브랜치로 병합이 되면 개발 서버로 배포가 되며, 인수 테스트가 시작됩니다. 자동 인수 테스트 외에도 QA를 진행하며 기능의 동작 유무, 버그 리포팅을 합니다. main 브랜치로 병합이 되면 상용 서버로 배포가 되며, 최종 결과를 보고받습니다.

    image


    테스트, 배포 결과 및 비용은 슬랙을 통해 확인하고 있습니다.

    image


    3. Architecture

    정적 자원은 S3와 CloudFront를, 서버 오케스트레이션은 AWS ECS를 사용했습니다. 각 리소스는 VPC 내부 별도의 서브넷(Public/Private)에 존재하며, ALB와 NAT를 통해 외부와 통신합니다. 부하 테스트를 할 때는 terraform을 통해 서버를 동적으로 확장하고 있으며, 평상시에는 최소 인스턴스만 사용하고 있습니다.

    image


    서브 도메인을 적극 활용하고 있으며, 서브 도메인 간 쿠키를 공유해 사용하고 있습니다. 개발 서버, 모니터링 서버와 같은 서브 도메인에 대한 접근은 WAF 및 Security Group으로 관리하고 있습니다.


    4. Contents

    1. Resource 관리
    2. Config 관리
    3. Server
    4. RateLimiter
    5. Monitoring
    6. Log
    7. DB 백업


    4-1. Resource 관리

    프로비저닝을 후, 변경될 일이 적은 자원 들, 데이터베이스같이 변경되어선 안 되는 자원 들은 ignore_changes를 통해 테라폼 라이프사이클에서 제외한 후, 관리하고 있습니다.

    resource "aws_cloudfront_distribution" "s3_distribution_tasks_dev" {
      
      ......
    
      lifecycle {
        ignore_changes = all
      }
    }


    4-2. Config 관리

    Git Submodule과 AWS Secret Manager를 사용해 환경 변수를 관리하고 있습니다.

    image


    외부에 노출되는 값들은 암호화된 상태로 노출됩니다.

    env:
      dev
    
    profile:
      email: ENC(EoatZjyTeks503/9neDp3JfrFlhWwAiRvlYd77599hM=)
      nickname: ENC(VA1R4pL0mo0xHTfV68j+3xQrJbffCBTb)
    
    spring:
      cloud:
        aws:
          region:
            static: ap-northeast-2
          credentials:
            access-key: ENC(5vaRGdYWZUJsFEFF5P8A06TkwwNl5eapE)
            secret-key: ENC(JdK2itnFEFDKOdRu7A7zcXmLpOZwbSEWRUwq)
      liquibase:
        enabled: true
        change-log: db/rdb/changelog/changelog-master.yaml
      datasource:
        url: ENC(qmiZS71LFX29baI8nNpBKhLlLmsJop5vaRGdYWZUJsFEFF5P8A06TkwwNl5eapyY6/vlVdD6zCLkE8qlJdK2itnMByBKOdRu7A7zcXmLpOZwbSEWRUwqGbRvspsUPEFO/sS0PAqBF25vddL6GJ11onkUFqJZ0hPJt3Qr6toHqXcTH7yZNHlrTMLb2xrPlWU)
        username: ENC(KHdUpehLSIMFEEyDjj8P/+w==)
        password: ENC(/KquPoFfhpYAFEFSsumXHPpsdkquc4M)
        driver-class-name: com.mysql.cj.jdbc.Driver
    
        ......
    


    4-3. Server

    리소스 및 오토 스케일링을 조금 더 세밀하게 제어하기 위해 Fargate 대신 EC2를 사용하고 있으며, 배포 및 포트 충돌 방지를 위해 ECS 동적 포트를 사용하고 있습니다.

    image


    4-4. RateLimiter

    Route53에서 WAF로 일정 시간 동안 최대 사용자 요청을 제한하고 있으며, 모니터링 서버, 관리자 API 등 특정 리소스에 대한 접근은 ALB와 WAF, Security Group으로 제한하고 있습니다.

    image

    평소에는 분당 1,000회 이상일 때, IP 기반으로 API 요청 제한을 걸고 있으며, 부하 테스트를 할 때, 이를 해제합니다.


    4-5. Monitoring

    모니터링은 Prometheus와 Grafana를 CloudWatch와 연동해 사용하고 있으며, 이를 통해 알림을 받고 있습니다. 모니터링 중인 리소스는 EC2 서버, 애플리케이션 지표, RDS, Redis, MongoDB이며, CPU/메모리 사용률, Slow Query 등을 체크하고 있습니다.

    image

    애플리케이션이 다운될 경우, 자동으로 힙 덤프를 생성한 후, 이를 정적 저장소로 업로드하고 알림을 보내고 있습니다.


    오토 스케일링은 CPU 사용률이 75% 이상일 때, 1분 이상 지속되면 동작합니다. 이는 CloudWatch와 연동하고 있으며, 이 부분은 테라폼이 아닌 설치형으로 관리하고 있습니다.

    resource "aws_appautoscaling_policy" "dailyge_api_scale_out_policy" {
      name               = "dailyge-api-scale-out-policy"
      policy_type        = "TargetTrackingScaling"
      resource_id        = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.resource_id
      scalable_dimension = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.scalable_dimension
      service_namespace  = aws_appautoscaling_target.dailyge_api_ecs_scaling_target.service_namespace
    
      target_tracking_scaling_policy_configuration {
        target_value = 75.0
    
        predefined_metric_specification {
          predefined_metric_type = "ECSServiceAverageCPUUtilization"
        }
    
        scale_in_cooldown  = 60
        scale_out_cooldown = 60
      }
    }


    4-6. Log

    당일 로그는 CloudWatch로 관리하고 있으며, 하루가 지난 로그는 S3로 전송 후, 제거하고 있습니다.

    {
        "server": "dailyge-api",
        "path": "/api/monthly-tasks",
        "method": "POST",
        "traceId": "40cfde91-c912-4f3a-9b02-d45b3c066edb",
        "ip": "127.0.0.1",
        "layer": "ENTRANCE",
        "visitor": "{ "userId":null, "role":"GUEST" }",
        "time": "2024-08-06T07:29:48.745",
        "duration": "0ms",
        "context": {
            "args": null,
            "result": null
        }
    }

    로그는 요청 경로, 메서드, IP 주소(Origin), 파라미터, 응답 시간 등을 남기고 있습니다.


    4-7. DB 백업

    데이터베이스는 매일 새벽 3시마다 스냅샷을 생성해 백업하고 있습니다.

    데이터베이스 생성 후, AWS UI를 통해 설정을 관리하고 있으며, Import를 통해 싱크를 맞추고 있습니다.


    5. Modules

    modules 내부에 개발 환경을 기준으로 파일을 구분하고 있습니다. 명시적으로 dev, prod 패키지를 나누었지만, 프로젝트 규모가 작기 때문에 dev 하나만 사용하고 있습니다.

    $ tree -L 5
    .
    ├── dev
    │   ├── graph.png
    │   ├── main.tf
    │   ├── modules
    │   │   ├── acm
    │   │   ├── cloudfront
    │   │   │   ├── main.tf
    │   │   │   ├── outputs.tf
    │   │   │   └── variables.tf
    |
    │   ......
    |
    │   ├── provider.tf
    │   └── variables.tf
    
         ......
    

    Atlantis는 별도의 서버가 필요하기 때문에, 프로젝트 규모를 고려해 사용하지 않았습니다.

    Visit original content creator repository