teleren/devto huggingface dataset:
Installing OpenLiteSpeed in Ubuntu 20
Tags: webdev, tutorial, php, wordpress
Published: 2022-08-12 21:54:05

**OpenLiteSpeed** is a high-performance, lightweight, open-source HTTP web server, that helps your website load faster. Think of it as Apache, but quicker. This service is best used for WordPress websites because it makes them quicker to load compared to Apache. Let's get started configuring and setting OpenLiteSpeed up.

**Step 1: Install all the dependencies needed**
![apt-get-dependencies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3owu7hozz4invj6koiu.png)```
sudo apt-get install build-essential libexpat1-dev libgeoip-dev libpcre3-dev libudns-dev zlib1g-dev libssl-dev libxml2 libxml2-dev rcs libpng-dev libpng-dev openssl autoconf g++ make openssl libssl-dev libcurl4-openssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libzip-dev libxml2-dev sqlite3 libsqlite3-dev libonig-dev
```
**Step 2: Install OpenLiteSpeed**

```
wget https://openlitespeed.org/packages/openlitespeed-1.7.16.tgz && tar -xvzf *.tgz
```
Then, once it's done unpacking, you can move into the openlitespeed directory and run the following script.
```
cd openlitespeed
sudo sh install.sh
```
![sh_install](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63b16td7dr453yja0ps0.png)
Once openlitespeed is finished installing, you will receive a password to the admin account. This will be used to log into the web server's dashboard. 

> If you cleared the screen and cannot remember your password. You can always find it typing the following command:

```
sudo cat /usr/local/lsws/adminpasswd
output: WebAdmin user/password is admin/NmQ0ODli
```
**Step 3: Start openlitespeed**
Now it's time to start the openlitespeed service. To do that, we will use systemctl to start the openlitespeed.service
> systemctl is a a service manager used for controlling and examining the systemd system and services.
```
sudo systemctl start openlitespeed.service
sudo systemctl status openlitespeed.service
```
![starting-service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wme7s2si9lmwjfnat41e.png)
Now in a web browser, if we type http://IP:8088. You should see the following page. 
![Web-Server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rdbfumj86di8q5020by.png)
That's it! In the next chapters, we will install PHP and MariaDB.

Thanks for reading
Kenji
Golang perk series : simple read-line (CLI) in Golang vs. Node.js #4
Tags: webdev, javascript, node, go
Published: 2022-08-12 21:53:00

<u>In Golang</u> :

{% replit @projektorius96/terminal-collectInput-Go %}

<u>In JavaScript</u> :

{% replit @projektorius96/terminal-collectInput-Nodejs %}
Golang perk series : (typed) arrays – JS vs. GO #3
Tags: webdev, javascript, node, go
Published: 2022-08-12 21:50:00

### ARRAYS

- <u>UNTYPED ARRAYS</u>

<u>In JavaScript</u> :
```javascript
var nil_ = []; /* implicitly as type of int (use TS if you want to be sure) */
console.log(`${nil_.length == 0}\n`) // true
```

<br>

<u>In Golang</u> :
```go
var nil_ []int
fmt.Println(len(nil_) == 0) // true
```

<br>

---

- <u>TYPED ARRAYS</u>
  - <u>declarations</u> :

{% replit @projektorius96/Golang-arrays %}

- <u>TYPED ARRAYS</u>
  - <u>views</u> :

<u>In JavaScript</u> :
```javascript
/*var*/ primes = new ArrayBuffer(8)
/*var*/ uint8 = new Uint16Array(primes)
/*var*/ sliced_primes = uint8.slice()
console.log(sliced_primes) // Uint16Array(4) [0, 0, 0, 0, buffer: ArrayBuffer(8), byteLength: 8, byteOffset: 0, length: 4, Symbol(Symbol.toStringTag): 'Uint16Array']
```

<br>

<u>In Golang</u> :
```go
func main() {
        primes := [4]int{}
	var sliced_primes []int = primes[0:len(primes)]
	fmt.Println(sliced_primes)
}
// try oneself on : @https://go.dev/play/
```
> **NOTE** : In JavaScript TypedArrays are limited of one specific type you choose to have in the container , whereas DataView (heterogenous data _in fancy terms_) can be used as a "translator" eliminating boundaries "of one type" for TypedArrays (homogenous data _in fancy terms_) .

