teleren/devto huggingface dataset:
Why Pivot Root is Safer Than Chroot
Tags: container
Published: 2021-01-24 02:04:36

---
title: Why Pivot Root is Safer Than Chroot
tags: container
published: true
---

## Root

The root is the top-most node in the hierarchy of a file system.

## What is Pivot Root

Pivot root (pivot_root) changes the root mount of the process.

Changing the root directory means the root directory maps to another inode in the file system.

## What is Chroot

Chroot changes the root directory of the process.

Changing the root mount means the root directory is attached to another new file system.

## Jailbreak

A jailbreak trick allows accessing files outside the changed root.

Say, if there is a link in newdir that links to a directory or file outside newdir, you may read the linked file content, despite the linked file is not under newdir. This is like a jailbreak.

## Prevent Jailbreak

Use pivot root, never use chroot.

After running `pivot_root newdir newdir/olddir`, following a second `umount /olddir; rmdir /olddir`. There will be no way you can still access any files within the olddir.
Setup Wifi in Arch Linux on MacBook Air 2013
Tags: archlinux, wifi
Published: 2021-01-24 02:03:47

So recently, my Kali OS was updates and I couldn't use the WiFi. 
I decided to just install ArchLabs on it. I love ArchLabs.
To make the WiFi work on my macbook air 2014, I needed to install broadcom-wl-dkms and linux-headers at the beginning of the installation. I don't recommend doing after because I tried that and it didn't work 😂

It was super easy to install. I personally just use i3wm and don't need those extra DE.
From GitHub Pages to Dev.to
Tags: blogging
Published: 2021-01-24 02:02:10

I've been using GitHub pages [for my blog](https://matthew-dailey.github.io/) since 2015, but I never really had much love for the platform.  Whenever the mood did strike for me to write a new post, I'd spend so much time setting up the dev environment again that I'd end up losing interest in writing before writing the first word.

{% twitter 1169079706404057088 %}

The last straw was realizing I couldn't use the Liquid template for tweets because GH pages does not have the plugin for tweets in its allow-list of plugins.  Enough was enough!

So, since the major draw of GH pages was having the power to customize layout and theme, and I really don't need that, I wanted to try out dev.to for blogging instead.  Let's see how it goes!
The journey thus so far in Wikimedia
Tags: wikimedia, outreachy21, internship
Published: 2021-01-24 01:00:06

> “Success is a journey, not a destination. The doing is often more important than the outcome.” The saying of Arthur Robert Ashe Jr., a well-known American tennis player, is true and valid for all paths of life because to reach the desired destination, it is important to pay attention and place importance on the journey that takes there.

Its has been over a month plus I started the journey as a Wikimedia intern via the outreachy program initiative and I must say it has been a series of learning and unlearning process with the help of my mentors. In December I started the contribution in improving the Lua documentation on Mediawiki and meta-wiki pages,
the first few weeks were spent on getting familiar with the environment, setting up my workspace(sandbox) with the help of my mentor and the resources provided I became familiar with the environment and fully set up to commence.

Technical writing is not just about understanding technical information and recording it in a document. Technical writing takes high-level information and processes it into digestible content for a specific audience. With the knowledge of what technical documentation entails and its role in the sustainability of a project, I was able to identify the audience and gather a lot of information, this help with coming up with a model and structure which was carefully drafted under the supervision of my mentors.

These few weeks I have worked on improving the Lua tutorial and Lua scripting documentation with the help of my mentors and I must say it has been a learning process, the need to understand what you are writing about can't be over-emphasize as it's of paramount importance and it has been an interesting ride while unlocking new skills you never know you possess.

During the cause of the internship, I have had a  couple of meetings with my mentors where ideas have been shared, and most importantly I have learned a lot from the knowledge sharing.  I most say there has been tremendous progress on the work so far.

I just wanted to leave a short thank you note to my Mentors, Wikimedia and Outreachy for this great opportunity to contribute in **Review and improve Lua documentation on meta and MediaWiki** thus the journey so far!
LeetCode 518. Coin Change 2
Tags: algorithms, javascript, dynamicprogramming
Published: 2021-01-24 00:47:37

LeetCode: https://leetcode.com/problems/coin-change-2/

