teleren/devto huggingface dataset:
Converting 2D Unet to 3D Unet
Tags: python, machinelearning, database, ai
Published: 2023-09-10 18:21:11

Before we look into converting 2D unet to 3D unet ,it is important we understand what Unet is and how it works.


UNet is a convolutional neural network (CNN) architecture commonly used for image segmentation tasks in the field of computer vision. It was introduced by Olaf Ronneberger, Philipp Fischer, and Thomas Brox in a 2015 research paper titled "U-Net: Convolutional Networks for Biomedical Image Segmentation." The network was initially designed for biomedical image segmentation but has since found applications in various domains beyond medical imaging.

UNet's architecture is characterized by a U-shaped structure, hence its name. It consists of an encoder-decoder network with skip connections. The architecture can be divided into two main parts:

1. Encoder: This part of the network captures the hierarchical features of the input image through a series of convolutional and pooling layers. As you move deeper into the encoder, the spatial resolution decreases while the number of feature channels increases.

2. Decoder: The decoder part of UNet performs upsampling and combines the high-level feature maps from the encoder with the upsampled feature maps to produce a segmentation mask. This helps recover the spatial information and achieve precise segmentation.

The code below shows a 2D unet architecture


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


Now to convert from 2D to 3D change every occurrence of 2D in your layers to 3D eg


```
Conv2D to Conv3D

Conv2DTranspose to Conv3DTranspose


```

Final result


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


Thanks for reading .
Conectar con ssh de mac a ubuntu
Tags: recordar, espanol, ssh
Published: 2023-09-10 18:13:00


##Hola a todos##

Hoy traigo un nuevo tutorial, en este caso es para conectar por ssh una computadora mac a una con ubuntu. Pero se puede hacer para cualquier S.O.

Bueno, pues, a darle.


###Configurar SSH en la computadora Ubuntu:###

Asegúrate de que el servicio SSH esté instalado y en ejecución en tu computadora Ubuntu. Puedes hacerlo ejecutando los siguientes comandos en la terminal de Ubuntu:

```
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
```

Esto instalará el servidor SSH y lo pondrá en funcionamiento en tu computadora Ubuntu.


Obtener la dirección IP de la computadora Ubuntu:

Necesitarás conocer la dirección IP de tu computadora Ubuntu en la red local. Puedes obtenerla ejecutando el siguiente comando en la terminal de Ubuntu:


```
ip a | grep inet
```



Busca una línea que comience con "inet" y tenga una dirección IP que se parezca a 192.168.x.x o 10.x.x.x. Esta es la dirección IP de tu computadora Ubuntu en la red local.


###ufw###

Firewall o reglas de seguridad:

Es posible que un firewall o reglas de seguridad estén bloqueando las conexiones SSH. Asegúrate de que el puerto 22 (el puerto predeterminado para SSH) esté abierto en el firewall de tu servidor. Puedes utilizar el siguiente comando para ver las reglas de firewall activas:

```
sudo ufw status
```

Si ves que el puerto 22 está en la lista de reglas denegadas, debes agregar una regla para permitirlo:

```
sudo ufw allow 22/tcp
```

Luego, reinicia el firewall:

```
sudo ufw reload
```

Eso es todo lo que debemos de configurar en la computadora ubuntu



###MAC###

Para la computadora mac solo tenemos que conectarnos con ssh

```
ssh NOMBREUSUARIO@IP_DEL_SERVIDOR
```

Ejemplo:

```
ssh root@192.168.1.2
```

Te pedira la contrasena que es la misma del usuario de ubuntu
NuxtJS + Laravel Solving CORS issue
Tags: php, laravel, vue, javascript
Published: 2023-09-10 18:00:48

## Access apps from the browser

For a local environment on the backend side using Herd/Valet Laravel provides two ways to visit your application in the browser: 

- Running `php artisan serve`: `http://127.0.0.1:80` 
- Using Vite `npm run dev` to: `http://backend-app.test`