> **TIP** : with reference to explanation above , in Node.js 
runtime we would use `Buffer.from()` !

---

- <u>**Slicing the arrays**</u> :

<u>In JavaScript</u> :
```javascript
  // Task : slice each season's months into dedicated variable & print it :
function main(){
  var full_year = ["Jan", "Feb", "March", "April", "May", "June", "July","August", "September", "October", "November", "December",]
  var winter = full_year.slice(0,2) winter.unshift(full_year[11])
  var spring = full_year.slice(2,5)
  var summer = full_year.slice(5,8)
  var autumn = full_year.slice(8,11)
  console.log(full_year, winter, spring, summer, autumn)
}
main()
```

<br>

<u>In Golang</u> :
```go
package main 

import (
  . "fmt"
)

func main(){
  full_year := []string{"Jan", "Feb", "March", "April", "May", "June", "July","August", "September", "October", "November", "December",}
  
  /* --- */
  
  // Task : slice each season's months into dedicated variable & print it :
  var winter = append([]string{}, full_year[11], full_year[0], full_year[1])
  var spring = full_year[2:5]
  var summer = full_year[6:9]
  var autumn = full_year[9:12]
  Println(full_year, winter, spring, summer, autumn)
} 
```
Building a YT Analytics / Post Scheduler
Tags: react, webdev, node, help
Published: 2022-08-12 19:42:02

Hi, i am going to try (and hopefully succeed) a Youtube app as a Saas, now, i already know the Stack i will be using (or not, kkkkk),
i am going to use React obviously and probably NextJs , for the backend normal NodeJS, now here it comes the problem, database, i have no idea of what type of database (postgres,mysql...) or service ( aws, azure... ) To use, RIP. Can someone help me? i know this is going to be hard, that's why i am going to make it first as a personal object and later if it works as intented and with no bugs... i would scale it to a Saas and offer it at a price!
Soooooo, can someone help me on choosing the stack in terms of storaging users and their information, + the actual post scheduler (this one i quite know what to do already, my problem would be more of how to handle the upload/save the videos to my database and make the script know which ones to post ( i know on this case i can do " NodeJS calls the database every minute to retrieve all the videos that need to be sent out that minute. " ))
I've seen a user use Fauna as a database for twitter scheduling, and another one (owner of feedhive.io) use AWS Amplify. I don't really know what to do in this part!
So can you help me, kek?!
Golang perk series : prefix-less functions #2.1 (2023ed.)
Tags: webdev, javascript, node, go
Published: 2022-08-12 21:46:00

### <u>"GLOBAL" FUNCTIONS</u> :

<u>Omit the global prefix : window in JS, `fmt` in Go</u> :

<u>In JavaScript</u> :
```javascript
function main(){
   /* window. */print()
}
main()
```

<br>

<u>In Golang</u> :
```go
package main 

import (
  . "fmt"
)

func main(){
  /* fmt. */Println("123")
} 
```

### <u>"Struct" is a rough objects in Go</u> :

```go
package main

import (
	. "fmt"
)

type myObject struct{
	firstName string
	lastName string
}

func definePerson(firstName string, lastName string) any {
	// similar to feature in ES6 : if parameters matches object (~struct) fields,.. 
	// ...then we can avoid repeating them, just by defining them as values i.e.:
	return myObject{
		/* firstName:  */firstName,
		/* lastName:  */lastName,
	};
}

func main() {
	res := definePerson("John", "Doe")
	Println(res)
}
```
What was your win this week?
Tags: discuss, weeklyretro
Published: 2022-08-12 21:33:55

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Hey there! 


Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Getting out into nature 

---

Have a wonderful weekend!