#Description:
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin.

#Example 1:
```
Input: amount = 5, coins = [1, 2, 5]
Output: 4
Explanation: there are four ways to make up the amount:
5=5
5=2+2+1
5=2+1+1+1
5=1+1+1+1+1
```

#Example 2:
```
Input: amount = 3, coins = [2]
Output: 0
Explanation: the amount of 3 cannot be made up just with coins of 2.
```

#Solution: 
n = coins.length
m = amount
Time Complexity: O(n*m)
Space Complexity: O(m)
```javascript
// We will be using tabulation in this solution.
// Create a table (rows: (0 -> number of coins) x columns: (0 -> amount))
// rows -> coins we can use 
// columns -> amount we want to make
// cells -> total number of ways we can make the amount

var change = function(amount, coins) {
    // Create a table using a 2D array to store possible ways to make the amount
    // Inititate every cell to 0
    let dp = new Array(coins.length + 1).fill(0).map(()=>new Array(amount + 1).fill(0));
    // The first row in our table handles the case of using 0 coins to make a certain amount
    // There is only way to make an amount of 0 when using 0 coins
    dp[0][0] = 1;
    // Loop through all the rows in the table
    for (let rowIndex=1;rowIndex<dp.length;rowIndex++) {
        // There is 1 way to make an amount of 0 with any coin (which is to not use it)
        dp[rowIndex][0] = 1;
        // Loop through all columns in the row and find the total number of ways to make each amount
        for (let currentAmount=1; currentAmount<dp[0].length; currentAmount++) {
            // We build off of previous solutions by adding all the previous ways we 
            // made the current amount by looking at the cell located in the row above
            // our current cell [rowIndex-1] and in the same column [currentAmount]
            dp[rowIndex][currentAmount] = dp[rowIndex-1][currentAmount];
            // Is the coin we are currently looking is less than the current amount?
            // If it is then we will use the solution from a previous cell in the row of this coin
            // and add it to the current cell
            if (coins[rowIndex-1] <= currentAmount) {
                // Subtract the current coin from the current amount
                // Go to the cell in the row at [current amount - current coin]
                // Add the total number of ways in this cell to our current cell
                dp[rowIndex][currentAmount]+= dp[rowIndex][currentAmount-coins[rowIndex-1]];
            }
        }
    }
 
    return dp[coins.length][amount];
};

```
News on webpage
Tags: beginners
Published: 2021-01-24 00:42:09

so update on the webpage i am working on using w3 css and the one pic with a profile pic is the desktop and the other two are the mobile additions i do plan on getting this up onto the github but right now its a work in progress. i am using some tutorials but for ideas i guess but alot of it is from using google. Im starting to found google very useful.
React Hooks in action
Tags: javascript, programming, codenewbie, react
Published: 2021-01-24 00:02:25

# React Hooks  
If you have been developing in React since early 2019, you may have heard React Hooks or perhaps seen some hooks out in the wild in some codebases you have worked on. If not! here is a quick crash course on React Hooks. The React Hooks API was added to the React 16.8 release a few years ago. Introducing a new way of bringing the state to a functional component. As you may know state on lived in React class components prior to this release. 

# Hooks in Action 
Let's take a quick look at the two most common React Hooks that you may see in a React project.

```react 
import React, { useState } from 'react'; 

function Game() { 
// This allows us to create state and refer to our state object "score" 
const [score, setScore] = useState(0); // I can set some default state as a argument of any datatype

return (
<div>
  <p>Here is the total {score} of the game</p> 
  <button onClick={() => setScore(score + 1)}>Update Score</button> // Here we click a button to increment the state 'score' and trigger a rerender. 
</div>
);
}

```

```javascript
 import React, { useState, useEffect } from 'react'; 

function Game() { 
const [score, setScore] = useState(0); 

   useEffect(() => {
     document.title = Current Score {score} // the useEffect is a great hook to update any side-effect each time a re-render happens. 
}

)
return (
<div>
  <p>Here is the total {score} of the game</p> // refers to state value 
  <button onClick={() => setScore(score + 1)}>Update Score</button> // Here we click a button to increment the state 'score'
</div>
);
}


``` 

