teleren/devto huggingface dataset:
Downtime, a simple uptime/response time monitor using GitHub actions
Tags: showdev, github, monitoring, devops
Published: 2020-12-12 12:20:00

Hi there 👋, 

This is a small presentation of one of my recent projects : [Downtime](https://github.com/lowlighter/downtime), an uptime/response time monitor.

It generates SVG badges that you can use anywhere to display whether your server is up or not :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xjzv1fyw4h5zs8l998kv.png)

*The real badges are actually transparents, rendering nice on both light/dark mode*

## 📦 How to setup (< 2min) ?

It is based on the Keep It Simple Stupid philosophy, so it's super-straightforward :

0: Fork the repository
1: Edit the `config.yml` to add your hosts

The `config.yml` is just a list of domain/server/ip/port you want to monitor :

```yaml
hosts:
  # Check if google.com is up
  - name: google.com
    title: Google

  # Check if a given url is up
  - name: github.com/lowlighter/downtime
    title: Downtime repository

  # Test an ip/domain with port using ncat (any protocol)
  - name: "8.8.8.8"
    title: Google DNS
    port: 53
    use: ncat
```
2: (optional) You can also enable GitHub pages and get a webpage with all your servers status !

### ⚙️ How does it works ?

A GitHub action workflow is ran each 5 minutes, testing connections with the hosts you specified in `config.yml`. It can either use `curl` (for HTTP/HTTPS) or `ncat`/`telnet` (any protocol). It records if target is reachable and its response time.

Since it use the default `GITHUB_TOKEN` to update connection results, there is no need to create an additional personal token, keeping your account safe. 

You can also set the repository private, keeping only the GitHub pages and the badges to embed elsewhere.

### ✨ Inspiration

