teleren/devto huggingface dataset:
SFTP Only Access on Laravel Forge Server
Tags: sftp, forge
Published: 2022-12-04 16:05:00

## Requirements

Let's say you want to create 3 SFTP only users

1.  **mainuser** : manage other users' folders and files
2.  **user01** : can only view/edit own folder and files
3.  **user02** : can only view/edit own folder and files

## Creating Users and Directories

1. Create the 3 users
    ```shell
sudo adduser mainuser
sudo adduser user01
sudo adduser user02
    ```

2. Create folders for **user01** and **user02**
    ```shell
sudo mkdir -p /var/sftp/user01/uploads
sudo mkdir -p /var/sftp/user02/uploads
    ```

3. Give root write permissions to the same directory, and give other users only read and execute rights
    ```shell
sudo chmod 755 /var/sftp/user01
sudo chmod 755 /var/sftp/user02
    ```

4. Change the ownership for the uploads directory to the user you just created
    ```shell
sudo chown user01:user01 /var/sftp/user01/uploads
sudo chown user02:user02 /var/sftp/user02/uploads
    ```

5. Change ownership to **mainuser** to view all user folders
    ```shell
sudo chown root:mainuser /var/sftp
    ```

## Restricting Access to Directory
**Note 1**: We are creating a new sshd file because it would be cleaner and `/etc/ssh/sshd_config` automatically includes `.conf` files in `/etc/ssh/sshd_config.d/`

**Note 2**: user01/user02 will default to its own folder, but cannot create folders or files outside the uploads folder

1. Create **mainuser** sshd config file
    ```shell
sudo nano /etc/ssh/sshd_config.d/mainuser.conf
    ```

2. Add to the newly created **mainuser** conf file
    ```shell
Match User mainuser
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp/
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
    ```

3. Create **user01** sshd config file
    ```shell
sudo nano /etc/ssh/sshd_config.d/user01.conf
    ```

4. Add to the newly created **user01** conf file
    ```shell
Match User user01
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp/user01
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
    ```

5. Create **user02** sshd config file
    ```shell
sudo nano /etc/ssh/sshd_config.d/user02.conf
    ```

6. Add to the newly created **user02** conf file
    ```shell
Match User user02
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp/user02
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
    ```

7. Restart sshd service
    ```shell
sudo systemctl restart sshd
    ```

## Resource
https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-20-04
Temporary Pause to My #100DaysOfCode
Tags: 100daysofcode, beginners, prismic, nextjs
Published: 2022-12-04 16:04:25

It has been a whirlwind 🤢

I didn’t have the time nor energy to code at all because my dev team decided to launch two new projects at once 🤣: [ASIC.guide](asic.guide) & [hashOS](hashos.app)

Both of the projects are still in the cryto mining industry.

ASIC.guide will be a comprehensive directory of companies in the full lifecycle of ASIC mining. We are listing companies from manufacturers, distributers, resellers, hosting companies and finally repair centers.  So that miners can have a one-stop location to do research.

hashOS is an upcoming mining software suite that will offer mining pools (starting with BTC and LTC). We will be adding more software as we develop. We will focus on pleasant user experience as I feel this is where the market is lacking.


Soooo until I get these two off the ground, I won’t be able to work much on hashing.energy.  However, I do have someone adding the articles to the database and you can actually read the summaries of articles there.

So let’s hope I get to come back and code soon!
قالب وردپرس از کجا بخریم ؟
Tags: wordpress
Published: 2022-12-04 16:01:34