# Need for hooks
According to the React team, hooks emerged as the projects became very difficult to reuse stateful logic into many different components without the help from several patterns like render props and higher-order components. Hooks give an opportunity to simplify stateful logic by not relying on any complex class components and making it super easy to split up code into more meaningful functions. 

# Let's chat about hooks
So now you have more than a few things about how to use hooks in React. If you enjoyed this post feel free to leave a comment about your thoughts and experiences working with React hooks.

Happy Coding,
Terry Threatt
How to wait for all the Promises to resolve in JavaScript?
Tags: javascript
Published: 2021-01-24 00:00:00

---
  title: How to wait for all the Promises to resolve in JavaScript?
  published: true
  tags: JavaScript
  date: Sun Jan 24 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/wait-for-all-promises-to-resolve-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-c3a64f50041860705403ca9d30a73b78.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/wait-for-all-promises-to-resolve-javascript)
  
To wait for all the promises to resolve, you can use the `all()` method in the global `Promise` object and pass the promises as an array to the method in JavaScript.

### TL;DR

```js
// Promises
Promise1 = Promise.resolve("Hello");
Promise2 = Promise.resolve("Hai");

// Resolve when both promises resolve
Promise.all([Promise1, Promise2])
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

For an example, Consider 2 fetch requests which fetches 2 posts from an api like this,

```js
// 2 fetch requests for 2 posts
const fetch1 = fetch("https://jsonplaceholder.typicode.com/posts/1");
const fetch2 = fetch("https://jsonplaceholder.typicode.com/posts/2");
```

Now let's use the `Promise.all()` method and pass the 2 fetch requests as an array to the method like this,

```js
// 2 fetch requests for 2 posts
const fetch1 = fetch("https://jsonplaceholder.typicode.com/posts/1");
const fetch2 = fetch("https://jsonplaceholder.typicode.com/posts/2");

// Pass both the 2 fetch requests
// as an array to the Promise.all() method
Promise.all([fetch1, fetch2]);
```

- **The `Promise.all()` method returns another promise which will resolve only if both the fetch requests are resolved**.

- **If any one of the `Promises` passed to the `Promise.all()` method is rejected, the promise will not resolve. So be on the lookout for that**.

So now let's add the `then()` and `catch()` to the `Promise.all()` method like this,

```js
// 2 fetch requests for 2 posts
const fetch1 = fetch("https://jsonplaceholder.typicode.com/posts/1");
const fetch2 = fetch("https://jsonplaceholder.typicode.com/posts/2");

// Pass both the 2 fetch requests
// as an array to the Promise.all() method
Promise.all([fetch1, fetch2])
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

- **If all the above fetch Promises are resolved, you will get the response of both the fetch requests as an array in the `Promise.all()`'s' `then()` handler.**