Both ways are useful, ok so now on the frontend side NuxtJS provides an easy way to access your project:

- `npm run dev`: `http://127.0.0.1:8000`

## Set both projects

To test that both technologies can work together just add a backend route in Laravel app and check the response in NuxtJS:

```php
Route::get('hello-world', fn () => 'Hello World');
```

Now in Nuxt JS we can make a request and get the response in any component:

```html
<script setup>
const { data, pending, error } = await useFetch('http://backend-app.test/hello-world');
</script>

<template>
<h1>{{ data }}</h1>
</template>
```

If you open the console you are going to be able to see an issue related to CORS.

## Solving CORS problem

Go to `nuxt.config.ts` file in the root directory and add a route rule object:

```js
export default defineNuxtConfig({
  devtools: { enabled: true },
  ...
  routeRules: {
    '/api/**': { proxy: { to: "http://backend-app.test/**" } }
  }
})
```

Now just rebuild the frontend by re-running: `npm run dev` and it now should show the request response without issues.

## Take in mind:

- You do not need to do this for external API services
- You can add a prefix to your backend route like: `http://backend-app.test/api/**` to allow wildcard for api routes only.
- If you are using a `JsonResource` wrapper as a response in Laravel usually the response would be available when fetching the data as: `data.data` for Nuxt.

Hopefully it is useful and as always Happy Code!
What is API & REST API ?
Tags: webdev, javascript, beginners, api
Published: 2023-09-10 18:00:01

An API, or Application Programming Interface, is set of rules i.e. protocols for building and interacting with software application.
It allows different software systems to communicate with each other, enabling them to share data and functionality.
An example of an API is the Facebook API, which allows developers to access and interact with functionality of the Facebook platform such as posting status updates, retrieving user information, and managing ad campaigns. Another example is the Google Maps API, which allows developers to embed maps and location-based functionality in their own websites and apps.
**How an API Works:**
APIs acts as a bridge between applications and web servers, processing data transfer between systems. When a client application initiates an API call, also known as request, it is sent to the web server via the API's Uniform Resource Identifier(URI) and includes a request verb, headers and sometimes a request body. The API then processes the request and may make a call to an external program or web server for the requested information.
The server responds with the requested data, which the API then forwards to the initial requesting application. This process of requests and responses all happens through the API. Unlike user interfaces which are designed for human use, APIs are designed for use by computers or applications.

**REST API: Representational State Transfer**
REST is a type of web architecture and a set of constraints to be used when creating web services. RESTful API is API that conforms to the REST architectural style and constraints, it is typically used to make requests to retrieve or update data on a web server. A RESTful API uses HTTP requests to POST(create), PUT(update), GET(read), and DELETE(delete) data. A RESTful API also returns a response in a standard format, typically JSON or XML, and uses standard HTTP status codes to indicate the status of the request. RESTful APIs are popular because they are simple to understand and easy to use, and they work well with the HHTP protocol that the internet is built on. Additionally, RESTful APIs are often faster and more lightweight than their SOAP(Simple Object Access Protocol) counterparts because they use smaller message formats. RESTful API's have become a popular way for systems to expose databases through HTTP(s) following CRUD operations(Create, Read, Update, Delete), and return JSON or XML as responses, it's also widely used in microservices, mobile and web applications, IoT
and many more.
REST requires that a client make a request to the server in order to retrieve or modify data on the server.
**A request generally consists:**

- An HTTP verb, which defines what kind of operation to perform.

- A header, which allows the client to pass along information about the request.

- A path to a resource.

- An optional message body containing data.
JSON VS XML
Tags: json, xml, javascript, webdev
Published: 2023-09-09 13:50:44

JSON and XML are both data interchange formats used to structure and store data in a human-readable and machine-readable format. While they serve similar purposes, they have different structures.

**Here's a comparison of JSON and XML**

