teleren/devto huggingface dataset:
Create an Instagram downloader API with Nodejs
Tags: javascript, node
Published: 2021-06-17 20:52:36

Hi, I'm Hossein, In this article, I'll show you how to create your Nodejs Instagram photo and image downloader.
To start our project we need to install dependencies:
`npm init
npm install node-html-parser axios`
After installation dependencies have done, Create an index.js file and put the codes below into it:
```javascript
const axios = require('axios');
const { parse } = require("node-html-parser");

const instagramPostLink = "https://www.instagram.com/p/CD5um-vHA33/";

async function getPostLink(url) {

  url = url + 'embed' + '/captioned';


  let res = axios.get(url).then(async (response) => {
    const root = parse(response.data);

    let link = "";
    if (response.data.search("video_url") != -1)
      link = getVideoLinkFromHtml(response.data);
    else
      link = root.querySelector('img.EmbeddedMediaImage').getAttribute("src");


    
    
 
    while (link.search("&amp;") != -1) {
      link = link.replace("&amp;", "&");
    }
    let caption =await getCaptionFromHtml(response.data);

    return {link,caption};

  });

  return res;

}

async function getCaption(url) {


  url = url + 'embed' + '/captioned';

  let res = axios.get(url).then((response) => {

    let caption= getCaptionFromHtml(response.data);

    return caption;

  });

  return res;

}

async function getCaptionFromHtml(html) {


  const root = parse(html);

  let caption=root.querySelector('.Caption')?.text;
  if(caption == undefined)
      caption="No caption";
    
  caption=caption.replace("view all comments","");
  return caption;

}

function getVideoLinkFromHtml(html) {
  let crop = "{\"" + html.substring(html.search("video_url"), html.search("video_url") + 1000);

  crop = crop.substring(0, crop.search(",")) + "}";

  return JSON.parse(crop).video_url;
}

(async ()=>{
    await getPostLink(instagramPostLink);
})();

```
Some trouble with download the Instagram app is it needs a login, So we are use the embed Instagram posts to download that. 
And Instagram can't block this way, Because so many sites use that.