See this example live in [JSBin](https://jsbin.com/zequwusoha/4/edit?js,console).

### Feel free to share if you found this useful 😃.

---
Project Explained
Tags: management, introduction, projectmanagement
Published: 2021-01-23 23:07:11

Hi Everyone,
Welcome to my first blog post.

My real name is **Samuel**.  I am a junior at Penn State University.  I am studying Information Sciences and Technology (a mix of IT and computer science kind of) and also Telecommunications (another way of saying how your phone works, this is what I tell my friends).  I am looking to pursue a career in either project management, consulting, or something to do with networks (still figuring that one out).  

Understanding ever-changing technology has always excited me.  My goal is to gain a better understanding of new technology and 5G networks.  Along with my love for technology, I have always had a passion for helping and working with people.  I am an extrovert at heart.  I enjoy working on team projects but can also work in a quiet environment to complete a solo task. 

Over the course of the past five years, I have worked at a country club as an outdoor service staff member.  While working at the country club, I have also developed a fondness towards golf.  This job has taught me an excellent work ethic, responsibility, and above par communication skills.  I also enjoy working out, traveling, and videography.  Another hobby of mine is Twitch streaming.

##Microsoft Project
Over the past year, there have been a few things I have picked up with all my **free** time.  One of these new hobbies included how Microsoft Project worked in greater detail.  The semester before, I learned the basics of what it is, and how to properly use it.  I found myself very interested in this application, and excited to use it in my future.  

I have about a semester length of experience using this application.  I still have a lot to learn on how to use the software to its fullest extent, but for now, I want to share the knowledge that I do know.  This is a very important application to understand, especially if you plan on going into project management one day.

The easiest way I could describe this would be it's an over complicated schedule.  Teams use it to know when their deliverables must be finished and how much time they have.  One creates a WBS to shorten the project into smaller deliverables that the client requests.

I explain the basics of **Microsoft Project** in the video below.

My Channel: [Nova's Knowledge] (https://www.youtube.com/channel/UCHTG-beR7gAzIzg4brepNtQ)

My First Video:[THE BASICS OF MICROSOFT PROJECT](https://youtu.be/U6N-_kW7aWU)

Over the next few months, I am really looking forward to learn more about GitHub and web design.  I have always had a creative mindset toward editing pictures and videos, and now I want to do the same with websites.

I look forward to growing with all of you and learn the art of technology together!!!
Project 2021 Devlog #3
Tags: gamedev, unity2d, learning, rpg
Published: 2021-01-23 23:05:10

Hello again! This week's entry isn't going to be very long. I really did not do much in the way of game development in the past week. The reason for my indolence is that my other career pursuit took priority for the week. 

As I mentioned in the first entry of this devlog, I stream games on Twitch in addition to making games offline. The main game that I stream is a spiritual-successor to Diablo 2 named Path of Exile. On Friday, January 15th, they released a major update and I decided to spend the week playing and streaming that instead of working on my own game. This was for two reasons: first, I wanted to take advantage of the hype around the update and give my viewers on Twitch extra footage to see all of the new additions in the update, and second, I wanted to have my own fill of the update so that I could focus on my development work going forward without feeling like I missed out. The streaming went very well, and I've had a good time with the update for myself, so I'm thinking that I'm about ready to dial the game time back and buckle down on the gamedev time instead.

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

I may not have done much this past week, but the image included in this post is the one piece of work that I have to share. It's a drawing of a scene similar to the one that I intend to begin the game with. I'm not really ready to reveal the details of it all yet so I'll leave them to your imagination for now. As time goes on, I'll release more and more concrete information, but for now it's just too early in the development process.

Thanks for reading this short little post! I'll definitely have a more substantial post for next week, so make sure to come back next Friday to read it! YEET!
The Importance of Documentation
Tags: wikimedia, outreachy21, internship
Published: 2021-01-23 22:47:18

*Hello Fellow*, its yet another blog post as part of the series on my journey as an intern with [Wikimedia](https://www.wikimedia.org/) via the Outreachy Internship Program. 

Wikimedia is a non-profit charitable organisation which has been running a lot of projects, some of them being Wikipedia, wiktionary, Wikibooks, Wikiquote, meta-wiki etc where you can contribute whenever and as much as you want. Wikimedia projects are made by volunteers, just like me and you. yes, I mean you reading this article today. In the next few paragraphs, I will be writing about my contribution to the [Lua Scripting](https://en.wikipedia.org/wiki/Lua_(programming_language)) (available via [Scribunto](https://www.mediawiki.org/wiki/Extension:Scribunto)) project.

Documentation should always be considered a journey rather than a destination, and being kept up to date with any changes is almost as important than the initial creation; out of date records can sometimes be worse than no documentation at all. Hence the need to keep comprehensive documentation can not be over-emphasize. I am currently working on **Review and improve Lua documentation on meta and MediaWiki**.

**Why Lua?**

Lua is supported as a scripting language in all Wikimedia Foundation sites (since March 2013), via the Scribunto extension. The Lua project aims to make it possible for MediaWiki end-users to use a proper scripting language that will be more powerful and efficient than ad-hoc ParserFunctions-based logic. Complex templates and ParserFunctions causes a lot of performance (some pages are overloaded with templates and require 40 seconds or more to parse/render) and bottlenecks. 

Having well-organised and up-to-date documentation makes integrations/applications easier and support systems running smoothly, and most of all keep our contributors/volunteers happy!.

I am super excited about the opportunity to make this happen.
Scoore Futball (React Hooks) 🥰
Tags: react, javascript, html, css
Published: 2021-01-23 22:41:57

Today is the day 34 of my challenge #100DaysOfCode

Scoore Futball Using React Hooks & Scorebat API 😍😎

Demo : https://scoorefutball.netlify.app/

Repo : https://github.com/saidMounaim/100DaysOfCode/tree/main/Day34

Follow me on github 

https://github.com/saidMounaim
Backdrop-filter: La propiedad detrás del Glassmorfismo
Tags: css, spanish, frontend, codenewbie
Published: 2021-01-23 22:23:13

   Mucho se ha hablado desde el año pasado sobre el glassmorfismo como una tendencia de diseño predominante en este 2021, si bien hay posiciones encontradas al respecto; debido a que algunos afirman que esta tendencia pone en peligro la accesibilidad, también hay quienes plantean a esta variante del neumorfismo como una tendencia imparable, que trae un renovado look and feel que crea la sensación o apariencia de que el usuario ve a través de un cristal.

   Para lograr tal fin es necesario cuidar de tres aspectos muy importantes en los elementos: 
    **1.** Los bordes necesariamente deben ser claros y ligeros para reforzar ese efecto de vidrio esmerilado.
    **2.** Los colores a utilizar de fondo deben ser vivos para resaltar la transparencia borrosa del contenedor y permitir la legibilidad del contenido.
    **3.** El fondo del contenedor debe tener un efecto de desenfoque.
    **4.** La sombra del elemento debe facilitar la identificación visual del mismo.

   Ahora bien, para lograr ese efecto Css nos proporciona la propiedad Backdrop-filter que permite aplicar efectos gráficos como desenfoque o cambio de color a un área en concreto, es decir ésta propiedad solo se aplica a un contenedor sin que se vean afectados los elementos que están dentro del mismo, característica que marca una clara diferencia respecto a propiedades como filter, opacity o el resultado que podemos obtener al no especificar un fondo, configurarlo como semitransparente a través de rgba o aplicar una opacidad a todo el elemento.

   Con backdrop-filter puedes aplicar efectos como: 
- gray-scale()
- sepia()
- saturate() 
- hue-rotate()
- invert()
- opacity()
- brightness()
- contrast()
- blur()
- drop-shadow() e incluso 
- url() para filtros svg

   Sin embargo para lograr este efecto del glassmorfismo solo es necesario usar blur() cuya función es aplicar un desenfoque gaussiano a la imagen de entrada. No obstante según Can I use esta propiedad aun no es compatible con todos los navegadores, razón por la que se recomienda usar la consulta @supports que te permitirá especificar declaraciones que dependen de la compatibilidad del navegador con backdrop-filter y con el cual podrás proporcionar un estilo completamente diferente al elemento para los navegadores que no lo admitan.

   A fin de que puedas ver esta propiedad en acción te presento el siguiente ejemplo donde podrás ver todos los aspectos que te mencioné con anterioridad:
{% codepen https://codepen.io/Miriali/pen/ExgzQKx %}
our proposal in #urbanhydrogeology (in Indonesian)
Tags: writing, productivity, urbanhydrogeology
Published: 2021-01-23 22:10:31

Ini adalah alur pikir kami untuk proposal riset dengan tema **urban hydrogeology**. Studi kasusnya di Surabaya. Kami melihat Kali Surabaya adalah salah satu obyek riset yang menarik.

![Wikimedia Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Riset-kolaborasi-urban-hydrogeology-surabaya-2021-pdf.pdf/page1-1600px-Riset-kolaborasi-urban-hydrogeology-surabaya-2021-pdf.pdf.jpg)
Day 9 - 100daysofcode
Tags: 100daysofcode, react, javascript, webdev
Published: 2021-01-23 22:00:15

After many days being wasted or occupied by something else I am ready to be back on track, committed to my 100daysofcode challenge

I have just completed a couple of React games
* ###Hangman
[Demo](https://hangman-v1.netlify.app/) and [Repo](https://github.com/sanchitbhasin/Hangman) can be found here.

* ###Lights-out
[Demo](https://lights-out-sanchit.netlify.app/) and [Repo](https://github.com/sanchitbhasin/Lights-Out) can be found here.

From now on I will try my best to be regular and not put a gap in.
#100daysofcode🚀🚀🚀