| Aspect              | JSON                                     | XML                                       |
|---------------------|------------------------------------------|-------------------------------------------|
| **Format**          | JSON stands for JavaScript Object Notation. | XML stands for eXtensible Markup Language. |
| **Syntax**          | Uses a lightweight, easy-to-read syntax.  | Uses tags enclosed in angle brackets (< >). |
| **Data Types**      | Supports primitive data types: strings, numbers, booleans, arrays, and objects. | Allows you to define custom data types with Document Type Definitions (DTD) or XML Schema (XSD). |
| **Readability**     | Generally more human-readable due to its simplicity. | Can be verbose and less human-readable due to the use of tags. |
| **Parsing**         | Easier and faster to parse because of its straightforward structure. | More complex parsing due to nested tags and attributes. |
| **Metadata**        | Minimal metadata is included, primarily focused on data representation. | Supports extensive metadata and document structure, making it suitable for documents and configurations. |
| **Usage**           | Commonly used for configuration files, APIs, and data exchange in web applications. | Often used in documents like HTML, XML configuration files, and data interchange in some older systems. |
| **Attributes**      | Does not support attributes directly; all data is stored as key-value pairs within objects. | Supports attributes within tags, allowing for additional metadata. |
| **Whitespace**      | Whitespace is generally insignificant and can be ignored. | Whitespace can be significant and is often preserved. |
| **Tool Support**    | Well-supported by modern programming languages and libraries. | Also well-supported, but may require more specialized libraries for parsing and processing. |

## **Example**

**JSON Example:**

```
{
"name": "John",
"age": 30,
"city": "New York"
}
```
**XML**

```
<person>
<name>John</name>
<age>30</age>
<city>New York</city>
</person>
```
In summary, JSON is generally favored for its simplicity and ease of use in modern web development, especially for APIs. XML, on the other hand, excels in scenarios where complex document structures and extensive metadata are required, such as in documents like HTML, XML configuration files, or when working with legacy systems. The choice between JSON and XML depends on your specific use case and requirements.
Solving "Climbing Stairs" Leet code Problem
Tags: java, programming, coding, discuss
Published: 2023-09-10 16:59:10

## Question:
**70. Climbing Stairs**
Type: Easy
Liked by 19.8K
Disliked by 656.
Companies that asked this question
Companies: No of times asked
Amazon 3
Yahoo 2
Adobe 11
Google 5
Apple 5
Bloomberg 3
Microsoft 3
Uber 2
Nagarro 2
Expedia 12
Oracle 4
Goldman Sachs 3
Facebook 2
Intel 2
Visa 2
Optum 2
Swiggy 2

You are climbing a staircase. It takes n steps to reach the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

 

**Example 1:**
Input: n =`2`
Output: `2`
Explanation: 
`There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps`

**Example 2:**
Input: n = `3`
Output: `3`
Explanation: 
`There are three ways to climb to the top.
1. 1 step + 1 step + 1 step
2. 1 step + 2 steps
3. 2 steps + 1 step`
 

Constraints:
`1 <= n <= 45`


# Intuition:
The problem is about finding the number of ways to climb a staircase when you can take either 1 step or 2 steps at a time. To solve it, you can use dynamic programming.

# Approach:

Create an array to store the number of ways to reach each step.
Initialize the first two elements of the array (representing the first and second steps).
Use a loop to calculate the number of ways to reach each subsequent step.
Return the number of ways to reach the final step.
# Complexity:

**Time Complexity**: O(n)
**Space Complexity**: O(n)
# Code
```
class Solution {
    public int climbStairs(int n) {
        int[] arr = new int[n+1];

        if(n == 1){
            return 1;
        }
        else{
            arr[1] = 1;
            arr[2] = 2;
            for(int i = 3 ; i <=n ; i++){
                arr[i] = arr[i-1] + arr[i-2];
            }
        }
       return arr[n];
    }
}
```

Happy coding,
shiva
TILvert, my first open-source project
Tags: typescript, opensource, programming
Published: 2023-09-10 16:48:07

Today I released the very first version of my open-source text conversion utility. This utility was designed to quickly generate blog posts using your filesystem.

Tilvert is a simple tool to convert TILs from markdown files to HTML

