teleren/devto huggingface dataset:
Okay, now what?
Tags: beginners, career
Published: 2020-09-25 18:11:59

If you're like me, you're on your last submittable retrospective of a 6ish month coding bootcamp. 

If you're like me that bootcamp is called Lambda School of Computercraft and Codery.  

If you're like me, that means you've probably lost a job, got a job, lost a job, secured a new job, lost that job because of a pandemic, lost your health insurance twice during that time, went on unemployment during this time, lost your unemployment during this time, and survived the highest hazardous air quality ever.

If you're like me, sitting in your kitchen drinking a hot cup of coffee, smacking a fruit fly from the air, you're surely thinking, "Alright, I made it to this point now what?"

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

I'll admit, that came out a bit more dramatic than I meant for it to sound. The thing about trying to make drastic changes is that it feels like an impossible task.

I know I'm in a better spot. Now poised to enter into a new career that can potentially make it so rent is easier to come up with. Lingering, though, is the sense of not knowing if you're good enough, know enough, capable, or just going to be lucky enough. 

That's a pretty scary load, so instead I'm going to try to do something I never do. 

## Focusing on what I've accomplished and work towards new things.

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

Currently, I'm working on my portfolio. (Yes, I know, I should have had this done already.) 
I had an idea a night or two ago to make my portfolio interactive by dragging and dropping icons into a launch zone to make modals pop up showing the corresponding information. 

The reason I bring this up, is because 6 months ago I'd never of been able to articulate what I wanted to do in a way that would allow me to research and figure out how to do that. Manipulating the state, using useEffect, adding eventListeners? These are normal everyday things now, but ask me a couple months ago what they meant and I'd of made up something silly to catch a chuckle. 

On a whim I wanted to make this feature, just because I could. And it's working.

*Well, almost*
I'm still working on it, and isn't that the best part? I get to spend the day building something, which is awesome.

What makes it so awesome is that I have these new skills and abilities that I've acquired and its not even close to the end of learning. Imagine how boring it would be to just know all the things. 

That's how I know that I'll be okay and have found a career path that makes sense for me. Even on my worst days, I can always find solace in the fact that just being curious is part of the job requirements. I've got an endless supply of curiosity. 

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

So when I ask "What's next?" The answer isn't as easy as saying "Job, house, money", though those would be very nice. Maybe just accepting that I don't know what is next, but can find the answers if I apply myself - just like learning to write code - I can move the dial towards "next".
Day 12 - Making A Search Function: Rest Countries Part II
Published: 2020-09-25 17:54:58

Today I worked on building the filter, search and header components of my rest countries API. So far so good!

