teleren/devto huggingface dataset:
Generic Compiler Toolchain
Tags: csharp, dotnet, compiler, llvm
Published: 2020-05-21 01:48:39

#### Background
I've always loved learning about Computer Science and using what I've learned to develop tools that enabled people's creativity. 

I took a university class on compilers in 2018 and loved every grueling minute of it. Upon finishing the course, I realized that the peak of creative tooling and Computer Science is compiler and language design. 

So, in the summer of 2019, I started to outline a project to go beyond what was taught in my compilers class; to develop tools for building compilers.

## The Motivation
Writing a compiler can be taxing, and intimidating. The goal was to create an ecosystem that not only simplifies and accelerates compiler development, but lowers its barrier to entry.

## Compilation by Configuration
GCT (Generic Compiler Toolchain) is a generalized system. A program is compiled is by feeding in language specification files along with the source program. Language specification files are simple, compact, and are written as plaintext. No fancy tools are needed to create or modify a language's specification - any text editor will do.

GCT uses the language specification files to generate a tokenizer and parser. Python plugin scripts are used as AST visitors to construct semantics, and output code.

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

Upon completing compilation, an HTML report is generated containing content collected during the compilation process. This report contains anything from tabular data, to fully-interactive models of the tokenizer or AST.

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

## Showcase Language
To demonstrate the capabilities of GCT, I developed a set of configuration files and plugins that can compile a simple high-level programming language to an executable file.

```cpp
int Fib(int a) {
    if (a <= 1) {
        return a;
    }
    return Fib(a - 1) +  Fib(a - 2);
}

void main() {
    print_int(Fib(12));
}
```

I've always been interested in exploring LLVM IR and figured this would be a great opportunity by using it in the back-end of the compiler.