## Installation

```bash
$ npm install -g https://github.com/omalk98/TILvert.git
```

## Uninstall

```bash
$ npm uninstall -g tilvert
```

## Usage

```bash
$ tilvert [flags/options] <path>
```

If no path is specified, TILvert will read the current directory recursively to find all files with the matching extension (default "txt").

### Flags

| Flag          | Description                   |
| ------------- | ----------------------------- |
| -h, --help    | Displays help information.    |
| -v, --version | Displays version information. |

### Options

| Option           | Description                                                                                |
| ---------------- | ------------------------------------------------------------------------------------------ |
| -e, --extension  | Extension for the files in the input directory. (Ignored if input is file). Default (txt). |
| -o, --output     | Path to the output directory. Default (./til).                                             |
| -s, --stylesheet | Path to the stylesheet.                                                                    |
| --title          | Title of the HTML page.                                                                    |
| --author         | Author of the HTML page.                                                                   |
| --description    | Description of the HTML page.                                                              |
| --keywords       | Keywords of the HTML page.                                                                 |
| --robots         | Robots of the HTML page.                                                                   |
| --generator      | Generator of the HTML page.                                                                |
| --theme-color    | Theme color of the HTML page.                                                              |

## License

TILvert is licensed under the [MIT License](https://mit-license.org/)

## Features

- [x] Convert markdown files to HTML
- [x] Replicate directory structure in output directory
- [x] Customizable HTML page with meta tags
- [x] Customizable stylesheet
- [x] Customizable extension for input files
- [x] Customizable output directory
Putting Cypher into Practice with Real-World Scenarios
Tags: apacheage, postgres, cypher, agedb
Published: 2023-09-10 16:37:52

In this section, we'll apply our knowledge of Cypher queries in Apache AGE to real-world scenarios, demonstrating the practical utility of this powerful query language.

**1. Building a Social Network**
Suppose you're tasked with building a social network platform. One common requirement is to find mutual friends between two users. With Cypher, this task becomes straightforward:

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

In this example, we're querying for mutual friends between users 'Alice' and 'Bob.' Cypher allows us to express this relationship clearly, making it a valuable tool for building social network features.

**2. Recommendations Engine**
Imagine you're working on a recommendations engine, such as those used by e-commerce platforms or streaming services. Recommendations often involve finding potential connections for a user. Cypher is well-suited for this task:

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

In this query, we're looking for potential friends (connections) for user 'Alice' who are two to three degrees of separation away. Additionally, we ensure that 'Alice' is not already directly connected to these potential friends. This is a simplified example of how Cypher can help provide personalized recommendations to users.

**Conclusion**
Cypher queries in Apache AGE empower you to tackle real-world scenarios with ease and efficiency. By mastering the syntax and understanding the query patterns, you can leverage the full potential of graph databases for various applications.

As you explore complex graph patterns and apply Cypher in different contexts, you'll realize the versatility and power it brings to managing and querying graph data. Armed with this knowledge, you're well-prepared to embark on your journey into the world of graph databases with Apache AGE. Start exploring and building your graph-based applications today!
Download Capcut IOS (IPhone,MAC) [latest version 2.5.0] 2023
Tags: webdev
Published: 2023-09-10 14:24:44

If you're an iPhone user and looking for the best video editing tool for iOS, you've come to the right place. 

[CapCut for IOS](https://capcutmody.com/) is an application that is available for Android, iOS, PC, and Mac, making it a versatile solution for all your editing needs. Many Apple users often encounter difficulties when trying to find and download apps for iOS. 

However, the developer of CapCut has addressed this issue by developing and launching the CapCut app specifically for iPhone users. Now, iPhone users can explore the benefits and features of CapCut without any hassle. By offering CapCut for iOS, the developers have made it convenient for iPhone users to access a powerful video editing tool.
Post-Exploitation Phase
Tags: cybersecurity
Published: 2023-09-10 16:27:33

## Overview 
While the initial stages of a penetration test focus on gaining access to a target system, the post-exploitation phase is equally critical. In this phase, ethical hackers shift their focus towards maintaining access, gathering sensitive information, and ensuring that their presence remains undetected.

## Post-Exploitation Methods

During the post-exploitation phase, ethical hackers employ various methods to achieve their objectives:

### 1. Privilege Escalation

Privilege escalation is the process of gaining higher-level access or permissions on a compromised system. This often involves exploiting vulnerabilities in the operating system or applications to escalate from a low-privileged user to a privileged user or administrator.

### 2. Lateral Movement

Lateral movement refers to the ability to move laterally within a network, potentially compromising multiple systems. Ethical hackers use this method to explore and compromise additional systems and gather more data.

### 3. Data Exfiltration

Data exfiltration involves stealing sensitive information from the compromised system. This can include customer data, intellectual property, or any valuable information that the organization wants to protect.

### 4. Persistence

Maintaining access to a compromised system is crucial for ethical hackers. Persistence methods ensure that even if the initial breach is discovered and patched, they can still regain access.


## Common Tools in Post-Exploitation

To execute these post-exploitation methods effectively, ethical hackers rely on a range of specialized tools. Some commonly used tools include:

- **Metasploit**: A versatile penetration testing framework that provides various modules and payloads for post-exploitation activities.

- **PowerShell Empire**: A post-exploitation framework that leverages PowerShell to execute commands on compromised systems.

- **Cobalt Strike**: A popular tool for red teaming and penetration testing, offering features for post-exploitation, lateral movement, and persistence.

- **Mimikatz**: A powerful tool for extracting plaintext passwords, hashes, and Kerberos tickets from memory.



*[Disclaimer: This article is for educational purposes only. Unauthorized penetration testing is illegal and unethical. Always obtain proper authorization before conducting any penetration testing activities.]*
Websites must Know #1
Tags: beginners, scor32k
Published: 2023-09-10 16:21:19

1. **https://root-servers.org/**
   - This website serves as the official portal for the Internet's root servers. These servers are critical components of the Domain Name System (DNS), which helps translate human-readable domain names into IP addresses.

2. **https://www.felixcloutier.com/x86/**
   - Felix Cloutier's website is an invaluable resource for anyone interested in x86 assembly language programming. It provides comprehensive documentation, tutorials, and reference materials for x86 assembly language.

3. **https://cpu.land/**
   - CPU Land is a dedicated platform that showcases various central processing units (CPUs) and their architectural details. It offers insights into the world of CPUs and how they function.

4. **https://man7.org/**
   -  This website is a repository of Linux manual pages. It contains extensive documentation for Linux commands, system calls, library functions, and other essential elements of the Linux operating system.

5. **https://www.gnu.org/**
   - The GNU Project's official website provides information about the GNU Project, a significant free and open-source software initiative. It offers details about GNU software, licenses, and the philosophy behind free software.

6. **https://www.icann.org/**
   - The Internet Corporation for Assigned Names and Numbers (ICANN) maintains this website. ICANN is responsible for coordinating and overseeing the global Domain Name System (DNS) and internet resources. The site offers insights into ICANN's functions and policies.

7. **https://www.cheat-sheets.org/**
   - Cheat-Sheets.org is a collection of cheat sheets and quick-reference guides for various programming languages, tools, and technologies. It's a valuable resource for developers and IT professionals seeking concise information and tips.

8. **https://www.w3.org/**
   - W3C is leading the Web to its full potential by developing protocols and guidelines that ensure the long-term growth of the Web. (credit: Cezary Tomczyk)

9. **https://breachdirectory.org/**
    - BreachDirectory allows you to search through all public data breaches to make sure your emails, usernames, passwords, and domains haven't been compromised.

10. **https://github.com/sherlock-project/sherlock**
    - Sherlock - one of the most popular, promising and powerful CLI tool to hunt down social accounts across almost all social networks with 40.6k stars on Github!


11. https://w3bits.com/

---

Contributions through comments, much appreciated