![mobile view] (https://media.giphy.com/media/9rNS1n32Mtjo2qrXdk/giphy.gif)


## What I Learned
Given a search value, I use the function below to filter names typed in search bar component.

![index of ](https://dev-to-uploads.s3.amazonaws.com/i/t3hsf004999j3qvflcfk.png)

It helps suggest some countries I am looking for. But it doesn't take into account to search the letters in order so I wanted to refine this. So if I search 'n' any country with an 'n' in it will be returned. If I continue typing to 'ne' regardless of the order, any countries with 'ne' within itself will be returned.

![example of search](https://media.giphy.com/media/wGYztc7TiT5wjqjQ7W/giphy.gif)
<figcaption>Good. But could be better.</figcaption>

What's happening? The indexOf method looks for the search value inside the word of each name. If the letters it is looking for is inside the word - regardless of where it appears in the word - it will return the index. The issue is that it doesn't check if the *first* letters of the name match the *first* letters of the search value. As a person, if I am looking for the Netherlands, I expect to type 'ne' and assume the Netherlands will appear as one of the top answers.

So I created a function that uses the slice method. It will check if the first set of letters of each country name match the search value and if it does, it could be a match so return it.  I use this function to filter matches before mapping the countries to the child component.

![sliced function](https://dev-to-uploads.s3.amazonaws.com/i/va3g7jocmvwegrvw6sj9.png)

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

And it looks like it is doing what I want it to do!

![new search](https://media.giphy.com/media/7X5pBT0wAknhmshscz/giphy.gif)

Onto the next challenge!
15 Seconds of Fame!
Tags: tesla, webdev, fun
Published: 2020-09-25 17:45:20

---
title: 15 Seconds of Fame!
published: true
description: Telsa battery day 2020 projected shareholder questions.
tags: tesla,webdev,fun
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bawggyi927emc9h4uki6.jpg
---

It's not often as a web developer that the thing you work on manifests into the physical world.  This was one of those rare times.  Earlier this week Tesla projected my company's website on a big screen behind the likes of Elon Musk and team.  

For once I could show people a physical picture or youtube videos and be like, this is what I work on.  Now I'm wondering what others could do to make their website feel more physical like this.  Usually developers think in terms of urls and digital mediums.  Is there something you could do to make your projects stand out from just 1 digital property online?

Have a great weekend!
20 Questions You Should Always Ask About Symentech Technologies Before Buying It.
Tags: officecomsetup
Published: 2020-09-25 17:42:12

If you are unable to set up the Microsoft Office 365, Microsoft Office 2016 Pro, Microsoft Office House and Student 2016 or after setting up the Microsoft Office it is not working the main root cause of this issue is that the network of your computer has actually infected though some virus and Trojans which is impacting all the files of Microsoft Office like word excel, Outlook, PowerPoint, etc and the other factor could be updates or the Microsoft Office item key expired since Microsoft Office 365, Microsoft Office Home and Trainee 2016 is essentially for one year in which you need to renew it every year so to conserve that money we USA PC SUPPORT fix all kinds of Microsoft issues as our group has Microsoft Qualified Technicians and we provide you an excellent package of Microsoft Office which is for Lifetime and it will conserve your Cash. If your windows live mail not working then you require to check the security of your device it suggests your computer system needs to have virus, Trojans and it is not appropriately cleaned every maker requires to be cleaned up in every 2 to 3 months if you have installed some undesirable developers on your computer then it will badly affect your mail app. The 2nd main reason is that you have not properly upgraded the computer system and its software application's windows live mail now is an old variation another method of utilizing your e-mails is Microsoft outlook which typically is available in Microsoft office package outlook is a platform in which we will configure your e-mails in one go and you will have the ability to send and get e-mails effectively. USA PC SUPPORT supplied your latest software's for a lifetime no requirement to pay for one year or more years we offer endless technical Assistance to our customers. Cash is not our concern our intention is to keep your computer system safe and Protected. The second main reason is that you Check out the post right here have not appropriately updated the computer and its software's windows live mail now is an old variation another method of using your e-mails is Microsoft outlook which generally comes in Microsoft office bundle outlook is a platform in which we will configure your emails in one go and you will be able to send out and receive e-mails appropriately. Microsoft Office 365 is a cloud-based service extensively utilized to help you fulfill the company's requirement for dependability, productivity, and security. Microsoft Office 365 Training program is meant for Technology-Influencing Service Decision Makers who are seeking to acquire a sound understanding of how Office 365 can improve staff member efficiency, share data with ease, and finish tasks quickly. Insight of the benefits of Microsoft Office 365: Cost reliable: Office 365 is certainly the less expensive, depending on how many users your office requires.
Best Regards: <a href="https://www.office-help-office.com">office.com/setup</a>
Rails ViewComponent helper
Tags: rails, ruby, viewcomponents, tip
Published: 2020-09-25 17:39:28

Ruby Dev's like me don't like verbosity no matter how small, syntactic sugar is one of the underlying attractions of Ruby.

Rails ViewComponents are a superb addition to Rails especially when paired with utility style CSS like Tailwind.
However, repeatedly writing these `render`'s gnaws at my OCD. 
Constants in a view template, :shock:, the overloaded `render` method, all those parens! 

```
render(SomeAwesomeComponent.new) do |component|
  Render(AlertComponent.new(type: 'success') do |component|
    render(ButtonComponent.new(classes: 'justify-end ml-2 items-start')
  end
end
```

What if I told you, you could create a helper, obvious right?

more awesome, more lowercase, less parens, easier on the eyes
```
component :some_awesome_component do |awesome|
  component :alert, type: 'success' do |alert|
    component :button, classes: 'justify-end ml-2 items-start'
  end
end
```
I chose to use `component` but if you want to go super succinct, you could even do
```
vc :some_awesome_component do |awesome|
  vc :alert, type: 'success' do |alert|
    vc :button, classes: 'justify-end ml-2 items-start'
  end
end
```


This could be yours for the low low price of... reading below.


```
  def component(name, context: nil, **args, &block)
    return render_component_in(context, name, **args, &block) if context

    render component_class_for(name).new(args), &block
  end
  
  def render_component_in(context, name, **args, &block)
    component_class_for(name).new(args).render_in(context, &block)
  end

  private

  def component_class_for(path)
    name, namespace = path.to_s.split('/').reverse

    file_name = "#{name}_component"
    component_name = file_name.classify
    namespace ||= namespace(file_name)
    return "#{namespace.capitalize}::#{component_name}".constantize unless namespace == 'components'

    component_name.constantize
  end
```

What's more if you follow some design pattern like atomic, and structure your components as such, you can create a separate `namespace` method to discover the component path allowing you to communicate your design system like

```
organism :some_awesome_component do |awesome|
  molecule :alert, type: 'success' do |alert|
    atom :button, classes: 'justify-end ml-2 items-start'
  end
end
```

You can find the RailsByte here https://railsbytes.com/templates/xjNsDY
Tips for Your First Tech Talk
Tags: career, codenewbie, techtalks, todayilearned
Published: 2020-09-25 17:27:18

I just gave my first tech talk--and it went better than expected.

Since it was an internal tech talk, I can't share it here, but I spoke on and demoed how you can create a Twitter bot with Python and AWS Lambda to automate tweets in intervals for free. You can read more about it [here](https://dev.to/jeannienguyen/building-a-twitter-bot-with-python-and-aws-lambda-27jg). For those who are interested in building their own, I have included a template on my [GitHub](https://github.com/jeannienguyen).

Here's what I learned from my first **online** tech talk:

---

### **Have a summary/breakdown available**
I didn't have slides for my talk. If you don't have slides, make sure you have a summary of all your talking points handy. This will help you stay within time, while making sure you don't miss any important talking points.

### **Include code**
Have your code ready! Go over your code and make sure you know what each line is doing. Make sure you don't have unnecessary code. Feel free to leave comments to break up sections you're going to talk about.

### **Show your completed work (if possible)**
Showing the end product of the code you're speaking about is a nice way to start or end your talk. If you have it, show it!

### **Share your ideas**
Tech talks aren't only about facts. Don't hesitate to share your ideas and lessons you've learned.

---

Public speaking isn't for everyone. For those who want to step out of their comfort zone and give a talk, I hope that these tips can help you reduce some stress and ensure you're ready for your talk.
Exposing myself to the world beyond. Just need confidence that I'll be just fine
Tags: opensource
Published: 2020-09-25 17:14:26

No puns for this post. It's another blog written so soon after the last one, and I like to have at least one per week.

So, for this week, our first lab was to peer review someone else's release 0.1 as well as have someone else review mine. For me, this was an easy task since it seems many have written in either node or python. My lab partner was Mo (https://medium.com/@moho472) and he gave me some recommendations that helped me in the right direction.

The first was to make a setup.py file so that I didn't have to specify the name of the file that runs the cmd tool all the time. This also has the added benefit of downloading all the required libraries that aren't built-in. Very effective, and it let's me even call my tool as "urlChecker" instead of "urlChecker.py".

He also recommended that I switch from requests to urllib3. The reasoning for this is the complexity that the library brings in terms of what I was able to do with it compared to requests. Although they're both written for the same purposes, urllib3 allows me to grab the head much easier. This was more useful for making 'HEAD' requests, which was an optional requirement. Getting the status code was therefore faster to get since the return type of the request method was a dictionary instead of a list, allowing for O(1) time complexity with regards to searching.

In terms of issues that I had, they were mostly relegated to the regex. The rest of the code was reliant on a proper working regex.  
Once that was fixed, the rest of the work was history. The issue I made for the regex can be found here (https://github.com/HyperTHD/URLAutomationMachine/issues/1)

I also made a PR for another student in our class named TJ on some fixes and readability updates for his release 0.1 which he also wrote in python. (https://github.com/IcemanEtika/deadlinkz/pull/1) The main thing was changing his "requests.get" to be "requests.head" to optimize network requests, while also accomplishing another optional requirement for him.

Overall, it was very nerve-wracking working on another person's code, and even making the PR as well. One thing my professor wants us to get over is the "Imposter Syndrome" and opening myself up to criticism is something I'm still currently working on. I feel like I have alot of room to grow in the open source community and next month's Hacktoberfest will be where I will try to leave my mark. It felt good to have all of my issues fixed as it allowed me to present a completed project, giving me the confidence that I'll need for future projects to come. See you guys in Hacktoberfest!
Writing Javascript Promises
Published: 2020-09-25 17:13:08

To read my previous article explaining promises, go here:
https://tuts.alexmercedcoder.com/promises/

## Building a Promise

So if you read my previous article we learned what promises are and how to work with them when functions like fetch and axios return them to us. In this article I'll show you how to write your own promise.

### Why Write Promise

Basically if all the following questions get a yes response, you should write a promise.

- I have something that must be done only when something else is complete
- I don't want the rest of my code sit and wait for that something else to finish

This is exactly the situation that promises allow us to accommodate.

### Writing a basic promise

```js
const myPromise = new Promise((resolve, reject) => {
  setTimeout(() => {
    if (true) {
      resolve("The Promise has resolved")
    } else {
      reject("your promise has failed")
    }
  }, 3000)
})

myPromise
.then(value => console.log(value))
.catch(err => console.log(err))
.finally (()=>console.log("Either Way I happen"))
```

So what happened above?

1. We create a new variable myPromise
2. We assign a new Promise to the variables
3. The Promise constructor is passed a function
4. The promise function is always passed resolve/reject (I sometimes name them done/fail), which are function to determine when the promise ends.
5. setTimeout is set to run a function in 3 seconds (3000 milliseconds)
6. At the end of timeout an if statement is evaluated
7. If evaluates true the resolve function invokes sending a string value as the promises value, this would then allow any .then calls on this promise to execute
8. If evaluates false, the reject function invokes passing an error message which causes any .catch calls on this promise to get the error and execute
9. Whether the promise succeeds or fails, any .finally calls will be executed

**Test above code again except change if (true) to if (false) and see how the results change**

That's it, wrap any code whose completing should trigger other code in a promise and enjoy the world of asynchronous javascript.

## Things to keep in mind

- .then calls return a promise, so they can return a value which gets passed to any .then calls chained to that .then. (promise.then().then().then())

- Technically your code is still synchronous (a single process), what promises do is just allow the event loop to continue as an the event loop it'll evaluates the promises status on each loop. If the status is pending, the loop just continues executing other code, if resolved .then calls will then be executed, if reject then .catch calls will be executed.

- Typically under the hood of things like fetch and mongoose are event emitters that emit events when http connections are made or streams are running, and it's these events that may tell the promise to be resolved. Read my article on javascript events: https://tuts.alexmercedcoder.com/jsevents/
dotenv and relative paths
Tags: node, todayilearned, testing
Published: 2020-09-25 17:08:30

Most of you are using [dotenv](https://www.npmjs.com/package/dotenv), the famous "zero-dependency module that loads environment variables from a .env file into process.env".

Although I usually work in serverless environments like the combo node.js/AWS Lambda where `dotenv` is not required, we use it for running local Express wrappers to the node.js lambdas and to control the environment while doing unit tests.

Unless you have a clear and well know pattern for using it, you can fall into the trap of thinking that `dotenv` works like the built-in `require` function and accepts relative paths. Proximity with with `require` statements doesn't help. Something like:

```javascript
const { myfunction } = require("../mymodule.js");
require("dotenv").config({ path: `../.env.test` }); 
```

But, this will not work. 

You know why? **Dotenv does only accept absolute paths when it is configured**. The [official docummentation](https://www.npmjs.com/package/dotenv) is not very clear on that and you can spend a few hours trying to figure out why your environment variables are not loaded in our unit tests.

So my recommendation is to ellaborate your own working `dotenv` piece of code, save it safe, and reuse it every time you need to set the environment variables of your node.js apps. 

This is an example of the approach I follow.

```javascript
const { myfunction } = require("../mymodule.js");
require("dotenv").config({ path: __dirname + `/../.env.test` }); 
```

Notice we use `__dirname` function to get the path of the current module and then we append the relative path to the .env config file.

I hope this helps you and never get stuck with this trap.

Happy coding!
Container Image Scanning with Trivy
Tags: devops, productivity, kubernetes, docker
Published: 2020-09-25 17:40:55

---
title: Container Image Scanning with Trivy
published: true
date: 2020-09-25 17:01:50 UTC
tags: ["devops", "productivity", "kubernetes", "docker"]
canonical_url: https://www.joshkasuboski.com/posts/image-scanning-trivy/
---

I wanted to have some peace of mind when running random container images. Trivy let's me scan them for common vulnerabilities.

## Installing Trivy

You can find the Trivy repo on GitHub at [aquasecurity/trivy](https://github.com/aquasecurity/trivy). Installing with Homebrew is just `brew install aquasecurity/trivy/trivy`. Trivy is written in Golang so you just need to get the binary. They also have a magic script you can use

`curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin`

Once you have `trivy` in your `$PATH`, you can run `trivy` and see the options. Trivy can do a number of scans: a remote image, local filesystem, or a remote repository.

The various options make it easy to scan code repos, images before they are pushed, and third-party images you want to use.

## Scanning an image

I use [ArgoCD](https://argoproj.github.io/projects/argo-cd) and had to use an image other than the official one since I wanted multi-arch support. This saved me from having to build it myself which I've done in the [past](https://www.joshkasuboski.com/posts/build-multiarch-image/).

I wanted to scan this image for vulnerabilities (the build is open source, but you never really know). With Trivy this is as easy as `trivy image alinbalutoiu/argocd:v1.7.1`. It will download (and cache) the vulnerability database and then pull and scan the image. It then outputs a nice table of vulnerabilities as seen below. You can also filter by severity and ignore unfixed.

[![Trivy Results](https://www.joshkasuboski.com/posts/image-scanning-trivy/trivy-results.png) ](trivy-results.png)

## Next Stop CI

This is great for testing an image ad-hoc, but I want to add this to my [gitops repo](https://github.com/kasuboski/k8s-gitops) so that all images are scanned periodically. There is already a Trivy GitHub Action, but I think it's intended more for images you are building.

I also want to run something in my cluster that will periodically check all images that are running. Something like [starboard](https://github.com/aquasecurity/starboard) could be the beginning of that.
My first CLI
Tags: python, beginners
Published: 2020-09-25 16:59:18

### Summary  

This CLI is useful for checking healthy links in HTML files
The repo can be found here https://github.com/HenryZerocool/henz-cli

### Usage

Basic usage:
`henzcli {path to HTML file} {another file}`

### Features

Support colored output. Good links are green, bad links are red, broken links are gray.
Support help if you only type cli name `henzcli`
Support version info if you type `henzcli version`
Support multiple files as arguments

### Example

I included 2 HTML test files in the repo.
If I type this `henzcli index.html index2.html`
The result will look like this
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bmlcncglg3dlb5kng2av.png)