teleren/devto huggingface dataset:
Language Model Level of Truth
Published: 2024-06-30 18:40:17

Many of us knows that -in rough words- LLMs "just" forecast next word. They have been fine tuned after gathering a pretrained model unless you have a Big Tech to: have enough level of computation, then build your own pretrained model from a tokenized corpus, then fine tune it, then deploy it for finally serving it hot just right out from the ouven ready to eat.

One of the big problems now are hallucinations and let's say it, LIES. Because a model will never say you "I don't know". They know it all even if they do not. So I'm interested on finding a way to verify and guarantee a safe level of true of a LLM with a low rate of hallucinations. Them are good when brainstorming but bad in most of the cases.

The pros will be a lot. To mention just one is that, in an age when agentic programming is an incipient area, is very often when we might need a "true checker" so as in conventional programming is done for example, by the argument inside an If-instruction works.


Because when we develope, compile and execute code at any deterministic turing machine, we know that the processor will tell us the truth.

I think this area of research is as amazing as difficult. Some approaches over there? If you are interested on that Contact Me or post here.
Customize Filament Table Query
Tags: php, laravel, filamentphp, tailwindcss
Published: 2024-06-30 18:32:44

I am going to share how you can customize the query applying filters, this tip has a meilisearch example borrowed as I found the tip in a laracast chat, the content was enriched by me.

To customize the table search to use some Laravel Scout Driver to get a fuzzyness search or a more powerful search in terms of speed:

## The Inline Way

```php
// filter criteria
$filter = '(status = Active) AND (type = big)';

// $this->query is a prop provided by extending from filament resource class
$company_ids = \App\Models\Company::search($this->query, function (\Meilisearch\Endpoints\Indexes $meilisearch, $query, $options) use($filter) {
    // This is a custom configuration for Meilisearch only
    $options['facets'] = ['type','status'];
    $options['filter'] = $filter;
    $options['hitsPerPage'] = 100;
    return $meilisearch->search($query, $options);
})->get()->pluck('id');
        
return $table
    ->query(\App\Models\Company::whereIn('id', $company_ids))
    ->columns([
        TextColumn::make('name')->sortable(),
        TextColumn::make('status')->sortable(),
        TextColumn::make('type')->sortable()
    ])
```

## The Override Way

We can also override the `getEloquentQuery` method, like this example removing a global scope for soft deletes:

```php
public static function getEloquentQuery(): Builder
{
    return parent::getEloquentQuery()
        ->withoutGlobalScopes([SoftDeleted::class])
        ->with(['products']);
}
```
Enable Auto Shutdown Schedule in Windows 11!
Tags: beginners, devops, windows, task
Published: 2024-06-30 18:30:00

Here are the key points from the page on scheduling an auto shutdown in Windows 11 using Task Scheduler:

## Importance of Auto Shutdown:

- Saves electricity and reduces energy costs.
- Enhances security by preventing unauthorized access.

Helps manage computer usage time.

## Setup Steps:

1. Open Task Scheduler (**taskschd.msc**).
2. Create a Basic Task named "**Auto Shutdown**."
3. Set the trigger (e.g., **daily at a specific time**).
4. Choose "Start a Program" action with `C:\Windows\System32\shutdown.exe` and arguments `/s /f /t 0`.
5. Finish and test the task.

## Benefits:

- Reduces energy consumption and carbon footprint.
- Ensures systems shut down after updates or maintenance.