![Porcupines in cups saying yippee](https://media.giphy.com/media/z6z7UOgEyU0EOHTmwM/giphy.gif)
Golang perk series : intro #1
Tags: webdev, go, javascript, node
Published: 2022-08-12 21:33:00


> NOTE : This is re-factored article into Golang perk series : sub-title #_N-tuple_

---

### Intro

JavaScripter (Noder|-) who tries to learn **Go**lang (->one day may become a Gopher), let's see how it goes ... 

---

> **ANNOTATIONS** : If every time updated something new , I would give N+1 ed. or relevant upvoted in comment section ;

---

**<u>Table of contents: </u>** 

[will update soon]

---
Day 125: The brand new project
Published: 2022-08-12 21:07:26

Hi!
So today I decided to start a new project. yeah even if others are not completed yet I needed that feeling you get when you start working  on something new since it will get away I have to take advantage of it and learn as much as I can. So the project is just a simple todo app (the classic project for beginners) but it's a new one for me I never did a todo app before and since the purpose is to learn much I decided to use tech I haven't used before so I shifted from Trello to Jira, Jest to Jasmine, Github actions to Jenkins and others... I wanted to shift from GitHub to Gitlab but I think it's not really worth the hustle 
I will be trying to make time for working on this one I hope it will be fun.

there is no much planned for the weekend apart from a paper I will  be helping someone working on and maybe a bit of learning and traveling. I will see how it goes 

Signing off...
Come and look at my new site! Tell me what you think.
Tags: typescript, react, javascript, showdev
Published: 2022-08-12 20:59:00

https://dechamp.dev

## What's the big deal?

I, like most developers out there, didn't have a personal website for years. 

Why? Because too busy working really. 

Or just didn't take the time for my own needs and wants?

Either way, no more excuses. I have a website of my own! It's not a side project, it's not a clients website either. 

It's just my own beautiful partially done website.

Ain't it something?! No? Welp, it is to me and that is good enough :P

## Details?

I built it for fun, not with any other responsibilities hanging over my head. No requirement docs, no performance requirements, no old browsers to appease, no bosses to answer to. 

Welp... probably make sense that it's only partially done then ha ha. 

## It's still pretty cool.

I did actually put a lot of effort in to this site, even with giving myself no rules. 

I don't know if you noticed, but it's got loading built in. It's pretty graphic heavy for just the interface alone. 

So it's not only got individual image loading, but loading detection to black out the behind the scenes, until they are all done.

I totally did not need React for this site either. A few lines of js would have sufficed but I like React so I used it.

## Pretty cool feature

The blog area, welp. I built a script to collect all my posts from dev.to, convert them over to json files, and my site picks those up.

It's static so the script has to be ran locally to collect the files but it only take a few minutes for hundreds of articles. 

Seeing my articles appear on my site, with out much work is super awesome! 

Check out my new post on how I did it. [How to quickly get dev.to post on your site](https://dev.to/dechamp/how-to-quickly-get-devto-post-on-your-site-5cgo)

I'll probably convert the script to open source if anyone thinks it'll be useful. I could add some features to it as well. 

Welp thanks for sticking around this long. Here's the site.

https://dechamp.dev

Thanks everyone.

- DeChamp
Greetings from Latin America 🖐
Published: 2022-08-12 20:47:19


Hello Friends 🖐, thanks for accepting me in the community, I am a Latino from the south of the continent ...I don't think I can contribute much to the community because I am a novice...I am in the process of learning, but if the opportunity I will contribute in what I know,....
Well friends, I just wanted to greet you and wish you success in your projects.🙏
Bootcamp Grad Applies for Jobs
Tags: beginners, javascript, programming, jobs
Published: 2022-08-12 20:36:50

<img width="100%" style="width:100%" src="https://media.giphy.com/media/sRIXt1e9dQRjEjxnMk/giphy.gif">
## So Many Jobs
- While at boot camp, of course I looked at all the job openings there were. I figured "Maybe I'll get lucky and find one that wants a new boot camp grad in my area". I browsed quite a bit, but I never applied. With the experience and knowledge I have now, these opportunities look different. They aren't just listings of qualifications, they are request and I possibly am their fulfillment needs! LinkedIn, Indeed have now become a playground for my interest.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/Nx0rz3jtxtEre/giphy.gif">
## So Many Jobs...a Reality Check
-  After looking extensively to some of these positions, the company information, and their reviews, I saw one large trend: There was no "one to rule them all" type of way to get in. Some people got in because they contributed to open source, other got in because they knew the right person at the right time. I soon found out that I needed to do all the things, if not that, at least some of all the things. More important than anything else, it seemed I had to master the art of interviewing...not my forte. As I continued my insomnia ridden research rabbit hole (alliteration not on purpose), I discovered some interesting insights.

## So...Not Just React Router or urls.py?
- Something I discovered about truly successful engineers, more than developers, is the X-factor that lives within them. I found that engineers see the code, the data, the flow of information differently. They see it with their mind, but also their instinctual curiosity and desire for understanding. I am still discovering this super power within me when it comes to certain aspects of each stack, but the world of engineering has come to my doors. As I found out about Docker, DevOps, Terraform, I realized that this is my dream come true. An area filled with headaches, a difficulty I cannot express in words, and an opportunity to never stop learning. 


## Well?
 - I will continue to learn, and hopefully find my first developer/engineering role. Until then, I'll be smiling as I forget to capitalize one word which breaks my app. I'll go to bed frustrated that I didn't discover this world sooner, but I know it's better late than never. We all have that "person you want to be 5-years from now" persona within us. We just need to train it in the art of self-discovery.
Why Atomico js webcomponents?
Tags: webcomponents, react, preact, hooks
Published: 2022-08-12 19:24:44

---
title: Why Atomico js webcomponents?
published: true
description: Because it is light, you write fewer lines of code and it is 8.6x faster than React. 
tags: webcomponents, react, preact, hooks
cover_image: https://atomicojs.dev/assets/social-why.a6917c05.png
series: Atomico 
---

##First of all, what is Atomico? 🤔

 [Atomico](https://atomicojs.dev/) is a small library to create interfaces and applications through webcomponents with a syntax similar to React Hooks.


## Now why use Atomico? 🤓

Atomico has a size as a module of 4 kB but being bundled JS its size is less than 2.5kB (GZIP)🤯, resulting in an incredibly light code.

We will show the benefits of Atomico through a comparison, we have used as a basis for this comparison the existing counter webcomponents in [webcomponents.dev](https://webcomponents.dev/) of [Atomico](https://atomicojs.dev/), **Lit**, **Preact** and **React** as a base.

With this comparison we get to know:

1. 📦 JS Size (Library + Component) sent to browser
2. 🏃 Load time of the first render of 1000 components in the browser.
3. ✍️ Lines of code written to solve the webcomponent.

![Image why](https://i.ibb.co/Xt8qmvZ/why.png)

#### We invite you to read the full article on 👉 [atomicojs.dev/why](https://atomicojs.dev/why)
How to clone a sub directory of a git project (not a zip)
Tags: git, bash, github, gitlab
Published: 2022-08-12 19:10:19

---
title: How to clone a sub directory of a git project (not a zip)
published: true
description: Clone a sub directory of a git project.
tags: git, bash, github, gitlab
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epjs5yraqmidvxv1e7ih.jpg
# Use a ratio of 100:42 for best results.
---

Have you ever tried to get a folder from a git repository either on github, gitlab or bitbucket ?

![Final Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m93toqmbg8cgm1me7qg5.png)

hop hop hop, am not talking about Downloading a ZIP folder (like DownGit does), but only cloning a sub-directory with the git clone... command !

I got that question from a friend, and i wrote a small and interesting bash script to do so !

We're going to do that in 2 steps.

## WRITE A BASH SCRIPT FUNCTION

We're going to write a function in our `.bashrc` that will update our [sparse-checkout](https://git-scm.com/docs/git-sparse-checkout) like this :
```bash
_git_clone_sub ()
{
    REPO_NAME="$(echo $2 | grep -oE '[^/]+$')";
    git clone --filter=blob:none --no-checkout $2
    cd $REPO_NAME;
    git sparse-checkout set --no-cone "$1/*"
    if [ -n "$3" ]; then
        git pull origin $3;
        git checkout $3;
    else
        git fetch origin;
        git checkout main
        [[ $? != 0 ]] && git checkout master;
    fi
}
```
This script is quite simple, this is what it does:
- Extract the repo name from the link (github.com/author/repo-name).
- Create a git project with the repo name + add the origin from the link.
- Then update the tree configuration of our project.
- As an optional parameter, we have the branch, if it's provide, the script will clone a sub directory from that branch, otherwise, it will clone from master (you can change that with `main` if you want).

Now we can easily clone sub directories like this (after a `source ~/.bashrc`) :
```bash
_git_clone_sub subDir1 https://github.com/auth/repo
```
or by specifying the branch name :
```bash
_git_clone_sub subDir1 https://github.com/auth/repo dev-branch
```

## WRITE A GIT ALIAS

So far so good... but we can do better !
We could call that bash function from git directly by adding an alias in our `~/.gitconfig` file like this :
```config
[alias]
    clone-sub = !bash -i -c '_git_clone_sub "$@"' -s
```
Yeah yeah wait a minute, i know, that one looks weird, but let me explain... it's actually simple !

First, since we are going to run a bash function, we embrace that with 'bash -c'; then we call our function.
The `$@` is to get all arguments got using the `-s` flag at the end of the alias.
 
That's been said, you can now do :
```bash
git clone-sub subDir1 https://github.com/auth/repo
```
```bash
git clone-sub subDir1 https://github.com/auth/repo dev-branch
```

## DEMO

![DEMO](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nulatd2q852objx9f7zo.gif)

Thanks for reading, feel free to like and/or subscribe for more 🐼.
Creating a React icon library
Tags: icons, figma, react, vue
Published: 2022-08-12 19:06:44

---
title: Creating a React icon library
published: true
description: Creating a react icons library from Figma
tags: icons, figma, react, vue
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
A new library that helps creating A React/Vue/Angular Icon component library easily.
features: 
- Auto download Icons as SVG directly from figma
- Optimized using SVGO
- Supports:
   - React
   - Vue
   - React MUI

Start using it right now using npx:
```
npx @figus/cli ini
```

Documentation site:
https://www.figus.dev/
Source code:
https://github.com/figus-cli/figus
How would I do best earning money without annoying customers
Tags: android
Published: 2022-08-12 18:42:00

I searched for a place where I can ask a question like this to get experienced input. So I landed here and hope it is the right place.

I am unsure. I didn't want to implement any ads at first, but simply add a donation button, then I read Googles guidelines and saw it is not allowed. I also do not want to implement use-case-less features like stupid avatars or whatever simply to be able to sell something.

I am currently thinking of 3 other things:

1. Implement Ads but have global toggle that removes them on in-app purchase.

2. Release 2 Versions of my app, free "trial" version with ads and one without any ads whatsoever.

3. Implement in-app purchase button via google billing services for donation, however from older posts I read that it was not currently supported to use in-app purchases for donations, I couldn't find anything in the guidelines as of today though, maybe I simply missed it.


Do you have any tips? It is my first project I want to publish and I would feel really weird making it paid only, especially considering it's the first version and pretty barebones.
Need instant help i am unable to understand what and how to achieve this please help
Tags: react
Published: 2022-08-12 18:35:54

I have a boilerplate app, client-side rendered with 2 routes, home and about, development and production build scripts.

I want:
additional server-side rendering capability to build as NodeJs function to return rendered html (renderToString) for a request path.

I'll provide:
client-side rendered app, example NodeJS function

Required delivery:
source code for app including SSR build capability. the build script must produce a single index.js file that can run with the provided example NodeJS function and return rendered html for either route.
Need help with RegExr
Tags: regex
Published: 2022-08-12 18:32:00

This is the single string response I obtain via an API call:
"1. A game is a fun and entertaining way to learn new skills and knowledge. 2. Games can be used as an educational tool to teach important life lessons. 3. Games are a great way to spend time with friends and family while having fun."


However, I want to obtain and separate the numeric points individually instead of a whole paragraph-like text.
How can I achieve this with using RegExr or any other method in Javascript.

Thanks!
Abu Sayed (Website Spoofing) Beware
Published: 2022-08-12 17:49:00

Hello, I'm dealing with an individual that you have probably heard of before. This guy is stealing articles from dev.to and changing them for his own benefit. If anyone has his contact information, I'd like to obtain it. I can't seem to find it, the websites he creates are infected and have popups. 

(Make sure you have a strong firewall and antivirus; be careful the site isn't safe) Abu Sayed site: https://sayed.work/dev-feed/how-i-grew-to-become-a-freelance-web-developer-and-designer-on-upwork-with-no-expertise-you-can-too/

My article/website: https://dev.to/devknight/how-i-became-a-freelance-web-developer-and-designer-on-upwork-with-no-experience-you-can-too-3ife?