This has been inspired a lot by [upptime](https://github.com/upptime/upptime), but I didn't liked the fact you needed a token with a lot of permissions (especially since the workflow update itself so you need to put a lot of trust in maintainers) and that you couldn't get a status badge to tell whether your server is up or not.

Thanks for reading !
If you like generated SVG images, you may also checkout [GitHub metrics](github.com/lowlighter/metrics) !
Using KinD with Podman (kinp)
Tags: kubernetes, kind, podman, kinp
Published: 2020-12-12 12:07:37

---
title: Using KinD with Podman (kinp)
published: true
description: Use kind with podman easily with kinp!
tags: kubernetes, kind, podman, kinp
//cover_image: https://direct_url_to_image.jpg
---

I've been using kind on ec2 for a while now because I was too lazy to work around issues I was having locally.  I finally go around to writing a shell wrapper for kind today and would like to share.

If you have any issues please let me know!

Disclaimer: This has been tested to work on Fedora 33 only but should work on other systems (provided you have podman installed.

## Install kinp

```bash
git clone https://github.com/rustysys-dev/kinp.git
cd kinp

# install main script to /usr/bin/kinp
# installs library script to /usr/lib/kinp/libkinp
sudo bash install
```

## Using kinp

kinp is used exactly as you would kind. That being said, kinp will download all dependencies before running (provided they do not already exist).

Dependencies include:

- kubectl
- kind
- awscli (if AWS_ACCOUNT_ID env_var is set)

### Create cluster

```bash
kinp create cluster
```

### Check cluster

```bash
kubectl get nodes
```

### Destroy cluster

```bash
kinp delete cluster
```

## Conclusion

There you have it Kubernetes in Podman! If you have any questions or comments please let me know!
Docker Tutorial
Published: 2020-12-12 12:06:05

The aim of this Docker tutorial for beginners is to learn ‘What is Docker?’ Additionally, we will dive into more concepts such as virtualization, containerization, the need for Docker, Docker architecture, Docker installation, Docker images, and so on.
[Docker Tutorial on Tutorials Point] (https://www.tutorialspoint.com/docker/index.htm)

Docker Tutorialsimplifies the DevOps Methodology by allowing developers to create templates called ‘images’ using which we can create lightweight virtual machines called ‘containers.’ Docker makes things easier for software developers giving them the capability to automate infrastructure, isolate applications, maintain consistency, and improve resource utilization.
[Docker tutorial on Intellipaat](https://intellipaat.com/blog/tutorial/devops-tutorial/docker-tutorial/)

There might arise a question that such tasks can also be done through virtualization, then why choose Docker over it. It might be because virtualization does not turn out to be that efficient an idea.
[Docker tutorial- Getting going from scratch](https://stackify.com/docker-tutorial/)
What is a web development & why you should study it?

Published: 2020-12-12 12:04:01

In simple terms, web-Development means developing websites for the internet. Building a website is involved in the various processes to get it up for running it worldwide. Web development involves some simple processes of Coding, Programming, and designing, etc.

coding and programming enable the website to run and function properly.

⦁	The computer revolution has left every area of society untouched which leaves businesses both big and small and big seeking to enter and building an empire into the web arena. There is a surplus of opportunities for web developers to dominate.

Benefits of studying web developing 

1.	Staggering Demand: Today in this digital world every business needs a website to earn more profit even it's approach up to the big, small city, Division, province, national level, and international level. The demand for good developers is increasing very quickly, So the demand for web developers is going to grow day by day.

2.	Work Flexibility: The freedom, a developer enjoys is among in his/her work because you can work as a freelancer, part-time, full-time, for a company, for government and for yourself from remotely even on holidays you can work.

3.	Good Moola: It pays well too often a few hours of work are rewarded with a high pay which makes it extremely work while and a very sought after career choice.

4.	Qualification: No college degree is needed even you don't need any computer degree to become a web developer. You are hired on the basis of your knowledge and skills, and the portfolio of your website.

Your theory can get you in the interview, but your skill gets you into the job.

5.	Fulfilment: It requires passion, work, time to practice, and it is also based upon the consistency of your struggle. You have the potential of helping and impacting not only locally, but Globally.

⦁	If this post is not convincing you to study web development, read the lines of some biggest names.

⦁	"All my friends who have younger siblings, who are going to college or higher-School my number one piece of advice is: You should learn how to program".

			"Mark Zaukerberg", Facebook

⦁	"Learn to write program stretches your mind, and helps you to think better, create a way of thinking about things that I think is helpful in all domains "  

		"Bill Gets", Microsoft

⦁	"Learning to code is helpful no matter what your career ambitions are"

	"Arianna Huffington", The Huffington Post

⦁	"don't just play on your phone-program it".

	"Barack Obama", President

⦁	 Can you see that they are not recommending being Lawer, Docter, or Engineer?

Those are very noble/ and glorious career choices of course, but there is a pattern in which they are saying and it's no coincidence.



Don't sit back and let the years go by. Keep improving, keep moving, keep learning, put in the time and the actions and results will come.

The best time to plant a tree was 20 years ago; the best second time is right now.

SO ALWAYS KEEP LEARNING

If you find this post helpful then share it with your friends, siblings, and loving ones.
How Create Raspberry Pi OS Using Raspberry Pi Imager 📀
Tags: tutorial, help
Published: 2020-12-12 11:57:52

##Create Raspberry Pi OS Using Raspberry Pi Imager
To make your Raspberry Pi device alive (in this case i'm working with older Raspberry Pi 3 Model), you need to install some sort of OS system on it. 

Yes this may sounds like cheezy topic, but it's more likely to be tasty. It's simple and smooth to make it happend. Just start with copying OS into Micro SD card you'll plug into empty slot available on the bottom of the Raspberry motherboard.

But first thing first let's start with OS system. Plug in Micro SD card via Micro SD adapter into your laptop. Download [Raspberry Pi Imager](https://www.raspberrypi.org/software/) and install it into Application folder draging it into that place.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gs9kmuohx2h49czq2xew.png)

Open this app and press <code>CHOOSE OS</code> to select right OS you would like to go with and <code>CHOOSE SD CARD</code> to select SD you already plugged in. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8bopeoob2e0dz5c1wsy4.png)

Erasing of Micro SD card is not needed cos it's part of OS installation process. I go with Raspberry Pi OS (32-bit) recommended version as shown below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mtgvs2glxmwkmgdy9klf.png)

Now press <code>WRITE</code> button. You'll be notified about this next step that your SD will be erased and if you're sure about this next step.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/47e8lcfd1hgbahk04lsl.png)

Your actual OS will ask for its access credentials as <code>Username</code> and <code>Password</code> as shown below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a33crgv6ihx813xpzlt0.png)

Then you are rewarded by this status bar showing installation process.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/logduodbbbafntezdcsj.png)

After completion you'll see this message and you can remove SD with your very fresh Raspberry Pi OS (32-bit) version.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zujj2md62i67uv0oyrfw.png)

##Exceptional Error To Gain Access into Micro SD Card
It may exceptionally happen after you selected the <code>Operating system</code> and <code>SD card</code> type and pressed <code>WRITE</code>. You'll be notified about the error to access SD card itself.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q1093fv822g6jolmvkem.png)

In this case, go to <code>System Preferences > Security & Privacy</code> choose <code>Privacy</code> and from the left menu select <code>Files and Folders</code>. Then after scroll on the right side to look for <code>Raspberry Pi Imager.app</code> and check <code>Removable Volumes</code>.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2ek86tv2yhas2gnlnypd.png)

##Ready To Go
Now you are ready to plug in Micro SD card into empty slot on your model of Raspberry Pi.

Thanks to [Quentin Schulz](https://unsplash.com/@0leil?utm_source=unsplash&utm_medium=referral&utm_content=CreditCopyTextGratitude) for the cover image from Unsplash.
Create bootable USB from terminal
Published: 2020-12-12 11:46:50

This is for linux beginners, simple *how-to* create bootable usb from terminal. `DD` command takes input and duplicate it, and it's exactly what we need.

>Serbian Translate:
>Tutorial za linux pocetnike, kako napraviti butabilni USB iz terminala. Koristeci `DD` komandu, koja pravi duplikat zeljenog fajla.


#### 1. Full Command Explained
  
```bash
$ sudo dd if=Ubuntu.iso of=/dev/sdb bs=8M status=progress && sync
```

 - `sudo` - give you root access
 - `dd` - command to duplicate disk
 - `if` - name of file you want to write
 - `of` - name of USB device
 - `bs` - size of bytes to write at a time
 - `status` - show status progress during duplication
 - `sync` - synchronize writes  

---
#### 2. Fill Device With Zero (optional)
  
If you have some damaged fields on USB, fill it with zero first:

```bash
sudo dd if=/dev/zero of=/dev/sdb bs=8M status=progress && sync
```

 - `zero` - will delete everything on USB, including partitions  
 - Run `dd zero` BEFORE you write file to USB  
 - If you need to make a new partition, take a look at FDISK tutorial

---
#### 3. Make Process Automatic (for future use)
  
 - Symlink script in /bin/ folder to make it available within the system  

```bash
ln -s /path/to/writeusb.sh /bin/writeusb
```
 - Change download folder to any folder you want  

```bash
#!/bin/bash

#  Check Root User

  if [ $(id -u) != "0" ]; then
    echo -e "$W"" You must have root access to run this script!\n"$RS" "
    sleep 1
    exit
  fi


#  Banner

  echo -e -----------------------------------
  echo -e 	 Write USB Script
  echo -e -----------------------------------


#  Define Functions

  function list_usb_devices() {
    lsblk -l | grep sd
}

  function clean_usb() {
    sudo dd if=/dev/zero of=$DEV bs=8M status=progress && sync
}

  function write_usb() {
    sudo dd if=$NAME of=$DEV bs=8M status=progress && sync
}

#  Define Working Directory

  DIR=~/Downloads
  cd "$DIR"
  #DEV="/dev/sdb"   # To define USB device name

#  Start Script

  echo -e "Please find USB device name (example: /dev/sdb)"
    list_usb_devices

  echo -e -n "Please enter USB device name: "
    read DEV        # remove this lines if you hardcoded usb device name   

  clear && sleep 1

  echo -e "Your USB device name is: "$DEV" "
  echo -e "Your Working Folder Is: "$DIR" "

  echo -e -n "Enter a name of file to write: "
    read NAME

  echo -e -n "Do you want to fill USB with zero? (y/n): "
    read ANSWZERO

      if [ "$ANSWZERO" == "y" ] || [ "$ANSWZERO" == "Y" ]; then

        echo -e -n "Do you want to write USB after zero-ing? (y/n): "
          read AFTZERO

        if [ "$AFTZERO" == "y" ] || [ "$AFTZERO" == "Y" ]; then
          clean_usb;
          write_usb && echo -e "Process Finished!"
        else
          clean_usb && echo -e "Process Finished!"
        fi

      else
        echo -e -n "Do you want to write file to USB? (y/n): "
          read WRITE

        if [ "$WRITE" == "y" ] || [ "$WRITE" == "Y" ]; then
          write_usb && echo -e "Process Finished!"
        fi
      fi

```
JavaScript Code Daily Challenge #13
Tags: javascript, challenge, codenewbie, beginners
Published: 2020-12-12 11:44:27

# **About**

This is a series of JavaScript Code Daily Challenge. Each day I show a few solutions written in JavaScript. The questions are from coding practice/contest sites such as HackerRank, LeetCode, Codeforces, Atcoder and etc.

> Find Digits
> [https://www.hackerrank.com/challenges/find-digits/problem](https://www.hackerrank.com/challenges/find-digits/problem)

```javascript
'use strict';

const fs = require('fs');

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}
```
> Complete the function `findDigits(n)` in comment
```javascript
function findDigits(n) {


}
```
```javascript
function main() {
    const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const t = parseInt(readLine(), 10);

    for (let tItr = 0; tItr < t; tItr++) {
        const n = parseInt(readLine(), 10);

        let result = findDigits(n);

        ws.write(result + "\n");
    }

    ws.end();
}
```
Complete Guide to Web Scraping with Nodejs and Puppeteer
Tags: web, code, node, javascript
Published: 2020-12-23 13:47:05

---
title: Complete Guide to Web Scraping with Nodejs and Puppeteer
published: true
date: 2020-12-12 11:40:45 UTC
tags: web,code,nodejs,javascript
canonical_url: https://medium.com/backenders-club/complete-guide-to-web-scraping-with-nodejs-and-puppeteer-a53924a23612
---

[![](https://cdn-images-1.medium.com/max/1920/1*3ik3Vo7cR_LqlHNaJ1H0yw.jpeg)](https://medium.com/backenders-club/complete-guide-to-web-scraping-with-nodejs-and-puppeteer-a53924a23612?source=rss-8b0955f01559------2)

Web Scraping is one of the powerful tools for data collection and the complete guide to web scraping with Nodejs and Puppeteer will show…

[Continue reading on Backend Developers »](https://medium.com/backenders-club/complete-guide-to-web-scraping-with-nodejs-and-puppeteer-a53924a23612?source=rss-8b0955f01559------2)
TryHackMe -CTF
Tags: security, github, beginners, news
Published: 2020-12-12 11:26:33

[Tryhackme-CTF repo](https://github.com/edoardottt/tryhackme-ctf)

[edoardottt on TryHackMe](https://tryhackme.com/p/edoardottt)

I've posted on my GitHub account (https://github.com/edoardottt) a repository containing my TryHackMe writeups, notes and so on.

I hope It will useful for someone.. 

<3 by edoardottt
How can I make my Jar file executable on all computers?
Tags: java, help, gamedev, watercooler
Published: 2020-12-12 11:24:00

I want my application to be usable on all computers, but it only works on mine.
Apparently this has something to do with it checking for versions of Java relative to the computer(???).

I'm either a fucking noob at Java, and has no life to not be using any good tools (a.k.a. primitive, ancient, and lesser-skilled), or there aren't that many tools for it (either way, I should understand why it's not working, if I wanna work in Java).
What I want to do is convert my `.jae` which works on only my computer to a `.jar` (yes, another `.jar`, so that it's still platform-independent) that will work on ALL computers that have a JRE (native or manually installed).

Of course I'm too naive to understand any of this (since I'm so homosapien-like, I use CMDPrompt to compile and view errors (that VSCode didn't warn me of)), so, do any of you know of any tools I could use to accomplish my overall goal?


<div>
##<b><center><b>Thanks in advance! It means a lot to me.<br/>Cheers!</b></center></b>
</div>
Advent of code - Day 11
Tags: javascript, typescript, adventofcode
Published: 2020-12-12 11:20:44

Are you participating in the [Advent of code](http://adventofcode.com) this year?

If you don't know what the advent of code is, it's a website where you'll find a daily challenge (every day it gets harder). It's a really fun event, you should participate!

I try to solve the exercises using either JavaScript or TypeScript and will share my solutions daily (with one day delay so no one can cheat!). I only share the solution for the second part.

Part 1 of day 11 was a simple game of life exercise. I liked the part 2 more, it was a bit different for once.

Here is my solution for day #11:
```js
function isOccupied(rows, x, y, direction, log = false) {
  if (log) console.log(x, y, direction)
  if (!(rows[x] || [])[y]) return false
  if (rows[x][y] === 'L') return false
  if (rows[x][y] === '#') return true
  return isOccupied(rows, x + direction[0], y + direction[1], direction, log)
}

function getNextTurn(rows) {
  return rows.map((row, rowIndex) =>
    row.map((seat, seatIndex) => {
      if (seat === '.') return '.'
      const numberOfSeatTaken = [
        [-1, -1],
        [-1, 0],
        [-1, 1],
        [1, -1],
        [1, 0],
        [1, 1],
        [0, -1],
        [0, 1],
      ].filter(([x, y]) => {
        return isOccupied(rows, rowIndex + x, seatIndex + y, [x, y])
      }).length
      if (seat === '#') return numberOfSeatTaken >= 5 ? 'L' : '#'
      return numberOfSeatTaken > 0 ? 'L' : '#'
    }),
  )
}

function areEquals(rows1, rows2) {
  return rows1.map((x) => x.join('')).join('\n') === rows2.map((x) => x.join('')).join('\n')
}

let previous = input
let current = getNextTurn(previous)

while (!areEquals(previous, current)) {
  previous = current
  current = getNextTurn(previous)
}

console.log(current.reduce((acc, row) => row.reduce((acc, seat) => (seat === '#' ? acc + 1 : acc), acc), 0))
```

Feel free to share your solution in the comments!

________________________

Photo by [Markus Spiske](https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)
RESTHeart - Modern runtime for microservices - Video
Tags: rest, api, mongodb, java
Published: 2020-12-12 11:16:56

This video introduces RESTHeart, a modern, open source backend for microservices that can expose instant APIs for MongoDB.

{% youtube 9KroH-RvjS0 %}

See also:

{% link https://dev.to/mkjsix/restheart-a-java-runtime-for-microservices-50g %}
Multilanguage Site without CMS
Tags: help, javascript, discuss, webdev
Published: 2020-12-12 10:45:22

#Trying to add a language switch for a site

So I made a simple menu site and I want to add the ability to change language but I'm doing it in a very basic way and it's reseting when changing pages because of reload. Can anyone please help me with this? Any guide that I find is for wordpress and it's not helping because the site is hardcoded.
SASS (Syntactically Awesome StyleSheets)- Basics (Part 2)
Tags: css, javascript
Published: 2020-12-12 10:38:17

In the previous article, we covered some basics of SASS and defined the learning outcomes from the articles. We will cover the rest in this article.

What we will learn:-

* for loop
* each
* while
* Splitting styles into different files
* Extend properties of other class

We will finish off with all the basics in this article.

### For Loop 

We can use for loop in Sass which is not possible in CSS, Let's say you have a particular naming convention of a class and it can be easily written using for loop, Sass gives us the power to write `for loops`. Let's see how we can do it:

```css
<style type='text/scss'>
    @for $i from 1 to 6 {
        .text-#{$i} {font-size: 15 * $i};
    }

</style>

<p class="text-1">Hello</p>
<p class="text-2">Hello</p>
<p class="text-3">Hello</p>
<p class="text-4">Hello</p>
<p class="text-5">Hello</p>

```

As you can see the last number in for loop is not taken into consideration. So be careful of using the loop extremes and parameters.

### While Loop

As in the previous example, we had the loop running from 1 to 6 and we had a common class naming convention which helped us apply the looping logic. Similarly we can do it here as well i.e. we can set the condition for the while loop. Let's see how we do it:

```css
<style type='text/scss'>
  $i : 1
  @while $i < 6 {
      .text-#{$i} {font-size: 15 * $i};
      $i : $i + 1;
  }
</style>

<p class="text-1">Hello</p>
<p class="text-2">Hello</p>
<p class="text-3">Hello</p>
<p class="text-4">Hello</p>
<p class="text-5">Hello</p>

```

### Each loop:

Each loop works according to the values in the list that we want to iterate through. Let's say an example:

```css
<style type="text/scss">
   @each $color in blue, black, red {
      .#{$color}-bg {color: $color;}
    }
</style>

<div class="blue-bg"></div>
<div class="black-bg"></div>
<div class="red-bg"></div>
```

Here you can see we have three div which can individually be colored accordingly using for loop.

### Splitting Styles in different files

This is fairly easy to do as this provides a structured format of the code and how we can split the codes accordingly.

Let's say you have `component.scss` file and you want to import it, you can simply use the @import directive.

```css
@import component
``` 
That's it and you are done importing the file.

### Extending properties of other class

Let's say you want to have some properties to that of some other class, in CSS we had write that whole again but in Sass we can use the `@extend` directive and directly use all the properties in other class or what we can say is inherit the properties of the class. Let's see how we can do this.

```css
.p{
  background-color: red;
  height: 70px;
  border: 2px solid green;
}

.bp{
  @extend .p;
  width: 150px;
  font-size: 2em;
}
```
As you can see that we have inherited the properties of the upper class to the next class that we have written.

This is all about the basics of Sass, I will be going through much deeper concepts of Sass later. Do stay tuned 😊