## The Code
The full source code and implementation of the showcase language is available on the Github page.
{% github https://github.com/MatthewChrobak/GC-Toolchain %}

## The Internals
For more information on how GCT handles each phase of compilation, you can take a look at the documentation pages here:
[Lexical Analysis](https://github.com/MatthewChrobak/GC-Toolchain/wiki/Lexical-Analysis)
[Syntactic Analysis](https://github.com/MatthewChrobak/GC-Toolchain/wiki/Syntactic-Analysis)
[Semantic Analysis and Code Generation](https://github.com/MatthewChrobak/GC-Toolchain/wiki/Semantic-Analysis---Code-Generation)

For general usage information, you can reference [this page](https://github.com/MatthewChrobak/GC-Toolchain/wiki/Building-and-Using-GCT).
CentOS 8 Bluetooth Headset
Tags: linux, bluetooth
Published: 2020-05-21 01:47:39

On a fresh-new CentOS 8 desktop, it is not trivial to get a Bluetooth headset connected for the first time.

# Symptoms

When trying to connect to a paired headset in Bluetooth settings, it keeps failing but not error log can be seen. The logs can be retrieved by running command `journalctl -xe` and scroll up to find the read lines similar to `a2dp-sink profile connect failed for 5C:C6:E9:B9:9D:DE: Protocol not available`.

This error message tells that the bluetooth service successfully identifies the headset, but having trouble to hand over the connection to the audio service.

# Fix

The most common audio service shipped with CentOS is pulseaudio. The quick fix is to restart the pulseaudio service.

```bash
pulseaudio -k
pulseaudio --start
```

Note that both commands are meant to be run as non-root user.

# Credits

Thanks to [this question](https://unix.stackexchange.com/questions/258074/error-when-trying-to-connect-to-bluetooth-speaker-org-bluez-error-failed)
Jade AI
Tags: octograd2020, machinelearning, devgrad2020, showdev
Published: 2020-05-21 01:42:29

### What is Jade AI?
Jade's a Contextual chatbot, based on modern NLP techniques. The primary driver of the most recent version of Jade is based on OpenAI's GPT-2 (see [this post](https://openai.com/blog/gpt-2-1-5b-release)). GPT-2 uses a tranformer model to effectively and efficiently generate tokenized sequences.

### Demo & Stats
<a href="https://top.gg/bot/410253782828449802" >
  <img src="https://top.gg/api/widget/410253782828449802.svg" alt="Jade" />
</a>
You can add the bot to your server, and run `JDT [message]` (currently under a different prefix than normal due to testing) or `JD [message]` (for her previous, v5, version based on K-means & beam search)

### Pics or it didn't happen.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2fl00iyl1238egz8vlyx.png)

### Link to Code
Note: the codebase is currently incomplete!!! The trained model and training script will be uploaded soon.
{% github https://github.com/JEF1056/Jv6 %}

### A Bit of History
I started the Jade project in my freshman year in high school, knowing absolutely nothing about NLP (natural language processing) and having done very little research on chatbots or artificial intelligence algorithms. 
The very first version was really simple: it was a text file with a ton of questions and answers, and I used python to try and match the input sentence to the sentence with the most similar words in the text file, then returned the next line.
Over the years, I've explored LSTM, Seq2Seq, and K-means (with beam search) algorithms to improve the accuracy of the Jade chatbot.

### Today
Over the quarrantine period, Jade v6 was completed, acheiving a suprising 88% accuracy on new data (taken from discord). It is able to run on low-end hardware, (1 vCPU, 1.25gb of memory), and is able to maintain context/learning between discord servers without mixing up conversations.
The program runs on Python, uses the discord.py (1.3.3) library for discord interactions, pytorch for machine learning, and GPT-2 as the framework for the neural network.
Trained on my own [open-source dataset](https://www.kaggle.com/jef1056/anime-subtitles), Jade is out there and ready to converse over a lot of interesting things... <br>
<img src="https://dev-to-uploads.s3.amazonaws.com/i/8t1kpnmnr9idsz0yr3mh.png" alt="ono" width="340">
The start of it all
Tags: swift, beginners
Published: 2020-05-21 01:33:17

1. When was Swift introduced?
   A- June 2, 2014 by Apple 

2. For what platforms is Swift used as the primary programming language?
   A- Within apple devices such as iOS, iPadOS, macOS, watchOS, tvOS,

3. Which were the primary goals when developing Swift?
   A- The primary goal when developing Swift was to build a general-purpose programming language with a modern approach to safety, performance and software design patterns.
Gamma Ray Detector Simulation
Tags: octograd2020
Published: 2020-05-21 01:12:53


For my final engineering project at Swarthmore College, I designed and simulated gamma ray detector for CubeSat applications. Based on work I did at NASA Goddard Space Flight Center over the past two years, I developed a simple phoswitch detector for shoebox sized spacecraft. 
The final presentation I did on the project is [on YouTube](https://youtu.be/jIcRyhlsVyA), but I've summarized some of it below.

{% youtube jIcRyhlsVyA %}

## Design
My detector studies high energy photons, like X-rays but even higher energy. Gamma rays don't interact with materials like the film used in a dental X-ray, so gamma ray detectors measure the light produced indirectly as gamma rays go through blocks of specially chosen clear materials. In my phoswitch design, a block of plastic  a block of crystal sit on top of silicon photomultipliers, a chip that detects individual visible light photons produced in the blocks. 

In the image below, the grid of squares on the left with dots in the middle are silicon photomultipliers, and the clear block on the right is plastic wrapped in plumbing tape. The circuit board amplifies and shapes the signals so they can be recorded by an oscilloscope. 

![Plastic block on top of detector circuit board](https://dev-to-uploads.s3.amazonaws.com/i/7z2i3v4d258lybp6zy1z.jpg)

## Simulation
Since I couldn't do normal lab testing this spring to prove my design, I turned to MEGAlib, a gamma ray simulation library built on the famous particle physics simulator GEANT4. The code referenced below generates a huge numbers of gamma rays to pass through the detector and measures the energy left in the detector. The distribution of those energies is in the histogram below and a reconstruction of those gamma rays is shown in the cover photo.

![Simulated distribution of gamma ray energies in detector](https://dev-to-uploads.s3.amazonaws.com/i/b13hamgpirgc91vncew6.png)

## Challenges
With my engineering background, rather than physics, I could not have done these particle physics simulations without being able to collaborate quickly and consistently with my mentors and troubleshoot with [the MEGAlib project](https://github.com/zoglauer/megalib). While I'm sad that laboratory testing wasn't possible this semester, I'm still hopeful that this project will be fully implemented eventually and my simulation work will provide a springboard for that future work. 

## Code
A simple functional setup for MEGAlib.
{% github https://github.com/scandey/engr90_megalibtests2 %}
What are Software Flowcharts?
Tags: flowcharts, theory, software
Published: 2020-05-21 00:55:58


Flowcharts are a type of diagram used to represent a workflow or process. There are various types of flowcharts:
- *Document flowcharts*, showing controls over a document flow in a system.
- *Data flowcharts*, showing controls over a data-flow in a system
- *System flowcharts*, showing controls at a physical or resource level
- *Program flowchart*, showing the controls in a program within a system

Flowcharts have boxes of various types, and their order with connecting arrows. They're often used to document or manage a process of program. Flowcharts are also great for planning out complex software architecture. 

# Flowchart Symbols
There are various standard symbols that are used when building flowcharts. 

**Flowline (Arrowhead)**
![Flowline (Arrowhead)](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Flowchart_Line.svg/150px-Flowchart_Line.svg.png)

Show the process's order of operations. These link symbols together. 

**Terminal**
![Terminal](https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Flowchart_Terminal.svg/150px-Flowchart_Terminal.svg.png)

These indicate the beginning or end of a program or subprocess. These usually contain the words "Start" or "End" or another phrase. For example, this may contain the words boot.

**Process**
![Process](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Flowchart_Process.svg/150px-Flowchart_Process.svg.png)

Represent an operation in a program that changes the data in some way. 

**Decision**
![Decision](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Flowchart_Decision.svg/150px-Flowchart_Decision.svg.png)

Shows a conditional operation in a program that changes the path the program will take. This is often a yes/no or true/false test.

**Input/Output**
![Input/Output](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Flowchart_IO.svg/150px-Flowchart_IO.svg.png)

Indicated some sort of input or output data, such as a user entering data or displaying results on a screen.

**Predefined Process**
![Predefined Process](https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Flowchart_Predefined_Process.svg/150px-Flowchart_Predefined_Process.svg.png)

Shows a named process that is defined elswhere.

**Datafile/Database**
![Datafile/Database](https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Flowchart_database.svg/81px-Flowchart_database.svg.png)

Some sort of external or internal data storage.

**Document(s)**
![Document(s)](https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Flowchart_Document_multiple.svg/96px-Flowchart_Document_multiple.svg.png)

Single data document represented by a single rectangle, multiple they're stacked (as shown above).

# Example
![Example Flowchart](https://miro.medium.com/max/731/0*j3G8oZH4Yj5voOmG.png)

Colors are used depending on the symbol normally. 

Flowcharts can look really complex, but once you've worked with them for a little bit, it'll all start making sense!

Crossposted from [Comet Code](https://cometcode.io/posts/what-are-software-flowcharts/)
Make your Git Workflow ZOOOM
Tags: git, github, software
Published: 2020-05-21 00:58:22

You probably use git commands at least 20 times a day if you're a full time deveoper, if not more. That `git add .`, then `git commit -am`, and `git push` sure does get repetitive. What you probably don't know is you can use aliases to make typing these repetive commands faster! Let me show you how

## What are Aliases?
You can think of aliases as shortcuts for bash or zsh, they are variables for normal commands. They must be exported into your current shell environment, which means you should probably put them in your `~/.bashrc` for bash or `~/.zshrc` for zsh.

## What if I'm using Windows?

If you're using windows, first of all, I'm sorry, and second, it's a little different. Aliases are set using `doskey` in windows. Read [this article](https://winaero.com/blog/how-to-set-aliases-for-the-command-prompt-in-windows/) for more information.

## How do I use these?
If you're using bash (default on ubuntu and non MacOS Catalina), open your bashrc using ```nano ~/.bashrc``` and then copy and past the provided code into the bottom of the file, then press `ctrl x` and `y` to save the file. if you're using ZSH (or MacOS Catalina), do the same but run ```nano ~/.zshrc``` instead

Copy and paste these into the bottom of your rc file, and then `source` it, and you'll be able to use these shortcuts!

```shell
# Run g for git
alias g=git
# Use c "Commet Message"
alias c="git add -A && git commit -m "
# Append your code changes into the last commit (useful if you don't want to create a new commit) and keep the last commit message - amend
alias amend="git add -A && git commit --amend --no-edit"
 # Push to the current remote branch - p
alias p="git push origin $(git rev-parse --abbrev-ref HEAD)"
# Fetch from all the remotes, sync the most recent remote changes from origin, and apply your commits onto them - f
alias f="git fetch --all && git rebase origin/master"
 # Create a new branch - n
alias n="git checkout -b"
```

Wammo kabammo, you did it!
My Portfolio Site... For You!
Tags: showdev, portfolio, webdev, career
Published: 2020-05-21 00:34:06

Over the past weekend I decided to redo my portfolio website, [michaelsolati.com](https://michaelsolati.com), a task which I was dragging my feet on. As a Developer 🥑 (Advocate) I speak at events, write blog posts, and maintain some libraries. When re-doing my portfolio I wanted to showcase all of that without ever needing to update the site. The new site does all that and a more, such as:

- It rips my work experience from [LinkedIn](https://linkedin.com) via [Puppeteer](https://pptr.dev/) and shows it on [`/`](https://michaelsolati.com).
- Articles I've written on dev.to are shown on [`/articles`](https://michaelsolati.com/articles).
- My most starred and recent GitHub repos are shown on [`/code`](https://michaelsolati.com/code).
- Recorded talks are fetched from a YouTube playlist and shown on [`/talks`](https://michaelsolati.com/talks).
- Two themes are available, one for devices using light mode and one for dark mode.
- It works when JavaScript is disabled thanks to SSR running on Firebase Functions.
- It also works offline thanks to a service worker.
- It grabs my dev.to profile picture and saves it, as well as generates PWA icons from the profile picture.
- Updates the `manifest.webmanifest` file.
- Saves all the cover image or social image from my dev.to posts.
- Saves all the previews images of the YouTube videos in the playlist.
- Generate screenshots that can be used for sites like Twitter of Facebook.
- GitHub Actions will update all the data and images then deploy to Firebase once a week.

It honestly does a lot, but here's the exciting part...

## IT IS ALL CUSTOMIZABLE!

Meaning you can fork it and only need to update the [`environment.general.ts`](https://github.com/MichaelSolati/portfolio/blob/master/src/environments/environment.general.ts) file in order to have the site completely customized for you.

The project is available on [GitHub](https://github.com/MichaelSolati/portfolio), just checkout the [README](https://github.com/MichaelSolati/portfolio#portfolio) to get started.

Enjoy y'all!

---

To keep up with everything I’m doing, follow me on [Twitter](https://twitter.com/MichaelSolati) and [dev.to](https://dev.to/michaelsolati). If you’re thinking, _“Show me the code!”_ you can find me on [GitHub](https://github.com/MichaelSolati).
A Public API to Generate Images with Text Overlay
Tags: showdev, productivity, webdev
Published: 2020-05-21 00:31:06

---
title: A Public API to Generate Images with Text Overlay
published: true
description: A free tool to automatically generate images with Text Overlay via just a link
tags: showdev, productivity, webdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/2q0wak0lz1bc6zwjliu4.png
---



When we write blog posts etc, we want to create custom og images for each article, or to automatically generate memes, or caption images.

While it isn't difficult to write a tool to do so, and there are some expensive APIs like cloudinary, but are very limited free public APIs.


So we here at [moesif](https://www.moesif.com) decides to create one on the side and offer for free. So all you need to do is to configure an url with your background image, and text to overlay on top. That is it. 

Please check it out and let me know what you think.

the link is here: [textoverimage.moesif.com](https://textoverimage.moesif.com).

Thank

-Xing
I generated content for my prev dev.to article with Node 😎
Tags: webdev, javascript, node
Published: 2020-05-21 00:26:52

---
title: I generated content for my prev dev.to article with Node 😎
published: true
description: 
tags: webdev, javascript, node
---

I was making a list of free tools for devs, for my [post](https://dev.to/fayazara/this-free-tools-for-developers-are-45p3) and I realised I could just scrape the urls metadata instead of writing their description manually.

I made use of this npm module [https://metascraper.js.org/](https://metascraper.js.org/) and wrote a async function which accepted a list of comma seperated URLs and generated a markdown file with title, url and description.

Posting this from my phone, will share code later.

PS, the categories in the article & some urls didn't have description, they were added manually.
Optional Chaining in JS
Tags: javascript, es20, webdev
Published: 2020-05-21 00:26:17

---
title: Optional Chaining in JS
published: true
description: Optional chaining can be very hard to deal in javascript, the new syntax tries to solve this issue.
cover_image: https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif
tags: javascript, es20, web development
---



Ok, I'll try to write this post in both [portuguese](#pt) and [english](#en). 

### <a name="en"></a> English
Optional Chaining tries to resolve a very common pattern in Javascript, the pattern to check before using a complex object.

The `&&` operator is usually used before performing any checks to ensure that the object has the elements, but this can be very strange, if not, hard to read.

```js
const vehicle = {
  car: {
    impala: "Red and has a mirror just for combing",
    brasilia: "Yellow with open doors",
  }
}

// What does and gives error
const jipe = vehicle.carro.jipe // Error

// What you do to avoid the error
const jipe = vehicle && vehicle.carro && vehicle.carro.jipe // Undefined

// New syntax that will help a lot
const jipe = vehicle?.carro?.jipe // Undefined
```
The new syntax as well as lean will reduce the number of errors and make the code easier to read. In many cases, the trigger is long enough to enforce the use of secondary functions just to validate the information.

That's it, start using!

![This is magic!](https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif)


### <a name="pt"></a>Portuguese
O Optional Chaining tenta resolver um padrão muito comum em Javascript, o padrão de verificar antes de utilizar um objeto complexo.

Geralmente se utiliza o operador `&&` antes de realizar qualquer verificação para garantir que o objeto possui os elementos, mas isso pode ser muito estranho, senão, pesado de ler.

```js
const veiculo = {
  carro: {
    opala: "Vermelho e tem espelho apenas para pentear",
    brasilia: "Amarela de portas abertas",
  }
}

// O que faz e dá erro
const jipe = veiculo.carro.jipe // Error

// O que faz para evitar o erro
const jipe = veiculo && veiculo.carro && veiculo.carro.jipe // Undefined

// Nova sintaxe que irá ajudar um monte
const jipe = veiculo?.carro?.jipe // Undefined
```

A nova sintaxe além de enxuta irá reduzir a quantidade de erros e deixar o código mais fácil de ler. Em muitos casos, o desencadeamento é longo ao bastante para se fazer valer o uso de funções secundárias somente para validar as informações.

É isso aí, comecem a usar!

![This is magic!](https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif)

(()=>{})()
Javascript Logging Tips and Tricks
Tags: javascript, webdev, beginners
Published: 2020-05-21 00:21:16

---
title: Javascript Logging Tips and Tricks
published: true
description: Get a few extra tricks up your sleeve when using everyone's favorite debugger.
tags: Javascript, webdev, beginners
---

`console.log` and `debugger` are probably the most common examples of debugging front end applications. Though `log` is the most common `console` function, there are a few others that you can leverage in your application for more descriptive and useful logging. In this post I'm going to cover a few extra functions you may not know about in the `console` object.

###Styled Logging###
In addition to `console.log`, there are a few functions to make your logging more semantic. `console.info`, `console.warn`, and `console.error` can apply some extra styles to your log statements and make your code a little bit more descriptive:

![console info, warn, and error example](https://dev-to-uploads.s3.amazonaws.com/i/9o9oqy4eoqyr6hh1evqg.png)

###Assertions###
If you need to conditionally log an error, `console.assert` takes an expression and will log an error if the assertion is false.

![console assert example](https://dev-to-uploads.s3.amazonaws.com/i/nhfuo3xmrwykmu7mi2bd.png)

###Tables###
If you're logging table data, instead of using `console.log(data)`, consider using `console.table(data)`. `console.table` optionally accepts a second argument that lets you specify what columns you'd like displayed.

![console table example](https://dev-to-uploads.s3.amazonaws.com/i/sxz8plvoyw350jkywhha.png)

###Custom Styles###
Info, warn, and error are a nice way to add some canned styles to your logging statements, but if you're looking for a little more control, `console.log` accepts a second argument that allows you to style your log statements using CSS:

![Custom styled console log](https://dev-to-uploads.s3.amazonaws.com/i/9b7fcgfw9nrvro7m13sv.png)

If you'd like to learn more, the [full MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/console) is a great resource.