root at 16 Jul 2024 Computational Thinking

Computational Thinking, if you think about it (no pun intended) is incredibly simple and most of our daily lives follow some of the same rules. If you've done work in similar fields such as Science, Mechanics, Mathematics, etc you would've followed a similar way of thinking, if any.

The key components

  • Decomposition
    • Breaking down a complicated problem into smaller "tasks" or parts if you will. This therefore makes it far more manageable.
  • Pattern Recognition
    • This is where you observe patterns, trends and regularities within data. For example, customers' behaviour may be increased during specific seasons such as the summer, autumn, etc.
  • Abstraction
    • Abstraction is where you focus on only the important information, ignoring any irrelevant or anomalous data and/or information.
  • Algorithms
    • This is pretty self explanatory, this is where you develop step-by-step instructions or "rules" to solve a specific problem

    root at 07 Jul 2024 Self Hosting: Discord Bots

    Self Hosting discord bots isn't as hard as it seems. If you have an old laptop, some spare resources on a Virtual Private Server (or a VM), or a handy raspberry pi (even a RPI Zero W (W/H), etc would do the trick). Of course it all depends on which language you used to create your discord bot. Here are some common ones:

    1. JavaScript using Discord.js or TypeScript. You can also make one using deno (& JS/TS)
    2. Python using Discord.py
    3. C++ using the Discord API Wrapper for C++ called D++
    And many more. Each language is different and has their own requirements. For example, JavaScript required NodeJS, whereas python requires pip/pipx or something similar.

    Choosing an Operating System

    Personally I'd recommend Debian, or any other debian-based Linux Distribution, however you can achieve the same result on Windows, MacOS, and any other Linux Distribution. If you're using a raspberry pi, I'd recommend going with raspberry pi's own Linux Distro with no GUI (just the terminal interface).

    Make sure to properly set up your chosen Linux Distribution or Operating System before getting started.

    Bot Requirements

    Make sure to install your bot's requirements such as NodeJS, pip/pipx, D++, etc. You can also achieve the same result by using Docker and docker-compose. I'd recommend reading how to create your own docker images with DockerFile too since that would be extremely helpful. Using a docker container means you have complete control over your bot, and it is easy to start, keep online 24/7, etc. Panels such as the pterodactyl panel uses docker and "eggs" (which are basically more complicated dockerfiles in a way) to design the perfect environment for your bot.

    Getting Started

    If you haven't already I'd recommend uploading your files to a git repository so you can easily update your code, and quickly. Here I'll assume you're using Debian 12. The following is assuming you are already in the directory where a "bot.js" file is located:
    sudo apt-get install git nano nodejs \
                  \ sudo npm install -g pm2
                  \ pm2 start bot.js
    
    Please note: This is a rough guide, I'd recommend asking for more details in Spark's discord server. I'll release a more in-depth guide as soon as I can.

    Remember to learn the basics about Linux if you are using any Linux Distro to host your bot.

    © Jay Salway 2023-2024 | home, login