teleren/devto huggingface dataset:
A simple RESTful service to display DEV.to stats
Tags: showdev, github, node, javascript
Published: 2021-03-11 23:41:58

So, I'm back again with another pet project I have just finished and would like to share with everyone in this article:

![Khang's DEV stats](https://dev-stats.vercel.app/?background=efefef)

👆 This is it, an image generated dynamically from a RESTful service that allows me to easily display my statistics from DEV.to anywhere. Interesting? Read on to see some background and what I learned from making this, or if you want yours, head right to my repo for instructions on how to deploy one for your own:

{% github https://github.com/khang-nd/DEV-stats %}

# The inspiration

Yes, I believe some people should have realized it, this was inspired by the [amazing idea](https://github.com/anuraghazra/github-readme-stats/) from [anuraghazra](https://dev.to/anuraghazra) which allows us to dynamically generate our Github stats and display it easily anywhere as an SVG image. I find it interesting how he could manage it, so I went and checked out his source code, and attempted the same method for my DEV stats.

# The techs

As a developer with little experience in backend, I'm just simply amazed by the idea of using the RESTful API as such, to generate an SVG image that is capable of dynamically display your data from other sources.

This is also a great start for me to get into the world of server-side JS, powered by [NodeJS](https://nodejs.org/en/) and [Express](https://expressjs.com/). So thanks to the love for JS, I was familiar with most of the things already, and after taking some hours to learn the basics about Node from a [1-hour course by Mosh](https://youtu.be/TlB_eWDSMt4) (which I really recommend), and read through some docs and articles, I got things up and running without so much trouble.

The data for my DEV stats are provided thanks to the [DEV API](https://docs.forem.com/api/). Though still in a beta stage, the API is already capable of providing a handful of information that, after some simple processing, can be displayed as statistics.

The key factor for the success of this idea is how to represent the data dynamically, in the simplest way where it may be used anywhere, and that factor is by using SVG. I also went through some guides and articles about SVG to proceed and in the end, from making this, I got to learn the basic structure of an SVG document and some common elements. The pie chart, which shows the most commonly used tags in the articles, is a little tough for my current capability, so I went and picked a simpler workaround by using the awesome [QuickChart](https://quickchart.io/) service offered by [Ian Webster](https://dev.to/iwebst). QuickChart is really convenient, be sure to check it out.

Deploying to Vercel/Heroku was also not so bad of an experience for a beginner. I also created 2 buttons for convenient instant deployment in the repository. So in summary, check out the repo and I would welcome any contribution to improve or extend it. Thank you for reading, and see you in the next post.
nevertheless, Tiffany coded: 2021 edition
Tags: wecoded
Published: 2021-03-11 23:38:09

last week i received my one-year badge on DEV and i realized it's been a whole year since i decided i wanted to learn how to code. my first post here was a #shecoded one, and i love it how my DEV anniversary will always mean a new reflection on my career development and a new post on #shecoded as well.

i like writing long, entertaining stories, but today i'm gonna be quick and do a little throwback.

**so, one year ago i...**
- had just decided i wanted to learn Python
- had a career producing videos and digital content
- had something deeply missing in my life
- was bored to death

**and today i am...**
- studying for a degree as a back-end developer
- looking for a full career change - sending my cv to every internship opening i see
- overcharged with work-study-housework balance
- learning how to cook (very, VERY) quick and healthy meals
- lacking sleep and with a deeper coffee addiction (but i quitted smoking, so yay?)

switching careers is never easy - you have ALL the student responsibilities, plus ALL the freelancer worker responsibilities, plus ALL the household responsibilities. 

am i exhausted as i have never been? hell yeah.
coding is a major part of my life right now? nope
studying for university sucks all of my time and enerdy? yup
do i want my bed right now? yes please

but nevertheless, i am coding - and i have never been happier :)
Stop living in a bubble
Tags: people, community, acceptance, behavior
Published: 2021-03-11 23:36:08

---
title: Stop living in a bubble
published: true
description: Stop seeking for acceptance.
tags: #people #community #acceptance #behavior
cover_image: https://static.onecms.io/wp-content/uploads/sites/6/2016/12/true-detective-wp-2000.jpg
---

Stop being self-important.

Stop seeking for acceptance.

Stop seeking for approval.

Stop denying you may be not interesting to people.

That things you work on may be not interesting to people.

That your opinions may be not interesting to people.

Your value is not derived from the amount of likes.

Or the amount of followers.

Or the amount of interest.

You're the one deciding your own value.

If you're living in a real world you know a few things.

Not everybody's nice.

Not everybody likes you.

Not everybody shares your views.

Not everybody thinks you're smart.

Should you care?

No. That's all okay.

The only thing you should care about is your own critical thinking.

Your own analytical mind.

Your own moral grounds.

Your own attitude.

Your own views.

Your own analysis and synthesis.

And acceptance that not everybody does, or ever will, accept you.

Stop being defensive.

Stop living in a bubble where everybody's your friend.

Not everybody supports you.

Not everybody roots for you.

And that’s okay. 

Find allies you can truly rely on,

and pop the bubble.

(cover image copyright belongs to Michele K. Short/HBO)
Day 327 : Random Call
Tags: hiphop, code, coding, lifelongdev
Published: 2021-03-11 23:31:01

_liner notes_:
- Professional : Had a pretty diverse set of things happening today. Got to sit in on an International Women's Month celebration event my company was having. Got to hear from some folks within the organization and their experiences. One person actually built a physical "Flappy Bird" clone. After the presentations, we all got to talk with each other in virtual meeting rooms. Got to meet some other people doing cool things inside and outside the company. After that, worked on my WebXR x Web Components x Vonage Communication APIs demo application for a presentation x blog post I've got coming up. I actually had to figure out how to make the 3D assets I would need. Thank goodness for Microsoft Paint 3D! haha Still have to play with some styling and add some logic, but I'm almost there! With all the stuff that I would have had to learn if I started from scratch, I'm super happy with the progress I've made in like a week.

- Personal : Last night, I went to Publix to get some sushi and other things. Because I bought sushi, the cashier asked if I was going to watch anime. haha We got to talking about "Attack on Titan" haha. Random. Got to my parking spot and listened to some tracks for the radio show and got the data saved to the database to display on other pages. I did this for both events and users. Came together pretty well. I had to do a compound query in Firestore and it took a little while for the Firebase dashboard to finish building so I went to bed. Next morning, I checked and all the subset of data was loading in the order I wanted.

![Looking into a green lush mountain valley in Geislergruppe, Italy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f65h7hrqa37obwnat2i.jpg)

After work, I had a meeting with some folks from the radio station. They wanted my feedback on some iOS and Android apps they want to build for the station. I mostly do Web technologies, but I was able to be a listening board and give some suggestions on the design and functionality. It was a good talk. Totally loss track of time. Going to get another lap in around the park and head to my spot. Probably work on my demo application and maybe get it to the point where it's semi functional. I'll also probably go through some more tracks and work a little on my side project's admin panel.
Sidenote: I've been getting random calls on my Pixel 4a. It was a cool feature that will screen the call for me automatically and I can see who's calling and why. I don't give that number out so it's mostly spam.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube G-xUs4rHLro %}
macOS Apps should need User Permission before being able to Autostart
Tags: security, privacy
Published: 2021-03-11 23:02:55

macOS has significantly beefed up security recently with the addition of privacy access prompts. Since macOS Mojave 10.4, mac apps need explicit permission before accessing things like microphone, camera, and the full disk. Permission can be easily revoked through system preferences.

![Screen Shot 2021-03-11 at 5.59.19 PM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/264ggzyc2esit7vyu0lo.png)

*Prompt example for Chrome to access camera on Big Sur*

![System Preferences privacy tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tzavdesf86b6dnn1489e.png)
 
As you can see, Discord can currently access my microphone, however, I can instantly revoke that access. 

This limits malware and other nefarious program's ability to automatically access privacy features.

However, macOS has no such prompt for adding auto-launch scripts called LaunchAgents and LaunchDaemons. Any application, once opened, can automatically make itself start on login or on boot. macOS apps can also hide themselves from the dock, allowing applications to run automatically in the background without user knowledge. 

macOS provides no GUI means to remove LaunchAgents/LaunchDaeomons. The only way to remove them is to find the plist file and manually trash it. What's worse is there are 5 possible locations they can exist making it nearly impossible for the average user to stop an app from auto-starting:

- /Library/LaunchAgents/
- /Library/LaunchDaemons/
- /System/Library/LaunchAgents/
- /System/Library/LaunchDaemons/
- ~/Library/LaunchAgents/

(Technically without SIP disabled it couldn't exist in `/System/`, but that still leaves 3 possible locations)

For legitimate apps, Apple provides the ability for users to add and remove "Login Items" through System Preferences. But LaunchAgents and LaunchDaeomons completely bypass this menu.

This isn't just an issue for malware and other malicious software. Legitimate apps such as Spotify have taken advantage of this and auto-start by default. Spotify gives the ability to disable it but the setting is listed deep in their "advanced" settings section. Notice how auto-start is enabled in Spotify but is not listed in System Preferences:

![Spotify and System Preferences](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iu94gr2q6y82tf1ttoer.png)

Therefore, macOS should add a prompt requirement for adding LaunchAgents and LaunchDaemons. They should also replace the "Login Items" menu in System Preferences with a consolidated GUI interface to manage startup scripts, giving users the ability to remove existing scripts and add new ones. Maybe even add the ability to schedule times to auto-open applications.
How to embed the content of a file to a variable in Golang
Published: 2021-09-21 17:14:43

---
title: How to embed the content of a file to a variable in Golang
published: true
date: 2021-03-11 23:00:00 UTC
tags: 
canonical_url: https://devmarkpro.com/embed-file-variable-golang
---

In [this article](https://devmarkpro.com/working-big-files-golang/), we were talking about how to deal with a large file in Golang. But have you ever seen yourself in a situation that just wanted to read a file and load its entire content to a variable and work with it? I have been in the same situation a lot. For example for reading a specific configuration from a file and somehow, this file is always there! I mean you know that you need that file to build/run your application. Let's talk about it in code, Imagine we have a file named `config.txt` with the content below:

```
I am a file that you need me ;)

```

And wanted to read this file.

```
package main

import (
    "fmt"
    "io/ioutil"
    "log"
    "os"
)

func main() {
    file, err := os.Open("config.txt")
    if err != nil {
        log.Fatalf("missing config file: %v", err)
    }
    content, err := ioutil.ReadAll(file)
    if err != nil {
        log.Fatalf("could not read config file: %v", err)
    }
    fmt.Println(string(content))
}
// output: I am a file that you need me ;)

```

if the code above sounds familiar to you, I have great news for you, Go offers a better, nice, and shorter way to do that. There is a package called [embed](https://golang.org/pkg/embed/) do all of it for you in a single line. All you need is just pass the file path in a directive above your variable

```
package main

import (
    _ "embed"
    "fmt"
)

//go:embed config.txt
var content string

func main() {
    fmt.Print(content)
}
// output: I am a file that you need me ;)

```

That's it! you have the content of the file in the content variable! do you need to have it in `[]byte`? you just need to change your variable type.

```
package main

import (
    _ "embed"
    "fmt"
)

//go:embed config.txt
var content []byte

func main() {
    fmt.Print(content)
}
// output: [73 32 97 109 32 97 32 102 105 108 101 32 116 104 97 116 32 121 111 117 32 110 101 101 100 32 109 101 32 59 41]

```
vuejs e django
Published: 2021-03-11 22:38:36

Olá caro leitor, sou gustavo pereira.
Vim aqui escrever sobre um pequeno projeto que fiz com django e vuejs.


Bom, vamos lá.

tudo esta neste [repo](https://github.com/GustavoGarciaPereira/entrevista)


O backend fiz em django: se encontra na pasta "backend" ,
clonado o repositório e entrando na pasta, pode criar um virtualenv,
```bash
   pip install -r requirements.txt
```
para instalar todas as dependência que precisa. 
atualmento o back esta rodando no heroku, [aqui](  https://cadastros-usuario.herokuapp.com/usuario/lista-usario/)



Front-end 
Entrando na pasta 
```bash
cd cadastro-entrevista/
yarn
yarn server
```

e o front esta rodando no github pages link [aqui](https://gustavogarciapereira.github.io/entrevista/)

pretendo fazer um post mais detalhado no futuro
mas se interessou pode olhar o readme.

obrigado e abraço!
Learning Word Associations-Word Embeddings.
Tags: nlp, machinelearning
Published: 2021-03-11 22:03:46

Word Embeddings converts a word to an n-dimensional vector. Words that are related such as ‘desk’ and ‘table’ map to similar n-dimensional vectors, while dissimilar words such as ‘car’ and ‘pen’ have dissimilar vectors. Through this representation, a word’s meaning is reflected based on its embedding hence a machine learning model can learn how words in a given document relate to each other. The benefit of this method is that a model trained on the word ‘desk’ will be able to react to the word ‘table’ even if it had never seen that word in training. To tackle the high-dimensional issues, word embeddings use pre-defined vector space such as 200 to present every word. The vector space dimension is fixed regardless of the size of the corpus. Most word embedding dimension varies between 8 dimensional (for small datasets), up to 1024 dimensions when working with large datasets.

Higher-dimensional embeddings can capture detailed relationships between words but take more time to learn. The vector space then has each word as a vector represented with values within the defined dimension. To determine the vector representation values, two techniques can be adopted depending on factors such as time resource needed and accuracy. These are the Continuous Bag of Words (CBOW) approach and the Skip-gram approach.

When using the Continuous Bag of Words method, a neural network is used to inspect the immediately surrounding context words and predict a target word that comes in between. The Skip-Gram method, on the other hand, uses a neural network to inspect the target word and predict the immediately surrounding context words. For regular terms, CBOW works much faster and has a slightly better accuracy while Skip-gram works well with small quantities of data, and even with uncommon words or phrases.

Also important that using this method for feature extraction is feasible when you have lots of data.
input[type=time] polyfill for IE, Safari etc
Tags: javascript, opensource, npm, github
Published: 2021-03-11 21:54:57

Hi all,
I searched everywhere one polyfill for time input under IE, Safari and other dumb browsers but it doesn't exist 😮

So if you need it too, I've created one as an npm package.

Here everything you need! 🚀

- 📦 Npm package - [https://www.npmjs.com/package/input-time-polyfill](https://www.npmjs.com/package/input-time-polyfill)
- 🕶 GitHub repo - [https://github.com/epavanello/input-time-polyfill](https://github.com/epavanello/input-time-polyfill)
- 💻 Demo polyfill - [https://codepen.io/epavanello/pen/RwoqVvx](https://codepen.io/epavanello/pen/RwoqVvx)
- 💸 Sponor me - [https://github.com/sponsors/epavanello](https://github.com/sponsors/epavanello)
- ☕ Buy me a coffee - [https://www.buymeacoffee.com/epavanello](https://www.buymeacoffee.com/epavanello)

_Money, likes, stars, coffee and love are appreciated_ ❤
A sane network protocol for email, to end attacks and promote productivity
Tags: javascript, go, opensource, security
Published: 2021-03-11 21:34:28

The _mnm_ project enables a new email network, via a sane, simple protocol, and client & server apps which speak it.

[mnmnotmail.org](https://mnmnotmail.org)
[twitter.com/mnmnotmail](https://twitter.com/mnmnotmail)

The project has had 9 preview releases since Spring 2019.

It's 100% open source. Contributors (and patrons) welcome!
TIL: Zoom Raise Hand Hot Keys
Tags: todayilearned
Published: 2021-03-11 21:28:12

Zoom meetings are a regular part of Dev Life.

Today I learned there is a hotkey to raise/lower your hand in a meeting:
- Windows: `Alt+Y`
- Mac: `Option+Y`
- Linux: S.O.L.

References:
- [Raising your hand in a webinar](https://support.zoom.us/hc/en-us/articles/205566129-Raising-your-hand-In-a-webinar)
- [Hot keys and keyboard shortcuts](https://support.zoom.us/hc/en-us/articles/205683899-Hot-keys-and-keyboard-shortcuts)
Is it true that good programmers do not use the "else" clause?
Tags: codingskills, selfimprovement, linkedinposts
Published: 2021-03-11 21:11:22

###### I am always posting provoking post on my Linkedin, and I have decided to replicate those here. [Let's socialize!](https://www.linkedin.com/in/alexsandro-souza-dev)

I think that is not a fair statement, but in my opinion, programmers that were lucky enough to meet an inspiring mentor or work in a smart team would rarely use it.

If you use "else if", that is more serious, I would suggest you go learn about cyclomatic complexity.

Notice that this post is not about simple "ifs and elses", but about coding skills and self-improvements
[TS nugget] Record<Keys, Type>
Tags: typescript, todayilearned, english
Published: 2021-03-11 20:36:56

For years now I wrote my data bags like this.
```typescript
export inteface Foo {
  bar: {
    [key: string]: string;
  };
}
```

To be honest, I always felt kind of disgusted about it...
But today, I learned the elegant way.

```typescript
export interface Foo {
  bar: Record<string, string>
}
```

May the elegant code be with you my coding friends!

[To the doc!](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeystype)
Serverless functions with Vercel
Tags: node, vercel, serverless, javascript
Published: 2021-03-11 20:26:54

With Vercel, you can deploy Serverless Functions, which are pieces of code written with backend languages like NodeJS, that take an HTTP request and provide a response.

You can use Serverless Functions to handle user authentication, form submission, database queries, custom slack commands, and more.

In this article, we'll create a simple Serverless function with NodeJS, and then deploy it in Vercel.

## Create project with an API endpoint

Initialize `npm` project

```
$ npm init -y
```


Now we need to create a folder called `/api` where our API endpoint files will be.

In this example, we are going to create a file called `hello.js`, with the following content:

```
module.exports = (req, res) => {
    res.json({
        hola: 'mundo'    
    })
}
```


Your project now looks like this

![VSCode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vm5or9mb9q1qf5hcyw6w.png)

In this example our endpoint service will respond with a JSON with the following structure:

```
{
	hola: 'mundo'
}
```


## Deploy to Vercel

Previously you need to install and configure [Vercel CLI](https://vercel.com/download).  


```
$ npm i -g vercel
```


In terminal, at the root of the project write:

```
$ vercel
```


![Vercel CLI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/voibizmdx5e1vrwukrnm.png)

Now in the Vercel web dashboard you'll see your project and the project URL

![Vercel Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wugczr28rjyd15cx6bv1.png)

Now, let's test our service in browser, go to the project URL, and remember to add the API Path, in this case is `/api/hello`

![Test in browser](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu0u30x6iu2ojl5v8alq.png)


That's all... Now it's your turn, create all the endpoints you need in your API, just remember that each endpoint is a file.

thanks for reading me... and Happy coding ...
Where do you find Hackathon?
Published: 2021-03-11 20:26:21

I never did a hackathon and I really want to do it some. But where do you find hackathons?

I saw there are some hackathons with Dev.to and I recently found the platform **[devpost.com](https://devpost.com/)** where hackathons are open to all. And all the others were dedicated to hackathons for students. But are there other platforms?

Thanks for your help! 😀

---

### Platform list:
- DevPost : https://devpost.com/
- EventBrite : https://www.eventbrite.ca/ [Thanks Sean Alaback]
- MeetUp : https://www.meetup.com/ [Thanks Sean Alaback]