teleren/devto huggingface dataset:
Declare an OpenZeppelin Defender Environment Configuration Via Serverless Plugin
Tags: blockchain, tutorial
Published: 2022-09-24 00:17:58

This is a tutorial-style getting started guide for the OpenZeppelin Defender Serverless plugin. 

## Install Serverless

This step installs the Serverless NPM package globally and walks you through setting up AWS credentials.  

```
$ npm i -g serverless
$ serverless
```

Select `AWS - Node.js - Starter` and accept the remaining defaults. You will be walked through the creation of the relevant AWS credentials.

When the AWS setup is complete, `cd` into the project directory and run `serverless deploy` to try out the service.

Run the example function with `serverless invoke --function hello`

`serverless remove` will remove the example project from deployment.

## Download Defender-Serverless Template

[`Defender-serverless`](https://docs.openzeppelin.com/defender/serverless-plugin) comes with an example configuration you can use as a template for further development.

Initialize the example project:

```
$ sls install --url https://github.com/OpenZeppelin/defender-serverless/tree/main/template -n hello-world
```

Next, you'll need to supply your Defender Team API credentials.

```
$ yarn add dotenv
$ touch .env
```

Save your Defender API key and secret in `.env`

```
TEAM_API_KEY=
TEAM_API_SECRET=
```

Review the code in `serverless.yml`. Note the syntax for creating an Autotask (code supplied in `autotasks/index.js`) and a Relayer.

Add the following line to indicate where the plugin should look to find your environment variables:

```
useDotenv: true
```

IMPORTANT:
Ensure that you leave `ssot: false`. Setting `ssot: true` will overwrite your existing Defender configuration with that which is defined in the `.yml` file.

Deploy with `serverless deploy`

```
❯ sls deploy
Running "serverless" from node_modules
========================================================
Secrets
Contracts
Relayers
✔ Created API Key (mystack.relayer-1.key1) for Relayer (41d99bcc-8457-4615-9e18-1d7068c48e06)
✔ Created mystack.relayer-1 (41d99bcc-8457-4615-9e18-1d7068c48e06)
Autotasks
✔ Created mystack.autotask-example-1 (207c958e-699b-46c0-b9c9-550278ae1b65)
Notifications
Sentinels
========================================================
```

Running this command adds the declared configuration to your Defender instance.

You can view the Hello World Autotask by selecting `Hello world from serverless` from the Defender Autotask dashboard:


![screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8l806kjaryktb1jr96we.png)

Congratulations! With this plugin, you can quickly declare Defender configurations that you would like to reproduce or iterate on in multiple environments.

If you have developed configurations you'd like to share, feel free to post your setup on the [OpenZeppelin community forum](forum.openzeppelin.com)!
Visualize code changes and impact on users
Tags: tooling, codequality, codereview
Published: 2022-09-23 23:49:18

Code changes daily, and it is always important to check the impact of changes.
In many cases, the process of checking the impact of a change depends on how vigilant the author is in writing the code, making it difficult to detect unintended effects during the code review and QA phases.

I created [Inga](https://github.com/seachicken/inga). This tool improves software quality by detecting unintended changes at an early phase.

## How it works

Inga takes the code diff and parses it into AST to find functions and variables that are affected by the change. It then uses Language Server Protocol (LSP), which supports many languages, to further search for references.
Currently, when you submit Pull Requests, you can have CI run Inga and automatically comment analysis results.

## Next steps

Currently, the front-end is only supported for projects written in React + TypeScript and the back-end for projects written in Java, but other support can be technically increased.
In the future, it would be interesting to be able to trace the impact of changes to the back-end on the front-end. If you are interested in this project, please post your ideas on GitHub Discussions ☕️
update your superior
Tags: devjournal, webdev, beginners, deeplearning
Published: 2022-09-23 23:30:32

Given time, you'll probably reach a moment in your new company where you feel useless or not growing (or not fast enough). When this happens, make time with your superior to clear this out before you find yourself thinking on getting a new job on a new company. - it might seem like they don't want you around or probably the company is just a mess on communicating, so the best thing is to straighten out the situation instead of leaving without talking to anyone about it. :)
The Git Commands I Use Every Day
Tags: git, beginners, programming, javascript
Published: 2022-09-23 23:29:22

Git will keep track of changes you make to your project.



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


## 1. Initialize a Git repo

This will introduce Git into your project. Create a local repo. 

```
git init
```

## 2. Add Remote

Add a remote GitHub repository to your project.

```
git remote add origin git@github.com:XxxxxxX/welcomeToBrixton.git
```

## 3. Add a file to staging

move file(s) from the working directory to a staging area. The flag **.** will add all files.

```
git add .
```

## 4. Commit 

commit all staged files to Git. **-m** is a flag used to attach a commit message.

```
git commit -m "commit message"
```

## 5. Push to GitHub

This will send your project which is currently on your local machine to a remote GitHub repository. **-u** is a flag you can use to set upstream

```
git push origin <branch>
```

## 6. Log

List all the commit(s) with a hash.

```
git log
```


To go to any of the commits, copy the first few characters of the commit hash and then


```
git checkout <commit_id>
```

## 7. Status

List new or modified files not yet committed

```
git status
```

**Thank you**

<a href="https://www.buymeacoffee.com/ifeanyichima" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>

Follow me on [linkedin](https://linkedin/in/ifeanyi-thankgod-chima), [github](https://github.com/masterifeanyi) and [twitter](https://twitter.com/@ifeanyiTchima)
Message queues: SQS vs Kafka
Tags: kafka, sqs, messagequeues
Published: 2022-09-23 23:13:31

## Message queue battle royal SQS vs Kafka

Kafka and SQS are very popular message queues, for Kafka, it's a huge scale and operational pain, SQS with plug and play and far far less operational pain.

It becomes harder to choose which one to use as a developer, as a developer we will always choose the laziest approach which is SQS due to the soft process of just clicking here, and their boof you have a message queue.

When actually picking one on top of another I mean we all know that Kafka is a bit complex compared to SQS, in terms of having many brokers and partitions, replicas, and topics while in SQS you only need to specify your queue name and just publish and consume from it.

But there is more to it than the operational and development cost, what I noticed throughout my work with both is that Kafka is more oriented to handle the notion of many consumers & events is that the publisher needs to be aware of the consumer which starts having an unhealthy pattern of smart publisher that adjust the messages for each consumer, which is kinda bad as it makes the relation between publisher and consumer more coupled and strict.


To elaborate that more let's lead with a story,
So let's assume that we have a delivery system where we have many domains let's only focus on the order domain, at first we need to notify the user whenever the order is on its way, and we define that by a field status over the order's domain.

 Now we can choose whether the order domain operation is a single queue/topic or each status is a different queue/topic.
Let's go with a single queue/topic for all order operations called `orders`


![Untitled (1).jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1663425153434/py7KCoXMh.jpg)

So far there is no difference between Kafka & SQS.

Time passes and we needed to start measuring how long it takes for the order to be delivered compared to our initial estimation which is again with the status thing but different consumer this time.



![Untitled (5).jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1663973082516/T63x1tanB.jpg)
> SQS vs Kafka



With Kafka, it's very easy to add a new consumer over our `orders` topic using the consumer group notion, but for SQS it would be a new queue.
This also makes the order service know who are the consumers and what they need so every time we need to do something different with the orders we will need to modify the `orders service` to publish to a different topic as well as integrate a new different queue config.

This is the reason why I don't like the usage of SQS with a domain that requires many events.

Let me know what you think of that in the comments below
#10daysofcodechallenge by Ingressive for Good (#Day 3)
Tags: javascript
Published: 2022-09-23 22:37:03


I've just begun a 10-day coding challenge organized by Ingressive for Good and I'll be sharing my thoughts on Day 3 of the challenge.

Let me briefly describe how the challenge works before I share my experience with you. From September 21 through October 30, 2022, the challenge is to solve one common algorithm problem every day for ten days.

Today's algorithm problem was "The problem states that we need to determine if a given integer is a palindrome." It is the 9th algorithm challenge on "Leetcode.com".

How do you define a palindrome? An Oxford dictionary definition of a palindrome is a word, phrase, or sequence that reads the same both forward and backward.

I'll now discuss my algorithm solving experience. There are numerous techniques to determine whether a word, phrase, or sequence is a palindrome, but the crucial question is how to determine this using codes. 

I had to apply the two pointer algorithm to address the problem I was presented with. I initialized two position pointers, one at the beginning of the string and the other at the end, after first converting the number to a string. After then, a while loop was utilized to iterate through each element of the string while comparing and, as necessary, increasing and reducing the pointers. The sequence is not a palindrome if the values at any of the position pointers are not equal.

This task was completed in javaScript, took 162 milliseconds to execute, and consumed about 50 MB of memory.
Installing Laravel in Mac (M1)
Published: 2022-09-23 21:57:59

# Pre-Requisites
- I'll use [Homebrew](/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)") as the package manager.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

# Installing `PHP` and `componser`
- Install `php`:
```brew
brew install php
```
- Install `composer`:
```bash
brew install composer
```

# Creating a running a Laravel project
- Creating the project:
```bash
composer create-project laravel/laravel app-name
```
- Running the app project
```bash
# Change to the project directory:
cd <app-name>
# Run the server:
php artisan serve
```
Install Rails in Mac (M1)
Tags: ruby, rails
Published: 2022-09-23 21:51:17

# Pre-Requisites
- I'll use [Homebrew](/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)") as the package manager.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
- Use `.zshrc` file if we have or if not just create it, by default we can use the vim editor
```bash
# To create the file
vim ~/.zshrc
# :w to save it.
```
# Install Ruby
- Installing `rbenv`for ruby:
```bash
brew install rbenv ruby-build
```
- To use `rbenv` every time we create a new terminal session we set
```bash
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
```
- Save the changes:
```bash
source ~/.zshrc
```
- Installing Ruby:
```bash
rbenv install 3.1.2
```
**Note**: The Ruby version can be found in the official  [Documentation](https://www.ruby-lang.org/es/downloads/)
- Make Ruby's version as global:
```bash
rbenv global 3.1.2
```
- Save the changes:
```bash
source .zshrc
```
**Note**: To see if it was installed right we type:
```bash
ruby -v
```
# Installing Rails
By installing `ruby` we can use the `gem` package manager, which contains `rails`:
- Install Rails
```bash
gem install rails
```
- Reload `rbenv` to use the command `rails`
```bash
rbenv rehash
```
Note: If we install `rails` right, we can type:
```bash
rails -v
```

# Create and run a new `rails` project.
- Creating the project:
```bash
rails new proyect-name
```
> **Note**: As default `rails` use the `SQLite` database when a new project is created, we can use our own databases, such as [MySQL](https://dev.to/developemmanuel/mysql-in-mac-m1-17co), PostgreSQL, MongoDB, etc. And we can set it by typing:
>```bash
rails new proyect-name mysql
```

- Create a database for the project:
```
rails db:create
```
> **Note**: If we a database with password, we have to configured the file `config/database.yml`, and change the data from the user (for developer purposes `root`) and the password. So by making saving this changes we use rails db:create

- Running the server:
```bash
rails server
```
MySQL in Mac (M1)
Tags: mysql, beginners
Published: 2022-09-23 21:50:16

# Pre-Requisites
- I'll use [Homebrew](/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)") as the package manager.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

# Installing MySQL
- Install MySQL:
```bash
brew install mysql
```
- Before setting up MySQL we have to start the `brew services`
```bash
brew services start mysql
```
> **Note**: To stop `mysql` we set
>```bash
brew services stop mysql
```

# Setting up MySQL
### Without Password
- We just type:
```
mysql -uroot
```
and our session is on, we can exit the session by typing
```bash
mysql> exit
```
### With Password
- We type:
```bash
mysql_secure_installation
```
> **Note**: ”Validate password component" needs a secure sequence of characters to set the password, this include as minimum 8 characters and other more patterns.
> If we set `y` (yes), it'll require that pattern, if we don't want that it, we just set `n` (no).

- Recommended answers in the installation
```bash
# Remove anonymous users?:
y
#Disallow root login remotely?:
n
# Remove test database and access to it?:
y
# Reload Privilege tables now?:
y
```
- To start the mysql session with password we just type:
```bash
mysql -uroot -p
```
and it will ask the password.
Using recursion to count from startNum to endNum (freecodecamp notes)
Tags: javascript, beginners, tutorial
Published: 2022-09-23 21:21:35

In this exercise we are asked to write a  function which should return an array of integers which begins with a number represented by the startNum parameter and ends with a number represented by the endNum parameter.

So deriving from the previous example of [countup](https://dev.to/naveenkolambage/create-a-countdown-using-recursion-freecodecamp-notes-1k2m) , here is how this would work 

```javascript

function rangeOfNumbers(startNum, endNum) {

  if(startNum>endNum){
    return[]
  }
  const rangeArray=rangeOfNumbers(startNum,(endNum-1))
  rangeArray.push(endNum)
   
  return rangeArray;
};
```
Day 3 I4G 10 days of code challenge
Tags: javascript, algorithms, leetcode
Published: 2022-09-23 21:15:46

Early in the morning after I wake up, I decided to start with todays code challenge before anything else;

The problem was given an integer you return true when it's a palindrome, else return false.
Palindrome are numbers,phrase or strings that when reversed the result is the same number;
e.g 1221 is a palindrome and will return true. 1234 is not a palindrome and will return false.


The solution i think is to covert the integer to a string;
Reverse the string; 
Convert the reversed string to an integer;
Compare the original integer and the reversed Integer,
If they are the same return true
Else return false

Time complexity 
O(n)
Space complexity
O(n)
[Leetcode problem](https://leetcode.com/problems/palindrome-number/)
[Link to Implementation](https://github.com/ismaelsadeeq/I4G_coding_challenge/blob/main/palindromeNumber.js)
Privacy with PiHole DNS server and block filter
Tags: linux, privacy, wireguard, pihole
Published: 2022-09-23 21:12:35

After httpS port 443 that encrypt the connections we relax and think that all is safe.
It's can be util to avoid a gov block and censure on navigation.
But one topic that mostly of people forget is the DNS, the resolution name is first step that we go out on internet.
When you visit a site or requisite a service the request to DNS is the first action of mostly of services.
It work on port 53 and do not have any kind of the secure layer. 
The mostly popular DNS servers are cloudfare 1.1.1.1 and google 8.8.8.8 and no you cant trust in this kind of provide, imagine on local provider.
With the DNS requistion the provider can be assembly your profile according with sites that you visit, and redirect a kind of certain ads for you.
Because of this you neeed to make a DOH layer (DNS over HTTPS) or a kind of local DNS, and now that PiHole project can help.

PiHole is friendly and super light DNS service to install in a local network, and also PiHole can be filter some websites to avoid a lot of ADS, this blacklist can be download and update to keep sade, also the list block the malware urls.

The ideia is change the DNS servers of your modem/router to appoint to local PiHole server.

Then all your clients will be automatically point to the local DNS, the advantage until this point is CACHE and malware/ads block filter.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfkbkdhflmi7ewemkcia.jpg)
But the secure is not cover until this time, and on this point you need to extra service to abstract this or make the DOH. The option are Unbound for a local DNS requisition, or use a cloudfare over HTTPS, experience with both the DOH cloudfare is the better and safe solution.

The steps to install Unbound and DOH of cloudfare are very detailed on the PiHole documentation, as I said particularly the DOH is works better for me.

Now the Pihole do not appoint to 1.1.1.1 but to 127.0.0.1 5353 port that make the magic using the https layer.

If you implement this your local network will work faster because of the cache, and also because of the block content that you can manage to filter according with your necessity.
Make A Custom .zip of your code using Git Archive & .gitattributes
Tags: git, productivity, devops
Published: 2022-09-23 20:59:19

## The Problem
So I have this WordPress plugin developed, and I'm ready to submit it to for review. So I have to make a .zip file of the folder. So I right-click on the folder and click '_Compress_' right?

Well yes that works, but there's a bunch of stuff in that folder that I don't want to submit. There's a `.git`, `.github`, `/bin` folder and a bunch of stuff that the plugin doesn't need. Here's how the directory looks right now:

``` bash
.github
/bin
/core
/languages
/node_modules
/scripts
/tests
/vendor
.gitignore
.composer.json
plugin.php
```

---

## Solution \#1 - Git Archive
So I turn yet again to Google, and it provides a pretty good answer. [git archive](https://git-scm.com/docs/git-archive). 

It takes all the files that are committed to the master branch and creates a .zip file of my plugin for me:

``` bash
git archive --format zip --output \"plugin.zip\" master -0
```
Here's how my 'plugin.zip' file looks:

``` bash
.github
/bin
/core
/languages
/scripts
/tests
.composer.json
my-plugin.php
```

---

## Solution  \#1.0.1 - .gitattributes
There's another problem, here's how my .zip file looks. It excluded everything that was in my .gitignore file from the .zip, but I really don't want to submit the `/tests` folder or the `/bin` folder. So back to Google I go, and the answer is to create a [.gitattributes](https://www.git-scm.com/docs/gitattributes) file in the root of my directory.

``` bash
.gitignore export-ignore
.gitattributes export-ignore
.github export-ignore
bin export-ignore
tests export-ignore
composer.json export-ignore
composer.lock export-ignore
```

_Note: Two things got me here. No. 1, you **need to commit** the .gitattributes file before running the `git archive` command, otherwise it wont work... and No .2, adding a `/` or `./` before a folder name wont work... (e.g. `./bin export-ignore`)_

So last time, I rerun my `git archive` command and voila, super clean:

``` bash
/core
/languages
/scripts
my-plugin.php
```

---

## Next steps
It would be awesome to have this work automatically when you push it to GitHub. I imagine you could set up a GitHub action that would run some tests and then create a zip file as a release.

---

![Columbo looking like the big eejit he is](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjfc4e4vyo6nobdsgoo8.gif)


## One last thing...
Because we're lazy and we don't like remembering stuff, we can add the archive command to our .package.json. Now we just have to run `npm run archive` and we're good to go.

```
{
  "name": "...",
  "version": "...",
  "scripts": {
    "archive": "git archive --format zip --output \"mandrill-mail.zip\" master -0"
  }
}
```
Day 4 of 100: The resurgence of React-pdf
Tags: webdev, 100daysofcode, react, programming
Published: 2022-09-23 20:30:04

Yesterday's folder restructuring lead me down a string of epiphanies. One of which was to bring back react-pdf and preview my certificates on my site. So I spent the day reading the documentation and playing around with React-pdf's API. It was a very interesting few hours.

I also finally added much needed structure to my days to severely decrease my contraction of burnouts. It worked like a charm.
Phalcon v5.0.0 (and v5.0.1) Released!
Tags: phalcon, phalcon5, release, v5
Published: 2022-09-27 22:09:49

---
title: Phalcon v5.0.0 (and v5.0.1) Released!
published: true
date: 2022-09-23 20:05:39 UTC
tags: phalcon,phalcon5,release,v5
canonical_url: 
---

A﻿ long journey has come to an end and looking forward to our new journey ahead. Phalcon v5.0.0 (and v5.0.1) has been released!

W﻿e started v5 at the end of May 2020. Two years and change later, ~2,663 commits and ~760 issues/cards on GitHub, we are happy to announce that v5.0.0 stable is available for our community.

T﻿he changes to the framework are too many to list in a single blog post. We have compiled a thorough upgrade document in our documentation website, that developers can use to upgrade their applications:

[h﻿ttps://docs.phalcon.io/5.0/en/upgrade](https://docs.phalcon.io/5.0/en/upgrade)

P﻿S: We also made the search work for the docs AND it is version and language aware! /win

A﻿ huge thank you to all of the members of our community. Your comments, PRs and suggestions have helped us make this release a reality.

T﻿he best part was that we released yesterday v5.0.0, this morning a bug was discovered and we had to release v5.0.1. Thank you [@levertr](https://github.com/levertr) for reporting it!

O﻿ur full changelog for this release is located here:

[https://github.com/phalcon/cphalcon/blob/master/CHANGELOG-5.0.md](https://github.com/phalcon/cphalcon/blob/master/CHANGELOG-5.0.md)

T﻿he release is available in PECL and the IDE stubs have been generated. We will make the necessary upgrades to the supporting repositories (Vokuro, devtools etc.) this week.

O﻿nce again, huge thanks to our community!