[Do you like to create animated emojis for your website? Click this link.](https://dev.to/hosseinmobarakian/animated-emojis-for-web-firstone-1eh1)
Some Process to Speed Up Laravel Application
Tags: laravel, laravelspeed
Published: 2021-06-17 20:48:47

It is very important for every website to quick load that means your website should load in few seconds like 4 or 5. We are always fetching issues about page speed like how to increase website speed in laravel, how to reduce loading time of website in laravel, is it possible speed up php execution time of my website, how to optimize php laravel script to increase speed, how to speed up web browsing in laravel. So basically you have several question regarding to improve your website performance in laravel 6, laravel 7 and laravel 8.

However, There are several composer packages available for increase website page speed in php laravel. So here i found "laravel-page-speed" composer package for 35%+ optimization of your website.

laravel-page-speed package will minify HTML output and it can be optimization your web page. laravel-page-speed package will delete unused attributes in HTML tags, delete unused quotes in HTML tags, delete unused prefixes from URLs, delete unused whitespace in HTML, delete HTML comments. Also there are several feature. They also minify css and minify js files. There are several things done with this page and i am sure it make better performance at it was before.

[Some Process to Speed Up Laravel Application](https://www.codecheef.org/article/some-artisan-commands-to-speed-up-laravel-application)
Using React-Redux to create the illusion of has_many
Published: 2021-06-17 20:47:47

So here was the problem:  I had a single deck of cards and I wanted to remember the card(s) I pulled out at any given time, even AFTER putting the card(s) back in the deck.

My original thought was that this was a backend issue.  A Draw has_many Cards, and a Card belongs_to a Draw.

```ruby
class Draw < ApplicationRecord
   has_many :cards
end

class Card < ApplicationRecord
   belongs_to :draw
end

create_table "draws", force: :cascade do |t|
   t.string "card"
end

create_table "cards", force: :cascade do |t|
   t.string "name"
   t.integer "draw_id"
end
```
But what if I didn't want a single Card to be permanently tied to a Draw?  What if I wanted that relationship, but also wanted it to part of other Draws?   So I added 'optional' to the relationship.

```ruby
class Card < ApplicationRecord
   belongs_to :draw, optional:  true
end
```
Which was closer... but it still made me uncomfortable thinking that the pristine deck of Cards sitting in my database would ever have a relationship with a single Draw.  Enter React-Redux.

My thought was that a Draw doesn't need a specific Card, exactly, it needs the ID of a Card.  So the first thing I did was change the schema.

```ruby
create_table "draws", force: :cascade do |t|
   t.integer "card"
end
```
Then on my frontend I created a method that give me a random number based on the length of an array and convert that number to an index in the array.

```react
getRandomItem = (arr) => {
   const randomIndex = Math.floor(Math.random) * arr.length);
   const item = arr[randomIndex];
   return item.id;
}
```
The, when submitting my form for a new Draw, I could call on this method and for the argument use the Card Array. 

```react
handleSubmit = (e) =>{
   e.preventDefault()
   let formData = {
      card: this.getRandomItem(this.props.cards)
   }
   this.props.createDraws(formData)
}
```
This populated my Draw instance on the backend with a number that I saved as Draw.card.   Then, when rendering a Draw back on the frontend I could just access that number and find the Card associated with it.

```react
const Draw = props =>{
   let draw = props.draws.draws[props.match.params.id - 1]

   return(
      <div>
         Card Name: {draw && (props.cards.length > 0) ? <props.cards[draw.card - 1].name} : null
      </div>
   )
}
```
And there you have it!  A faux has_many relationship built almost entirely on the frontend of my app.  Pretty sneaky React.  Pretty sneaky.
STEAM Camp at Hocking College
Tags: augmentedreality, lensstudio, snapchat, teaching
Published: 2021-06-17 20:34:13

This week we host STEAM camp at Hocking College. I am excited to share the world of augmented reality (AR) and digital marketing ( at least as much as possible in two hours😉).
Snapchat filters are built using free software called LensStudio. One of the nice things about diving into AR technologies is that, in my experience, the platforms are very similar across the different vendors and apps. There are three basic fundamental parts of building an AR experience:
1. Objects
2. Assets
3. Materials

While varying platforms may use a different name — the similarities are evident once you’re aware of it. The layouts and UI for the platforms I’ve worked with (LensStudio, SparkAR, and Amazon Sumerian) are also very similar which aids a great deal in the learning curve of different platforms.
If you have any questions about AR technologies, digital marketing, or more, check us out at https://withkoji.com/@HockingCollegeComputerScience or text me at 740–645–0509.
Weird rants of a new Devops + Backend engineer 😤 [18 June 21] 
Tags: devops, devjournal, distributedsystems, kubernetes
Published: 2021-06-17 18:30:26


Welcome to the weird notes of a new DevOps and Backend engineer. This is my (quite open) notebook on what was all the stuff I read and learnt. Not necessarily tech, you can just read on and understand what I am rambling on about.
### [18 June 2021]
## Stuff I learnt 📝
- I finally created my own Docker image of a gin-app and deployed it in a kubernetes pod.
- The biggest challenge? Connecting the 2 pods, our `otlp-example` and the `opentelemetry-collector`. 
- I needed to connect from pod A to port 4317 of pod B. Ofcourse, i had exposed the port in pod B using **NodePort** yet it didn't seem to work.
- What finally worked? Instead of using `0.0.0.0:4317`, I just needed to use `otel-collector.observability.svc.cluster.local:4317` psst, it's the port name (or deployment name? not sure) , then namespace, then service and so on, which is exposed by a Node Port in this other service.
- MAN ELASTIC APM IS AMAZING. LIKE. SO AMAZING TO LOOK AT THE TRACING <3
![Elastic APM Tracing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxarj2i186c1lq39p48z.png)

## Stuff I need to check out tomorrow? 📅
- Plan on figuring out how to collect logs from a pod using fluentD and exporting it to our dear `openetelemetry-collector`. 
- Use env vars to toggle the GRPC connection port.

## Stuff I want to work some day in future. 🔭
- Nothing today

Thanks for listening to the rant.
Uddeshya Singh,
Signing off.
Leetcode: Longest Substring without Repeating Characters
Tags: javascript, algorithms, programming, challenge
Published: 2021-06-17 20:26:41

#Instruction
Given a string `s`, find the length of the longest substring without repeating characters.
<br />
#What is Being Asked?
Write a function that loops through an input string to check for the longest subset of unique characters and return the length of it's size.

**example 1:** `abcdd` would return `4` because that's the contiguous amount of unique characters within the contents of the input string.

**example 2:** `bbbbb` would return `1` because there is a single unique character.
<br />
#What Does That Look Like?
I used the *Sliding Window* technique with a dynamic resize to accomplish this. A **Sliding Window** is essentially a process for traversing a data structure to compare or modify its contents. The operation looks similar to how an accordion stretches out and releases in or perhaps the movement of a caterpillar.

![Sliding Window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw2gssxjw5cvv7o32chg.png)
####Note:
Chrome uses `{}` when logging a `Set`.
Firefox uses `[]`.  
<br />
#What Do I Need to Solve?
I begin with an edge case that checks if the input string is valid and return `0` if it isn't.

I chose to use a JavaScript `Set` object as the data structure to apply the Sliding Window technique in my solution. A `Set` is a collection of unique values of any type. In this case, we'll be working with type`string`.

To compare and/or modify the characters of the input string from within the Sliding Window, I'll need two pointers.

I define two variables: `i` and `j` and set them each to `0`.

I also define a variable: `result` that will store the value of the longest substring to return and initialize it to `0`.

The iteration consists of a nested `while` loop. The `i` pointer drives the process. While `i` is less than the size of the string, each iteration will add the value of `i` to the `Set` as long as it doesn't already exist.

It then sets the `result` value using JavaScripts `Math.max()` method. This method returns the greater value of the two integers passed to it. After `result` is set, `i` increments 1 and the loop continues.

When `i` gets to a value already stored in the `Set`, `j` will remove the value from the window and increment 1 for the next iteration.

Once the while loops complete, the function will return the value stored in `longestSubstring`.
<br />
#Solution
![Longest Substring Without Repeating Characters Solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vts2qgf8w067e6700x96.png)

**Time:** `O(n)` where `n` is the number of characters in the string.
**Space:** `O(n)` where `n` is the length of the `Set`.

![Longest Substring Solution Logs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xx6k5svapc4k6shfs1o1.png)
<br />
#Conclusion
I hope this explanation of my solution was helpful in your search. This is not the only approach and I am interested to hear other peoples strategy in solving the problem. Feel free to leave a comment and let me know! Thanks for taking the time to read!
Day 95 of 100 Days of SwiftUI
Tags: swift, 100daysofcode
Published: 2021-06-17 20:23:26

 I just complete day 95 of 100 days of swiftui. Today I started the Milestone challange for project 16 - 18. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6uld6iekisalmz5m6o1.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kg7k0qdcz2de7f1cm30n.png)
How do I select one audio channel from a multichannel array in librosa?
Tags: librosa, python, scipy
Published: 2021-06-17 20:21:03

{% stackoverflow 68025673 %}
Hi all!
I am new to librosa (and python in general) and I am getting started with audio analysis. My starting wav files contain multichannel arrays. I am wondering if I can use librosa to choose a single, specific channel. As of now, I convert my files to mono as shown here:
```
import librosa

y, sr = librosa.load(file, sr=None, mono=True)
```
However, I suspect that mono=True averages the channels instead of selecting individually. Please correct me if I am wrong! I know that SciPy allows individual channel selection:
```
from scipy.io import wavfile

sample_rate, data = wavfile.read(file)
#[:,1] slices the channel array
spectrum, freqs, t, im = plt.specgram(data[:,1], Fs=sample_rate))
```
How can I slice and select an individual channel like that in librosa?

Many thanks! Much help is greatly appreciated!
Guía de configuración de Android Studio
Published: 2021-06-17 20:12:48

Finalmente estamos listos para desarrollar aplicaciones, ya sea que te hayas especializado en Java o Kotlin, necesitarás instalar y configurar Android Studio para programar tus primeros ejercicios o desarrollar una aplicación completa y list para las tiendas de aplicaciones.

#Instalando el IDE
Android Studio se encuentra disponible de forma gratuita desde su [sitio oficial](https://developer.android.com/studio?gclid=CjwKCAjwn6GGBhADEiwAruUcKkZTmYWgPegIBP1sl3Hsefc3efqilZRbQmOBJf9dwXcn9Oawend32RoCTW4QAvD_BwE&gclsrc=aw.ds), por lo que podrás descargarlo de forma segura para Windows o Mac OS. En caso de que te encuentres usando una distribución LINUX, te recomendamos instalar Android Studio desde [snapcraft](https://snapcraft.io/android-studio) para ahorrar algo de tiempo en la instalación, aunque también puedes descargar el paquete **tarball** directo desde el sitio oficial.

##Configuración especial para LINUX
###51-android.rules
En LUNIX no necesitamos instalar los drivers de nuestro teléfono para poder probar nuestras apps, sin embargo es necesario crear un archivo con el identificador del fabricante de nuestro dispositivo. 

Ejecuta el siguiente comando:

```
sudo gedit /etc/udev/rules.d/51-android.rules
```

Puedes reemplazar *Gedit* por tu editor de texto preferido. Te recomendamos llenar este archivo con todos los identificadores de fabricante que la comunidad ha recolectado en [GitHub](https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules), de este modo, Android Studio será capáz de detectar prácticamente cualquier dispositivo Android.

###Android Device Bridge
Otro de los pre-requisitos es [instalar ADB](https://www.xda-developers.com/install-adb-windows-macos-linux/), los usuarios de distros basadas en Debian como Ubuntu, pueden instalarlo mediante este comando:
```
sudo apt-get install android-tools-adb
```

los usuarios de distros basados en Fedora/SUSE pueden usar el siguiente comando:
```
sudo yum install android-tools
```

Al concluir estos pasos tendremos todo lo necesario para instalar Android Studio en nuestro sistema LINUX.

#Configuración del IDE
Al ejecutar Android Studio por primera vez nos pedirá definir una configuración básica para su funcionamiento, te recomendamos realizar la instalación standar.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92mgf4025udq3bfvdasn.jpg)

Una vez instalado ve al menú de Configure -> SDK Manager para descargar el SDK.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zaryhv9w8s4kxkwibv2.png)

Selecciona la version de android más reciente y presiona ok.

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

El SDK se descargará e instalará automáticamente, presiona finish para completar el proceso.

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

Eso es todo, ahora tienes odo lo necesario para comenzar a desarrollar.

Happy Coding!
"What are your burning questions about developer relations?" Answer to be featured on our podcast 🎧
Tags: podcast, discuss
Published: 2021-06-17 20:04:04

---
title: "What are your burning questions about developer relations?" Answer to be featured on our podcast 🎧  
published: true
description: 
tags: podcast, discuss,
---

The [DevDiscuss Podcast](dev.to/devdiscuss) begins with an interview and ends with commentary from listeners — and we like to feature the _actual_ voices from our community!

To inform an upcoming episode of the show, we'd like to know...

> ### **What are your burning questions about developer relations (i.e. DevRel)?**

For your chance to hear your actual comments on an upcoming episode, answer the question above by:

- Calling our Google Voice at +1 (929)500-1513 and leave a message 📞

- Sending a voice memo to pod@dev.to 🎙

- OR, leaving a comment here (we'll read your response aloud for you) 🗣

Please send in your recordings by Wednesday, June 23th at Midnight, ET (9 PM PT, 4 AM UTC)

#### Voice recordings will be given priority placement 😉
SRE Expert? Job Hunting?
Tags: sre, devops, career
Published: 2021-06-17 19:49:12


We're a fun, dynamic team of developers who are passionate about code and creating great solutions for our high profile public and private sector clients. We're looking for an SRE expert to join us full time ASAP. Competitive salary. Great work atmosphere.

If you're curious about our ways of working then check out this exercise on GitHub. If you fancy doing it and you get it right, you'll automatically go straight to interview: http://ow.ly/2JFw50F9tFw

For those that prefer a more traditional "cv and chat" process please send your cv and a short cover letter to laura.hillman@catapult.cx

Thanks, looking forward to hearing from you all!
New Composer plugin in Magento 2.4.3
Tags: magento, adobe, ecommerce, composer
Published: 2021-06-17 19:02:46

---
title: New Composer plugin in Magento 2.4.3
published: true
description: Issues with Composer dependencies are very common to happen, some related to integrity, but security issues too. That's why Magento 2.4.3 applied a new verification routine via a new Composer plugin. It's going to perform integrity checks during the Composer installations.
tags: Magento, Adobe, ecommerce, composer
canonical_url: https://rafaelcg.com/blog/developer/new-composer-plugin-in-magento-2-4-3/
cover_image: https://i1.wp.com/rafaelcg.com/wp-content/uploads/2021/06/Adobe-Releases-New-Composer-Plugin-with-Magento-2.4.3-Release.jpg
---

Issues with Composer dependencies are very common to happen, some related to integrity, but security issues too. That's why Magento 2.4.3 applied a new verification routine via a new Composer plugin. It's going to perform integrity checks during the Composer installations.

Frequently we use private and public composer package repositories to deliver code to Adobe Commerce and Magento Open Source merchants. While Composer allows for a convenient experience, it can introduce certain limitations and occasional risks.

Adobe audits the private composer package repository at [repo.magento.com](https://magento.com/blog/best-practices/repo.magento.com), including performing a malware scan and package upload validation. However, it is possible for a malicious user to claim an unused namespace on the public package repository at [packagist.org](https://magento.com/blog/best-practices/packagist.org) and upload a malicious code package. The plugin is currently available to both Adobe Commerce and Magento Open Source merchants on the [Magento GitHub](https://github.com/magento/composer-root-update-plugin).

The plugin performs two checks and throws an exception when: 

-   If the private repositories cannot be reached. It tries to reach the package sending a request for the repo.
-   A package is present in private repositories and Packagist (public repository) simultaneously. The version of the package that satisfies the requirement from the public repo is higher.

Adobe will release the new composer plugin in Adobe Commerce 2.4.3 on August 10. The plugin will also be integrated into the Extension Quality Program since release 2.4.3. To avoid EQP failure, no exception might be generated by the composer plugin conditions.

To prevent problems with updating your code on the Magento Marketplace, we recommend you to:

-   Use the composer plugin while testing your extensions' installation flows.
-   Verify that you own your namespace on [Packagist.org](https://magento.com/blog/best-practices/Packagist.org).

Are you ready for the upgrade? [Let's talk](https://rafaelcg.com/contact/) and create a plan of action!
Linux Useful Commands
Published: 2021-06-17 18:59:04

Find duplicate entries in text file
`sort file.txt | uniq -d`

Grep showing the line number
`grep -in 'text to find' file.txt`

Get file lines
`wc -l file.txt`

Show only file name
`ls -1 *.*`

Find and delete files
`find . -type f -name "*.ico"  -exec rm {} \;`

Find and rename files with sed
```
find <search-path> -type f -name "*.txt*" | while read FILENAME ; do 
      NEW_FILENAME="$(echo ${FILENAME} | sed -e "s/<search>/<replace>/g")";
      mv "${FILENAME}" "${NEW_FILENAME}";
  done
```
Abstract Keyword in Java
Tags: java, abstract, programming, interview
Published: 2021-06-17 18:45:52

Today revising the abstract keyword. Interface uses abstract keyword  implicitly. Let's see in detail about the abstract keyword in every scenario.
1.Variable 
2.Class
3.Method 

###1.Variable
A variable cannot be marked as abstract.

###2.Class 
I) If a class is marked as abstract ,it cannot be **instantiated** i.e you cannot create an object of that class. 
II)If another class extends an abstract class it has to compulsorily override all the methods in that class.

```
abstract class A{
abstract public void m1();
}
//SOLUTION 1:class B has to override all the methods of class A 
class B extends A{
    
}
//SOLUTION 2:class B can mark itself as abstract as shown below

class B extends A{
    
}

```

###3.Method 
I)If a programmer does not know the implementation of a method it can mark itself as abstract.
II)An abstract method should be an abstract class
NOTE:
AN abstract method should not have a body.
```
abstract public void display();
```

Below is just a small program to demonstrate the use of abstract 
```
abstract class A{
abstract void m1();        //m1() is abstract so class A shd be abstract
}

abstract class B extends A{
 void m1(){
   System.out.println("A");    //B overrides m1()
}

abstract void m2();
}

abstract C extends B{
//class C doesn't know the implementation of m2 and hence it marks itself as abstract.

void m3(){
  System.out.println("C"); 
}}

class D extends C{
} //This alone will give COMPILE ERROR BECOZ D MUST OVERRIDE m2()

```
That's all for abstract keyword.If any mistake or any info which I missed,please feel free to correct me in the comments.

Happy Learning :)