[قالب وردپرس](https://themeoff.ir) سریعترین راهکار طراحی سایت می باشد تم آف ارائه دهنده انواع قالب وردپرس در زمینه های شرکتی ، فروشگاهی ، شرکتی می باشد تم آف تضمین ارازان ترین قیمت و اورجینال بدون تمامی محصولات بدون لایسنس و محدودیت نصب
The #openai and #gpt3 tags are now officially "supported" on DEV
Tags: openai, gpt3, ai, meta
Published: 2022-12-04 15:59:20

You may have seen ChatGPT floating around recently. It is an incredible demonstration of AI technology.

{% embed https://dev.to/mcsee/chatgpt-is-amazing-and-it-is-free-1h12 %}

I just want to let you know that #openai and #gpt3 are now "supported" tags on DEV — meaning they will show up in the drop down and be the dedicated aggregation destinations for these topics, and will be more actively moderated.

We already had #ai itself as a tag, which is more general.

Follow any and all of these tags, and some of the top authors, if you are interested!

{% embed https://dev.to/t/openai %}

{% embed https://dev.to/t/gpt3 %}

{% embed https://dev.to/t/ai %}

Happy coding (or maybe just describing to an AI how to code)

_This post was written entirely by a human_. 🤯
Saving in local storage
Tags: javascript, beginners
Published: 2022-12-04 15:57:25

In order to save the to-dos in the local storage, I did the following.

I created an empty array.
`const toDos = [];`

Then, I pushed the newly created to-dos into the empty array.
`toDos.push(newTodo);`

Note: I saved the newly created to-dos in a variable by bringing the value of what was inputted.
`const newTodo = toDoInput.value;`

Next, I created a function to set an item in the local storage.

```js
function saveTodos(){
    localStorage.setItem(TODOSKEY, JSON.stringify(toDos));
}
```
-> I used JSON.stringify, because the local storage will save the array as a string if I don't do so. I needed it to be saved in a form of an array, so I had to stringify the array.

Next, I pressed play on the function that I just created.
`saveTodos();`

Next, I created a variable that has the value of what is in the local storage.
`const savedToDos = localStorage.getItem(TODOSKEY);`

The important (hard) part!
I created a conditional statement that if there's something saved in the local storage under TODOSKEY, console log.

```js
if (savedToDos !== null) {
    const parsedToDos = JSON.parse(savedToDos);
    console.log (parsedToDos);
    parsedToDos.forEach((item)=> console.log ("worked"));
}
```
-> if savedToDos is not null,
create a variable that changes the stringified array back into an array.
Then, console log the array.
Then, for each item of the array, console log "worked".

Note:
`parsedToDos.forEach((item)=> console.log ("worked"));`
will do the same as,

```js
function A(item) {
    console.log("worked")
}

parsedToDos.forEach(A)
```
** (item) is given for free in javascript!
VS Code Fix Cannot validate since no PHP executable is set
Tags: php, troubleshooting, vscode
Published: 2022-12-04 15:33:55

Pesan ini muncul karena VS Code berusaha untuk melakukan validasi code dengan PHP, tapi tidak dapat menemukan instalasi PHP pada system.

> **Detail error yang muncul:**
>
> cannot validate since a php installation could not be found. use the setting 'php.validate.executablepath' to configure the php executable.

Untuk mengatasi masalah ini cukup sederhana, yaitu tinggal klik tombol Open Setting pada dialog yang mucul lalu edit settings.json, dan akan terbuka tab seperti gambar berikut:

![settings.json before](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1v6ouuxyzy2603ps4ggi.png)

`php.validate.executablePath` kita isi dengan path dimana lokasi `php.exe` berada. Sebagai contoh, apabila kita menggunakan XAMPP maka `php.exe` secara default berada di `C:\xampp\php`. Kemudian tambahkan `php.exe` menjadi `C:\xampp\php\php.exe`.

Apabila muncul warning seperti gambar di atas, maka ganti backslash menjadi double backslashes, sehingga menjadi `C:\\xampp\\php\\php.exe`.

![settings.json after](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yw62dwhf4ys7ns071zp9.png)

Setelah selesai edit, jangan lupa save.

## Example

Berikut ini contoh setting untuk `XAMPP` dan `Laragon`

### XAMPP

```json
{
  "php.validate.executablePath": "C:\\xampp\\php\\php.exe",
}
```

### Laragon

```json
{
  "php.validate.executablePath": "C:\\laragon\\bin\\php\\php-8.1.7-Win32-vs16-x64\\php.exe",
}
```

## Settings file locations

Berikut ini adalah lokasi tempat settings file berada:

- Windows

  ```
  %APPDATA%\Code\User\settings.json
  ```
- macOS

  ```
  $HOME/Library/Application Support/Code/User/settings.json
  ```
- Linux

  ```
  $HOME/.config/Code/User/settings.json
  ```

Settings untuk workspace dapat ditemukan di dalam folder `.vscode` pada root folder workspace.

Cara lain untuk membuka `settings.json` adalah melalui Command Palette dengan shortcut `Ctrl+Shift+P` atau melalui menu `View` › `Command Palette`, lalu ketik `settings.json`.
Advent of Code Day 4
Tags: adventofcode, elixir
Published: 2022-12-04 15:19:08


### Links

- [Intro](https://dev.to/sethcalebweeks/advent-of-code-2022-in-elixir-34i8)
- [Problem Statement](https://adventofcode.com/2022/day/4)
- [Code](https://github.com/sethcalebweeks/advent-of-code-2022/blob/main/lib/Day04.ex)

### Highlights

- Nothing too extraordinary with today's problem. For the second part, I started by only checking to see if either endpoint of one elf was within the endpoints of the other elf. Honestly, I still can't figure out why this didn't work, and I had to do the same check in the other direction. Maybe it will come to me at some point today.

```elixir
defmodule Day04 do
  use AOC

  def part1 do
    input(4)
    ~> String.split("\n")
    ~> Enum.map(fn pair ->
      ends = Regex.named_captures(~r/(?<l1>.*)-(?<h1>.*),(?<l2>.*)-(?<h2>.*)/, pair)
      ~> Map.new(fn {key, value} -> {String.to_atom(key), String.to_integer(value)} end)
      (ends.l1 <= ends.l2 && ends.h1 >= ends.h2) ||
      (ends.l2 <= ends.l1 && ends.h2 >= ends.h1)
    end)
    ~> Enum.count(&Function.identity(&1))
  end

  def part2 do
    input(4)
    ~> String.split("\n")
    ~> Enum.map(fn pair ->
      ends = Regex.named_captures(~r/(?<l1>.*)-(?<h1>.*),(?<l2>.*)-(?<h2>.*)/, pair)
      ~> Map.new(fn {key, value} -> {String.to_atom(key), String.to_integer(value)} end)
      (ends.l1 >= ends.l2 && ends.l1 <= ends.h2) ||
      (ends.h1 >= ends.l2 && ends.h1 <= ends.h2) ||
      (ends.l2 >= ends.l1 && ends.l2 <= ends.h1) ||
      (ends.h2 >= ends.l1 && ends.h2 <= ends.h1)
    end)
    ~> Enum.count(&Function.identity(&1))
  end

end
```
How to add animated page transitions to your React.js app
Published: 2022-12-04 15:15:02

Happy Sunday!  Today, I am going to be going over [react-page-animations](https://www.npmjs.com/package/react-page-animations), an easy way to add customizable page transitions into any React app.  It is important to note that this library works with react-router, and react-router-dom, so it is not compatible with Next.js at this time.  But, for any regular React users: fear not, this solution is by far the easiest.

**Install the library**
```shell
npm install react-page-animations
``` 
Start by installing react-page-animations from npm, which will install the library and its one dependency (Framer motion).  You are good to go!

**Quickstart**
```shell
import { Link } from 'react-router-dom';
import { AnimatedPage } from 'react-page-animations';

export default function HomePage () {
    return <AnimatedPage initialOpacity="0" finalOpacity="1">
        <h1>home page</h1>
        <Link to="/page1">Page 1</Link>
        <Link to="/page1">Page 2</Link>
    </AnimatedPage>
}
```
Here, we are wrapping our home page which the AnimatedPage component, which provides page transition animations. Then, we are adding the props initialOpacity="0", and finalOpacity="1", which is the simplest way to add a fade transition.

**Your set**
That's it!  If you followed those two steps, you should now have a fade transition applied to any page you wrap with AnimatedPage.  The "Customization" section of the GitHub repo shows all the props that are currently available to customize the transition to your liking.

**What's next?**
I am working hard to build out this library and spread awareness about how easy it is to now add page transitions!  If you have any ideas for the project, or would like to contribute, please submit a [new issue](https://github.com/ThePlugJumbo/react-page-animations/issues) or check out the [contribution guide](https://github.com/ThePlugJumbo/react-page-animations/blob/main/CONTRIBUTING.md).  Thank you for reading!
Let's explore Objects Methods in JavaScript
Published: 2022-12-04 15:14:10

Objects in JavaScript are collections of Key/Value pairs. The values can consist of properties and methods. This post will go over important built-in object methods.

## Object.create()
Used to create a new object and link it to the prototype of an existing object.
```javascript
const person = {
     isHuman: false,
     printIntroduction: function() {
          console.log('My name is ${this.name}. Am I a human? ${this.isHuman}')
     }
}

const me = Object.create(person)

me.name = 'Mursal'
me.isHuman = true

me.printIntroduction()
// Expected Output: "My name is Mursal. Am I a human? true"
```

## Object.keys() and Object.values()
**Object.keys()**: Creates an array containing the keys of an object
**Object.values()**: Creates an array containing the values of an object
```javascript
const num = {
     one: 1,
     two: 2,
     three: 3
}

console.log(Object.Keys(num)) // ['one', 'two', 'three']
console.log(Object.Values(num)) // [1, 2, 3]
```

## Object.entries()
Used to create a nested array of the key/value pairs of an object
```javascript
const num = {
     one: 1,
     two: 2,
     three: 3
}

console.log(Object.entries(num))

/*
     Expected Output
     [['one', 1], ['two', 2], ['three', 3]]
*/
```

## Object.assign()
It is used to copy values from one object to another.
```javascript
const name = {
     firstName: 'Mursal',
     lastName: 'Furqan'
}

const details = {
     job: 'Software Engineer',
     country: 'Italy'
}

// Merge the object
const character = Object.assign(name, details)

console.log(character)

/* 
     Expected Output
     {
          firstName: 'Mursal',
          lastName: 'Furqan',
          job: 'Software Engineer',
          country: 'Italy'
     }
*/
```

## Object.freeze()
Prevents modification to properties and values of an object, and prevents properties from being added or removed from an object
```javascript
const user = {
     username: 'mursalfurqan',
     password: 'thisisalwayssecret'
}

// Freeze the object
const newUser = Object.freeze(user)

newUser.password = '*******************'
newUser.active = true

console.log(newUser)

/* 
     Expected Output
     { username: 'something', password: 'thisisalwayssecret' }
*/
```

## Object.seal()
Prevents new properties from being added to an object, but allows the modification of existing properties.
```javascript
const user = {
     username: 'mursalfurqan',
     password: 'thisisalwayssecret'
}

// Seal the object
const newUser = Object.seal(user)

newUser.password = '*******************'
newUser.active = true

console.log(newUser)

/* 
     Expected Output
     { username: 'something', password: '******************' }
*/
```
Avent of Code - Day 02 - Rock Paper Scissors
Tags: adventofcode, programming, algorithms, coding
Published: 2022-12-04 13:27:13

[Advent of Code](https://adventofcode.com/) occurs at Dec 01 to 25 where each day, you will need to solve a puzzle. It is Festival and the problem statement is mostly related to Christmas.

## Day 2 - Rock Paper Scissor Game
https://adventofcode.com/2022/day/2

![image.png](https://cdn.steemitimages.com/DQmVjpe7QDjm1dNN1mirrj6YFMDQvkdqXfxquNVoGCSxNor/image.png)

![image.png](https://cdn.steemitimages.com/DQmSuiEig9G4UyT8bEtpXm5v6MFXvqiUaYGdi5rx3J1NLcG/image.png)

### Q1
```python
file1 = open("0.txt", "r")
score = 0

data = {
        "X": 1,
        "A": 1,
        "Y": 2,
        "B": 2,
        "Z": 3,
        "C": 3
}

def win(a, b):
        if a == b:
                return 0
        if a == 1 and b == 2:
                return -1
        if a == 1 and b == 3:
                return 1
        if a == 2 and b == 1:
                return 1
        if a == 2 and b == 3:
                return -1
        if a == 3 and b == 1:
                return -1
        if a == 3 and b == 2:
                return 1

while True:
        line = file1.readline()
        if not line:
                break
        line = line.strip().split()
        i, j = line
        a, b = data[i], data[j]
        if win(b, a) > 0:
                score += b + 6
        elif win(b, a) == 0:
                score += b + 3
        else:
                score += b

print(score)
```
### Q2
```python
file1 = open("0.txt", "r")

score = 0

data = {
        "X": 1,
        "A": 1,
        "Y": 2,
        "B": 2,
        "Z": 3,
        "C": 3
}

while True:
        line = file1.readline()
        if not line:
                break
        line = line.strip().split()
        i, j = line
        if j == "Y":
                score += 3 + data[i]
        elif j == "X":
                if data[i] == 1:
                        score += 3
                elif data[i] == 2:
                        score += 1
                elif data[i] == 3:
                        score += 2
        elif j == "Z":
                if data[i] == 1:
                        score += 2 + 6
                elif data[i] == 2:
                        score += 3 + 6
                elif data[i] == 3:
                        score += 1 + 6

print(score)
```

Here is an interesting read: [Rock Paper Scissor and Naive Bayes](https://helloacm.com/applying-naive-bayes-algorithm-in-rock-scissor-paper-game/)

<hr/>

### [Steem](https://steemyy.com) to the Moon!
Easy to make digital alarm clock
Tags: codepen
Published: 2022-12-04 15:12:05

<p>Just an easy and simple pure js based alarm clock. The alarm clock sound I got from freesound.org which you can find <a href="https://freesound.org/people/SieuAmThanh/sounds/397787/">here</a>. Enjoy!</p>

{% codepen https://codepen.io/iamyug/pen/BaVGvbv %}
Top benefits of using a learning management system
Tags: learningmanagementsystem, learningmanagementsystems, lms, lmssystem
Published: 2022-12-04 15:11:30

For teams or organizations hoping to fully benefit from online training, the [learning management system](http://www.eleapsoftware.com/learning-management-system/)

is crucial. It goes far beyond raising the level and standard of information. You will have more faith in
your team and be able to maximize your results with its proper application.

eLeaP learning management system is perfect for you if you have a huge audience and a range of topics
to cover. It is a step in the process of developing and creating e-learning. 

Among many other things, you
will be able to manage the content, users, and registration.
You may take your students&#39; training to the next level with the help of a solid learning management system.

A learning management system: What is it?
eLeaP Learning Management System , is a eLeaP software that allows managing all the elements linked
to the learning process.

In an LMS you will be able to host, deliver and track the content of your training. It is designed to make
the learning process easier . It is a modern and practical solution for those who are in charge of teaching
in an online environment.

You will be able to deliver all the content of your training to your audience and keep track of the
evaluations, progress and provide the necessary support so that the student feels motivated.
.
Top advantages of a learning management system
Different sectors and learning objectives employ different LMS platforms. With all the features it
provides, its use has grown over time.

Additionally, it offers the chance to save all the materials required
for your pupils&#39; instruction.
The goal of online learning is to produce in-depth knowledge that helps participants acquire or improve
their skills. Similar to academic training, corporate training emphasizes learning relevant to real-world

applications and one of its primary goals is return on investment.
It&#39;s time to learn about the key advantages this Learning Management System may provide you if you
wish to use it in your upcoming training.

Cut expenses

Costs must be managed as effectively as possible for a corporation to be profitable. In this context,
putting a learning management system in place will help us save money.
Cover letter
Published: 2022-12-04 15:10:04

[Tunjukkan portofolio dengan skill yang diminta]
[Tanya ke klien, agar ada komunikasi]
[CTA]
[Nama]
[List semua portofolio]
===
My biggest laravel and vue project is https://produkmu.id, there I use Laravel 9.x and Vue 2.7. You can also read in my medium here: url. Working with 2.6 will be easy for me. Are you going to use latest Vue 3.0 for this project?

Contact me anytime and I will be more than happy to help you.
- Andi

Below is my complete portofolio:
1.
2.
3. 

CONTOH UNTUK COVER LETTER BAGI YANG BELUM PUNYA SKILL, dan HANYA MEDIUM:

For laravel and vue, you can check in my https://medium.com/@andi/ysdkjhdu. I use Laravel 9 and Vue 2.7.  Working with 2.6 will be easy for me. Are you going to use latest Vue 3.0 for this project?

Contact me anytime and I will be more than happy to help you.
- Andi

Below is my complete portofolio:
1.
2.
3.
How to use Multiple Box Shadows in CSS
Tags: cssboxshadow, multipleboxshadow, boxshadowincss
Published: 2022-12-04 14:46:37

Hello Buddies.
We are going to talk about How to use Multiple Box Shadows in CSS in this detailed article. This tutorial goes into details on the usage of multiple box shadows in CSS.

So, let's get started.

## Syntax

```
box-shadow: horizontal-offset vertical-offset blur-radius spread-radius color;
```

## How to add Box Shadow
It's a simple and quick way to add a box shadow in any html element. As you can see, there are five parameters allowed to manage shadow appearance, color and where to show the inner side or outer side.

```
div {
    width: 250x;
    height: 250px;
    background-color: #2e8a30;
    box-shadow: 10px 10px 5px #abd7e5 inset; // inset optional
}
```

## How to add Multiple Shadows
Adding multiple box shadows on a single HTML element is really simple and easy. You can add as many shadows as you want with comma separated values just like mentioned below. You can [**generate multiple box shadows**](https://www.codersvibe.com/tools/web-tools/box-shadow-generator) quickly and easily by adjusting your values.

```
div {
    width: 250x;
    height: 250px;
    background-color: #2e8a30;
    box-shadow: 10px 10px 5px #abd7e5 inset, 10px 10px 5px #fafafa, 10px 10px 5px #000000; // and so on with comma separated
}
```

## Conclusion
It's very easy to use Multiple Box Shadows on a single HTML element. You need to add comma-separated values to add multiple shadows. You can make box shadows around the HTML element with multiple shadows.