Find more information @ [Winsides - Schedule Auto Shutdown](https://winsides.com/schedule-auto-shutdown-in-windows-11/)
The Role of Technology in Modern Drywall Estimating
Published: 2024-06-30 18:25:11

Technology plays a crucial role in modern drywall estimating by automating measurements, calculations, and data analysis, significantly reducing human error. Advanced software tools provide precise material estimates and allow for quick adjustments, enhancing project accuracy and efficiency. This technological integration streamlines the planning process, saves time, and helps manage costs effectively in construction projects. [DryWall Takeoff](https://remoteestimation.us/service/drywall-takeoff-and-estimating-service/)
Change Default Colors in FilamentPHP
Tags: php, laravel, filament, tailwindcss
Published: 2024-06-30 18:18:10

## Set Colors for a single Resources

Using filament we are able to define the colors for all the resources in the `AppPanelProvider.php` class, this class is typically the one that is created by default in a filament project installation command, we can define a lot of features in this case we are going to set the colors for the whole resources:

```php
public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('app')
        ->path('/')
        ->login()
        ->colors([
            'primary' => Color::Slate,
            'gray' => Color::Gray
        ]);
}
```

Now all the genereated resources are going to use this colors, take in mind that the value of the colors is handle by a Color class provided by Filament in the namespace `namespace Filament\Support\Colors` and it provides an identifier for all the colors in the TailwindCSS color pallete.

## Set colors in a custom action

You can define custom actions using `vainilla` livewire components, in this cases you would need to explicitly define the color by chaining the `colors` method:

```php
->color(Color::Slate)
```

## Set Colors Globally

From a service provider's `boot()` method you can define the colors for your app globally:

```php
public function boot(): void
{
    FilamentColor::register([
        'danger' => Color::Red,
        'gray' => Color::Zinc,
        'info' => Color::Blue,
        'primary' => Color::Indigo,
        'success' => Color::Green,
        'warning' => Color::Amber,
    ]);
}
```

In this example this script replace the `Amber` color as the primary color for the `Indigo` all of the Tailwind Colors Pallette is available in the `Colors` class provided by Filament.

You can add more color options and even customize them from hex color codes to customize it even more you can follow the docs for this section [here](https://filamentphp.com/docs/3.x/support/colors#registering-extra-colors)

Thanks for reading!
sanal ortam oluşturma
Published: 2024-06-30 18:14:51

Harika! Sanal ortam oluşturmak ve kullanmak için aşağıdaki adımları izleyebilirsiniz:

1. **Sanal ortamı oluşturun:**
   ```bash
   python -m venv myenv
   ```

2. **Sanal ortamı aktif hale getirin:**
   - **Windows**:
     ```bash
     myenv\Scripts\activate
     ```
   - **macOS/Linux**:
     ```bash
     source myenv/bin/activate
     ```

   Sanal ortamı başarıyla aktif hale getirdiğinizde komut satırında `(myenv)` gibi bir gösterge görmelisiniz.

3. **Gerekli paketleri yükleyin:**
   ```bash
   pip install "gerekli paketler"
   ```

   Bu komut, gerekli paketleri sanal ortamınıza yükleyecektir.

4. **Paketleri kullanın:**
   Sanal ortam aktifken, Python komutlarını veya betiklerinizi çalıştırdığınızda bu ortamda yüklü olan paketler kullanılacaktır. Örneğin:
   ```bash
   python my_script.py
   ```

5. **Sanal ortamı devre dışı bırakmak:**
   Sanal ortamdan çıkmak ve global Python ortamınıza geri dönmek için:
   ```bash
   deactivate
   ```

Bu adımları takip ederek sanal ortamda paketlerinizi sorunsuz bir şekilde yükleyip kullanabilirsiniz. Sanal ortamı paket uyumsuzlukları olursa global python'dan bağımsız kullanabilmeniz için idealdir. yani yeni bir paket yüklerseniz sizde yüklü olan python sürümleri ile uyumlu olmalıdır.
Handling Concurrent Access to Shared Resources in Golang
Published: 2024-06-30 18:06:47

Golang's concurrency model with goroutines is powerful but can lead to race conditions when accessing shared resources. Here's a brief guide on handling these issues effectively.

**Problem**
Race conditions occur when multiple goroutines access shared resources concurrently, causing unpredictable behavior.

**Solutions**
 

- **Mutexes:**Mutexes ensure only one goroutine can access a shared resource at a time.

Example:
```
package main

import (
    "fmt"
    "sync"
)

var (
    counter int
    mutex   sync.Mutex
)

func increment(wg *sync.WaitGroup) {
    defer wg.Done()
    for i := 0; i < 1000; i++ {
        mutex.Lock()
        counter++
        mutex.Unlock()
    }
}

func main() {
    var wg sync.WaitGroup

    for i := 0; i < 10; i++ {
        wg.Add(1)
        go increment(&wg)
    }

    wg.Wait()
    fmt.Println("Final counter value:", counter)
}
```



- **Channels:**
Channels can synchronize goroutines by controlling access to shared resources.

Example:
```
package main

import (
    "fmt"
    "sync"
)

func increment(counter chan int, wg *sync.WaitGroup) {
    defer wg.Done()
    for i := 0; i < 1000; i++ {
        c := <-counter
        c++
        counter <- c
    }
}

func main() {
    var wg sync.WaitGroup
    counter := make(chan int, 1)
    counter <- 0

    for i := 0; i < 10; i++ {
        wg.Add(1)
        go increment(counter, &wg)
    }

    wg.Wait()
    fmt.Println("Final counter value:", <-counter)
}
```

- **Atomic Operations:**
The sync/atomic package provides atomic memory primitives for safe concurrent access.

Example:
```
package main

import (
    "fmt"
    "sync"
    "sync/atomic"
)

var counter int64

func increment(wg *sync.WaitGroup) {
    defer wg.Done()
    for i := 0; i < 1000; i++ {
        atomic.AddInt64(&counter, 1)
    }
}

func main() {
    var wg sync.WaitGroup

    for i := 0; i < 10; i++ {
        wg.Add(1)
        go increment(&wg)
    }

    wg.Wait()
    fmt.Println("Final counter value:", counter)
}
```
**Conclusion**
Prevent race conditions in Golang by using mutexes, channels, or atomic operations to synchronize access to shared resources. Choose the method that best fits your use case.Hng helped me groom my skills as a problem solver and i would want whoever reading this to look into the innternship and let them groom your skills as a developer [HNG Internship](https://hng.tech/internship) and [premium subscription](https://hng.tech/premium).click the link to learn more.
[Python] Tool Hacking Plus
Tags: python, hacking, opensource, security
Published: 2024-06-30 18:02:49

Herramienta para uso diario, scanea cualquier host obteniendo datos del sistema.

Por ahora está en versión pre-alpha lo cual falta agregar mas utilidades que se van agregar mas adelante.

```
████████╗██╗  ██╗██████╗
╚══██╔══╝██║  ██║██╔══██╗
   ██║   ███████║██████╔╝
   ██║   ██╔══██║██╔═══╝
   ██║   ██║  ██║██║     
   ╚═╝   ╚═╝  ╚═╝╚═╝     

usage: thp [-h] [-a] [-p PORT] [-t HOST] [-v] [-o OUTPUT]

THP CLI tool for network analysis

options:
  -h, --help            show this help message and exit
  -a, --about           Show help information
  -p PORT, --port PORT  Port number
  -t HOST, --host HOST  Host to analyze
  -v, --verbose         Enable verbose output
  -o OUTPUT, --output OUTPUT
                        Output file name
```

repositorio:
https://github.com/JkDevArg/thp_python
Overcoming Execution Policy Restrictions in PowerShell: My Journey with the HNG Internship
Tags: backend, hng, django
Published: 2024-06-30 18:00:13

I decided to embark on django backend development through HNG intership. setting up my virtual environment was the first starting point where i encoutered issues with power shell. and i will like to share how i was able to find solution to the issue. below is the error message encoutered.


PS C:\Users\qwerty\documents\learn-django> .\myvirenv\Scripts\Activate

.\myvirenv\Scripts\Activate : File C:\Users\qwerty\documents\learn-django\myvirenv\Scripts\Activate.ps1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\myvirenv\Scripts\Activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\qwerty\documents\learn-django>


* first i try to understand the problem.The error message indicated that running scripts is disabled on my system due to PowerShell's execution policy settings. PowerShell's execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. By default, it is set to restrict the execution of scripts to prevent the running of potentially harmful scripts.
* Opened powershell as an administrator to confirm the current status of the execution policy with the following command


Get-ExecutionPolicy


* It returned RESTRICTED, this confirms that no script was allowed to run

* To allow the activation script to run, I needed to change the execution policy. There are several options available, but I opted for the RemoteSigned policy, which allows scripts created on the local computer to run but requires that scripts downloaded from the internet be signed by a trusted publisher. below is the command for this


Set-ExecutionPolicy RemoteSigned -Scope CurrentUser


after these step i ran my virtual environment setup again , and it was successful.

Technical challenges are an inevitable part of a developer’s journey, Here’s to a successful journey with the HNG Internship, where I look forward to tackling more challenges, learning new skills, and growing as a backend developer!. HNG provides a platform for growth and excellence. follow this links for more  [Internship](https://hng.tech/internship)  [hire](https://hng.tech/hire)
Browser hot-reloading for Python ASGI web apps using arel
Tags: python, fastapi, webdev, programming
Published: 2024-06-30 17:51:49

One day I was just frustrated from this fact that while doing web development using Python ASGI frameworks like FastAPI there is no browser hot-reloading functionality available. I dig deeper and found about [arel](https://github.com/florimondmanca/arel). This tutorial will you to implement arel in your development workflow for a better experience. 

Browser hot reloading is a popular feature for developers that allows for rapid iteration and debugging of web applications. It allows for changes made to the codebase to be reflected instantly in the browser, eliminating the need for manual reloading or rebuilding.

One framework that makes use of hot reloading is FastAPI, a high-performance web framework for building APIs. FastAPI is built on top of ASGI (Asyncronous Server Gateway Interface) and utilizes the Uvicorn web server to provide a smooth and efficient development experience.

To enable hot reloading in FastAPI, we can use the arel library. Arel is a lightweight library that provides hot reloading functionality for Python web applications. It works by automatically detecting changes to the codebase and reloading the server whenever a change is detected.

```python
pip install arel
```

## Package Requirements
- arel
- fastapi
- jinja2
- unicorn[standard]
or
- webhook

With these changes, our FastAPI app will now have hot reloading enabled. Any changes made to the codebase will be reflected in the browser instantly, without the need for manual reloading.

There are a few additional configuration options available for arel. For example, we can specify the directories that arel should watch for changes, or we can disable hot reloading in certain environments (such as production).

Overall, using arel to enable hot reloading in FastAPI can greatly improve the development experience, allowing for faster iteration and debugging of our web application. It is a useful tool for any FastAPI developer looking to streamline their workflow and improve their productivity.

debug flag needs to be set to True in order for hot reloading to work in FastAPI. The debug flag can be set in the FastAPI application object, like so:

```python
app = FastAPI(debug=True)
```

Alternatively, you can also set the debug flag using an environment variable. In this case, you would need to set the UVICORN_DEBUG environment variable to 1 before starting the FastAPI server.

Implementation: https://github.com/ashleymavericks/browser-hot-reloading
Building a Mail Analyzer and Responder Using ChatGPT API: A Backend Development Journey
Published: 2024-06-30 17:47:30

In the realm of backend development, challenges abound, pushing us to innovate and refine our skills continuously. Recently, I embarked on an ambitious project: creating a backend application that analyzes incoming emails and uses the ChatGPT API to generate appropriate responses. This undertaking was as complex as it was rewarding, presenting numerous obstacles that required creative and technical prowess to overcome. Allow me to walk you through this journey, highlighting the hurdles encountered and the strategies employed to build a robust solution.

The Challenge: Analyzing Emails and Responding Appropriately
The primary objective was to develop an application capable of:

1) Fetching and analyzing incoming emails.
2) Determining the context and sentiment of each email.
3) Generating accurate and contextually relevant responses using the ChatGPT API.
4) Sending these responses back to the original senders.
5) Schedules and sends these responses using Gmail API and BullMQ.

Conclusion
Building this backend application involved integrating the Gmail API for reading and sending emails, ChatGPT API for generating responses, and BullMQ for scheduling. The process was a testament to the importance of systematic problem-solving in backend development.

My Journey with HNG Internship
I’m thrilled to join the HNG Internship, where I’ll further hone my skills and tackle new challenges. The HNG Internship offers a hands-on, immersive learning experience, perfect for developers looking to elevate their careers. Learn more about the program and explore how you can hire top talent from HNG.

My Journey with HNG Internship
I’m thrilled to join the HNG Internship, where I’ll further hone my skills and tackle new challenges. The HNG Internship https://hng.tech/internship offers a hands-on, immersive learning experience, perfect for developers looking to elevate their careers. Learn more about the program and explore how you can hire top talent from HNG https://hng.tech/hire.

This project exemplifies the exciting, problem-solving nature of backend development, and I’m eager to continue this journey with HNG, ready to embrace new opportunities and contribute to innovative solutions.

For more information on the HNG Internship and how it can transform your career, visit HNG Internship: https://hng.tech/internship and explore their premium offerings here: https://hng.tech/premium.
Useful aliases for docker
Tags: docker, cli, devops
Published: 2024-06-30 17:20:11

---
title: Useful aliases for docker
published: true
description: 
tags: docker,cli, devops
cover_image: https://blog.codewithdan.com/wp-content/uploads/2023/06/Docker-Logo-1024x576.png
# Use a ratio of 100:42 for best results.
# published_at: 2024-06-30 17:15 +0000
---

Docker has been there for a long time and its my top most used tool whether for spinning up a web server or trying out a new tool.
If you are like me and use docker on your day to day dev workflow, these aliases would help you save few keystrokes for common use cases and save your time.
You can set up in your shell configuration file (like .bashrc, .zshrc, etc.):


### Get latest container ID
```bash
alias dl="docker ps -l -q"
```
### Get container process
```bash
alias dps="docker ps"
```

### Get process included stop container
```bash
alias dpa="docker ps -a"
```

### Get images
```bash
alias di="docker images"
```

### Get container IP
```bash
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
```

### Run daemonized container, e.g., $dkd base /bin/echo hello
```bash
alias dkd="docker run -d -P"
```

### Run interactive container, e.g., $dki base /bin/bash
```bash
alias dki="docker run -i -t -P"
```

### Execute interactive container, e.g., $dex base /bin/bash
```bash
alias dex="docker exec -i -t"
```


### Stop all containers
```bash
alias dstop='docker stop $(docker ps -a -q)'
```

### Remove all containers
```bash
alias drm='docker rm $(docker ps -a -q)'
```


### Stop and Remove all containers
```bash
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
```


### Remove all images
```bash
alias dri='docker rmi $(docker images -q)'
```

### Dockerfile build, e.g., $dbu tcnksm/test
```bash
alias dbu='docker build -t=$1 .'
```

### Show all alias related docker
``` bash
dalias() { alias | grep 'docker' | sed "s/^\([^=]*\)=\(.*\)/\1 => \2/" | sed "s/['|\']//g" | sort; }
```


### Bash into running container
```bash
alias dbash='docker exec -it $(docker ps -aqf "name=$1") bash'
```
MY JOURNEY AS A BACKEND ENGINEER INTERN.
Tags: webdev, javascript, beginners, programming
Published: 2024-06-30 17:08:16

MY JOURNEY AS A BACKEND ENGINEER INTERN.
I am Ifeoma Eunice Ugwu, a goal-getter, hardworking, determined, an easy-going person. I studied Metallurgical and Materials Engineering at Nnamdi Azikiwe University. I also studied courses on Backend Engineering (NodeJs, Typescript, NestJs) and frontend courses like HTML, CSS, JavaScript.
Joining HNG for internship program was what I looked forward to. I jumped into the offer when a friend sent me their link https://hng.tech/internship. I registered through this link: https://hng.tech/premium. I registered and followed their procedure judiciously in order to be a part of it knowing that I will be able to learn to build different APIs, collaborate with others, connect with my fellow engineers,  learn to work under pressure and meet up with targets and more.
My work as a Backend Engineer has been a smooth journey until I encountered this particular problem in NodeJS when I was building a Todo API application. I was stocked trying to query the registered tasks in my database for the app. 
Firstly, I created tasks using the below code and logging in tasks in order to save them in my database with the help of taskSchema.
// to create tasks
app.post("/task", (req, res) => {
    let tasks = req.body;
tasksModel.create(tasks)
.then((doc) => {
    res.status(201).send({ message: "Task Registered successfully" })
})
   .catch((err) => {
console.log(err);
res.status({ message: "Some problem occured" })
})
})

I then tried to get all tasks using the below code.
// get all tasks
app.get("/tasks, (req, res) => {
          tasksModel.findAll({ tasks })
              .then((tasks) => {
             res.status(200).json({ tasks, message: "Tasks returned successfully"})
          console.log(tasks);
           }).catch(err=>{
            console.log(err)
           })
    })

Here is the code for getting tasks by id:
// get task by id
app.get("/tasks/:_id", (req, res) => {
   const _id = req.params._id
    console.log(_id)
          tasksModel.findOne({ _id })
              .then((tasks) => {
             res.status(200).json({ tasks, message: "Task returned successfully"})
                   // console.log(tasks);
           }).catch(err=>{
            console.log(err)
           })
    })

Here is the code for updating the registered tasks.
    // to update task by id
    app.put("/tasks/:_id", (req, res) =>{
      const _id = req.params._id
      const Name = req.body.Name
      const Status = req.body.Status
      tasksModel.updateOne({ _id }, { Name , Status })
          .then((tasks) => {
            res.status(200).json({ tasks, message: "Task updated successfully"})
          console.log(tasks);
          })
})

Finally, I was able to solve the problem using the below code to delete the required task by id.
// to delete tasks by id
app.delete("/tasks/:_id", (req, res) => {
  const _id = req.params._id
  tasksModel.deleteOne({ _id})
      .then((tasks) => {
        res.status(200).json({ tasks, message: "Task deleted successfully"})
      console.log(tasks);
      })
})