teleren/devto huggingface dataset:
How do you take your .dotfiles with you?
Tags: discuss
Published: 2020-01-16 20:30:39

Just curious:  How do you take your `bash`, `zsh` or other shell config with you to another machine?

There are a plethora of tools out there (`OhMyZsh`, `bash-it`, etc) that help you configure your machine locally.  But say you spin up a new machine.  How do you personalize it with your aliases, etc?

I have a pretty extensive [bootstrap.sh](https://gist.github.com/drmikecrowe/923fe3b7d38f0b106d903463c084f194) that sets up my ubuntu machine the way I want it.  However, I'm starting to think that maybe the solution is one `.bashrc` or `.zshrc` that has everything (all my aliases, prompt variables, plugins, etc).

BTW, my complete solution is [yadm](https://github.com/TheLocehiliosan/yadm) for my private .dotfiles and secret config (pushed to a private AWS repo), [dotphiles](https://github.com/drmikecrowe/dotphiles) for my public .dotfiles config, and [bash-it](https://github.com/Bash-it/bash-it) for bash customization.
A Short Introduction to the Unix Pipes
Tags: linux, bash
Published: 2020-01-16 20:24:32

Simply put, A pipe redirects the **output** of the left-hand command to the **input** of the right-hand command. Simple as that. For example, in the following command.

### STDIN, STDOUT, STDERR

The Linux creed: "*Everything is a file*". This includes standard input and output. In Linux, each process gets its own set of files, which gets linked when we invoke piping.

Each process has three default file descriptors:

* `STDIN`  - `/proc/self/fd/0` or `/dev/stdin`
* `STDOUT` - `/proc/self/fd/1` or `/dev/stdout`
* `STDERR` - `/proc/self/fd/2` or `/dev/stderr`

The default `STDIN` is read from your keyboard, while the default for both `STDOUT` and `STDERR` is your screen.

Pipes, `|`, operates on the standard output that's coming from the left side, and the input stream that's expected on its right side.

Having this information, we should be now able to understand how to make a script that's able to process data piped to it:

```bash
cat /dev/stdin | grep -oP "\d+" || echo "No digits found"
```

The output of the `cat` command will be piped to the input of `grep`. If it finds a match, it'll print it to the standard output (your screen), otherwise, we'll echo a string indicating that no match was found.
React lib overriding your web app context
Tags: react, discuss
Published: 2020-01-16 20:14:31

Hi, I was wondering about good patterns concerning the react context.

Let's get a public library, for example `react-intl` that exposes a Provider (IntlProvider).
Let's create a library `barLib` that uses `react-intl` to manage translations internally and that also exposes a `Provider`.
Now let's imagine I create a web app and use both `barLib` and `react-intl`.

I don't expect the `barLib` to ever override my react-intl context, because i'm not aware it uses internally the `react-intl` lib.
But the `barLib` can accidentally override the react-intl context => https://codesandbox.io/s/embedded-contexts-test-z8e7b

This kinda breaks the isolation of libs IMO.

I see several solutions :

- Don't use an other lib context in the `barLib` (pretty extreme)
- Check that there is not already an intl context in the `barLib`, if so merge the context values ?

I'm not convinced with either solutions, what do you guys think about it ?

UPDATE :

IMO the right way is to NEVER implement yourself a provider from a third-party library, you should just document your library so that users know they should wrap your components with the needed provider.

Exemple : If you want to use `react-intl`, just use it and tell people that your component must be wrapped into a react intl provider.
Create an RGBA histogram of a cat using Imagemagick
Tags: bash, imagemagick, tutorial
Published: 2020-01-16 19:47:28

---
title: Create an RGBA histogram of a cat using Imagemagick
published: true
description: A quick tutorial of how to generate an RGBA histogram .txt file from an image using Imagemagick and Bash
tags: #bash #imagemagick #tutorial
cover_image: https://i.ibb.co/vQmFnpG/create-histogram-02.png
---

How do I create a histogram of this cat image?

![cat](https://i.ibb.co/0MF7m2P/cats-04-C.png)

Create a new bash script named *create-histogram.sh*.
```bash
# create-histogram.sh
#!/bin/bash
```

Provide a ".png" file
```bash
echo "PNG please ~~~~~"
read PNG
```

Remove ".png" from PNG
```bash
SPLICE=${PNG%????}
```

Create the EXPORTFILE as ".txt"
```bash
EXPORTFILE="${SPLICE}.txt"
echo $EXPORTFILE
```

Export a histogram ".txt" file based on the ".png"
```bash
convert $PNG -format %c histogram:info:- > $EXPORTFILE
```

The exported histogram will look something like this ...

![header](https://i.ibb.co/vQmFnpG/create-histogram-02.png)

And a here is a clip of the workflow.

![gif](https://i.ibb.co/YybczH4/create-histogram.gif)
Checkout the world's safest open source sumobot (with video)
Tags: showdev, embedded
Published: 2020-01-16 19:43:25

---
title: Checkout the world's safest open source sumobot (with video)
published: true
description: High Integrity Sumobot is an advanced-level project programmed in Ada/SPARK and Arduino (C++).
tags: #showdev, #embedded
cover_image: https://thepracticaldev.s3.amazonaws.com/i/twh9gf86912xcum9lhdc.jpg
---

{% youtube GyEZLSxFQtE %}

I created the *[High Integrity Sumobot](https://github.com/bosepchuk/High_Integrity_Sumobot)* using Ada/SPARK and high integrity software engineering techniques. I wanted to make it easy for people interested in Ada/SPARK to see how all the pieces fit together in a small embedded project.

I did my best to write simple, clean, and maintainable code throughout. It's extensively commented.


# System overview
I started with a [Zumo 32U4](https://www.pololu.com/product/3126) sumobot. But instead of programming it directly as a microcontroller like most people do, I turned it into an I2C slave device, which I control with a microbit I programmed in Ada/SPARK.

The zumo continuously collects sensor data and stores it in a buffer. The microbit periodically requests sensor data from the zumo over I2C and the zumo sends the data it most recently collected. The microbit validates the sensor data, decides how the zumo should move, and sends motor commands back to the zumo (also over I2C). The zumo validates the motor commands and then executes them. And then the process repeats (at least 50 times per second).

![describes the communications between the zumo and the microbit](https://thepracticaldev.s3.amazonaws.com/i/94j8xil79ggflbr7069c.png)


# More information and build instructions
You can find the [full documentation and build instructions for this project on my website](https://smallbusinessprogramming.com/high-integrity-sumobot-build-instructions/). I've included everything you need to create your own *High Integrity Sumobot*:

* written requirements
* full parts list
* wiring diagram
* [source code](https://github.com/bosepchuk/High_Integrity_Sumobot)
* detailed build instructions (with photos)
* detailed software installation instructions (with screenshots)
* instructions for how to run the automated unit tests
* compile/build and upload/flashing instructions (with screenshots)
* end-to-end testing plan linked to each requirement


# Wrapping up

I welcome any feedback on my project. If you have a way to make it better I'd love to hear from you.
What about TypeScript?
Tags: discuss, typescript
Published: 2020-01-16 19:33:28

---
title: What about TypeScript?
published: true
description: Curious about how the community feels about TypeScript
tags: discuss, typescript
---

👋

Just picked up a course about Angular from Udemy. Noticed that it uses TypeScript instead of JavaScript. Would love to hear people’s thoughts about TypeScript in general? 
 
Useful?  

Gonna be around a while?  

Tried TypeScript but went back to Javascript?  

Drop your comments below.
JavaScript Series – JavaScript Types – Part 2
Tags: javascript, codenewbie, beginners, webdev
Published: 2020-01-16 19:24:34

We’ll finally learn about some coding stuff today. It’s basic today.

We’ll writing JavaScript code on the console of google chrome. You can find it on

menu >> developer tools >> select console from the tab

shortcut: Ctrl + Shift + I

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/369av9xrw49vwldu8de5.png)

You can try Mozilla Firefox console too. It’s up to you what you want to use, but I prefer chrome, so I’m going to stuck with it. With time, we’ll go to some text-editor to write code, now we can write code in console.

Javascript have 7 types. You can think types as values. They are –

a. Number
b. String
c. Boolean
d. Undefined
e. Null
f. Symbol (new in ES6)
g. Object

Today we’ll talk about Number.

We can easily add number in JavaScript. Just adding the ‘+’ operator in middle

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2zgusnfh7lfxmwzzwjvq.png)

We can do all the arithmetic things here using JavaScript. Plus, Minus, Division, Multiplication etc. Easy math right ? This is all numbers, they are allowed in JavaScript.

Working on some more arithmetic logics.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/97daedxsa4k8svz1wzsx.png)

Now I’ve question. Do you know what ‘%’ means in real life? I am sure you know. But check this –

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/42xai4h5bea0k057ghaz.png)

It is not the same right? Think more about it.

.

.

.

Enough?! Okay! This is actually ‘modulo’ this gives us the reminder!
Next part is coming soon…

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ki46o15t24afyp4vgm07.png)


You can see the graphical version here
{% instagram B7ZAkuKgDT- %}

Source Codes - { Check commits }
{% github nerdjfpb/javaScript-Series %}


Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/javascript-part-2/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/) !
autoposted from github 239622
Tags: devto, autopost, github
Published: 2020-01-16 19:07:26

---
published: true
title: 'autoposted from github 239622'
cover_image: 'https://raw.githubusercontent.com/maxime1992/my-dev.to/master/blog-posts/manage-dev-to-blog-posts-with-continuous-deployment/assets/github-travis-dev-to.png'
description: 'autoposted from github 239000'
tags: devto, autopost, github
series:
canonical_url:
---

# Head 1

Hey, some text!

## Head 2

Hey some images !

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-13_Welcome_to_Traffic_England_dtHMkHSlS.png)

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-16_confs_review_-_pick_your_next_conf_with_ease_2isxV5wjy.png)

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-09_OpenFlights_org_Flight_logging__mapping__stats_and_sharing_Brf0lx_LB.png)
autoposted from github 239621
Tags: devto, autopost, github
Published: 2020-01-16 19:07:16

---
published: true
title: 'autoposted from github 239621'
cover_image: 'https://raw.githubusercontent.com/maxime1992/my-dev.to/master/blog-posts/manage-dev-to-blog-posts-with-continuous-deployment/assets/github-travis-dev-to.png'
description: 'autoposted from github 239000'
tags: devto, autopost, github
series:
canonical_url:
---

# Head 1

Hey, some text!

## Head 2

Hey some images !

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-13_Welcome_to_Traffic_England_dtHMkHSlS.png)

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-16_confs_review_-_pick_your_next_conf_with_ease_2isxV5wjy.png)

![alt image text](https://ik.imagekit.io/0h2y0y2rw/Screenshot_2020-01-09_OpenFlights_org_Flight_logging__mapping__stats_and_sharing_Brf0lx_LB.png)
Cool ways to track daily accomplishments and wins
Tags: productivity, career, motivation, apps
Published: 2020-01-16 18:27:03

Does anyone have a cool service or app to track daily wins and accomplishments for helping build a nice timeline of wins for reviewing annual performance and achievements that bring value to a company and team. 

Key requirements:
- Beautiful UI
- Basic structure of something like ⚡3 things that went well/accomplished 🔨 1 something to improve
- Encourages micro oriented log, not long
- Ideally not self-managed
- Emoji fun is a plug ➕🎉 
GetMakerLog.com inspired me to think more about this

I've been hearing more and more about how important it is to track these for visibility in your career. I've historically approached things from the mentality of "my work will speak for itself." However, I'm learning more and more that with all the pressures work demands it is challenging for that to stay clear and I'd benefit from better "bragging" (in healthy/balanced way) about what I've done than assume others will see the effort.

I really like the simple concept of getmakerlog.com but want something more private. Something almost like an emojilog for personal achievements 😀

Right now I'd guess Notion would fit the bill, but if something similar to GetMaker existed for personal tracking (not public) then I'd be up for trying something new. Maybe just empty git log commits 😁 and emoji log might be what I need.
auto posting from github to dev.to or fast.io
Tags: devto, blogging, autopost
Published: 2020-01-16 18:05:58

NOW (not the zeit now !) you have a choice you can set up auto posting by git PUSH to github to dev.to OR fast.io

DEV.TO
https://dev.to/osde8info/devto-autoposting-from-github-errors-1l1n

FAST.IO
https://dev.to/osde8info/an-abc-for-dev-s-and-webdev-s-3di2
functions in real life
Published: 2020-01-16 18:01:57

What processes and tasks, from real life, can fit into the various ways you can define a function? (Explain at least 5)


The function contains instructions used to create the output from its input. In that case, let's give 5 examples of real life situations that would mimic functions in coding. 


1- Working out. A person needs to eat right, take whatever pre workout, that's the input, the out put would be, being more fit and building muscle

2- gaining weight. A person eats junk food, overloads on carbs and doesn't exercise, that's the intake. the outtake would be weight gain and poor health

3- driving a car. Person put gas into their car, that's the input. the output would be that the car drives without any issues. with this, the input needs the right kind of fuel. If you put water in the car, because it's the wrong input, then the output would be a not operational vehicle.

4- going to school. A person attended school to gain knowledge. So the intake is lecture, work and homework. The output is taking that knowledge and applying it to you job or life and understand what you are doing. 

5- losing weight. A person limits the amount of carbs and sugars from their diet, so the outtake is less then the intake, so the person will loss weight.
How to useContext and set value of context in child components in 3 steps
Tags: react
Published: 2020-01-16 17:59:02

<br>
<h2>1- Create a Context constant and export it</h2>

We will import this constant(const) in all functions which we will be using the context. I will name the file Context.js

```javascript
//Context.js

import React from "react";
export const Context = React.createContext();
```


<h2>2- In App.js Import and provide the context to all Functional Components</h2>


```javascript
//App.js

import React, { useState } from "react";
import { Context } from "./Context.js";

import ComponentA from "./ComponentA";
import ComponentB from "./ComponentB";

export default function App() {
  const [context, setContext] = useState("default context value");
  return (
    <Context.Provider value={[context, setContext]}>
      <ComponentA />
      <ComponentB />
    </Context.Provider>
  );
}

```

To do that we do 3 things :)

a- Import the Context we created in 1st step
b- Create a state (via useState) which we will share between components.
c- Wrap components with Context.Provider and pass the state(context) and a function(setContext) to update the state which we created in step b.


<h2>3- Consume and set/change value of the context in child components.</h2>

```javascript
//ComponentA.js

import React, { useContext } from "react";
import { Context } from "./Context";

export default function ComponentA() {
  const [context, setContext] = useContext(Context);
  return (
    <div>
      ComponentA:
      <button onClick={() => setContext("New Value")}>
        Change Context Value
      </button>
    </div>
  );
}
```


```javascript
//ComponentB.js

import React, { useContext } from "react";
import { Context } from "./Context";

export default function ComponentB() {
  const [context, setContext] = useContext(Context);
  return <div>ComponentB: {context}</div>;
}

```
To consume and change the value of context:

a- Import Context we created in step 1.
b- Import useContext from "react"
c- Consume value of context via useContext and use it like a state variable (see ComponentB)
d- Change the value via setContext function which we get from useContext (see ComponentA)


<h3> Full Code: </h3>

{% codesandbox v36ew%}
have you noticed the DEV.TO ad in your JS console ?
Tags: devto, adverts, mktg
Published: 2020-01-16 17:32:12

NEATO :smile:

`console.log()` but shouldnt it be `console.info()` ?

```
hello-dev-32849ce6a572caca68760.js:1:22

-oooooooo/-      .+ooooooooo:  +ooo+        oooo/
+MMMMMMMMMMm+   -NMMMMMMMMMMs  +MMMM:      /MMMM/
+MMMNyyydMMMMy  /MMMMyyyyyyy/   mMMMd      mMMMd
+MMMm    :MMMM. /MMMN           /MMMM/    /MMMM:
+MMMm    .MMMM- /MMMN            dMMMm    mMMMh
+MMMm    .MMMM- /MMMMyyyy+       :MMMM/  +MMMM-
+MMMm    .MMMM- /MMMMMMMMy        hMMMm  NMMMy
+MMMm    .MMMM- /MMMMoooo:        -MMMM+oMMMM-
+MMMm    .MMMM- /MMMN              yMMMmNMMMy
+MMMm    +MMMM. /MMMN              .MMMMMMMM.
+MMMMdddNMMMMo  /MMMMddddddd+       sMMMMMMs
+MMMMMMMMMNh:   .mMMMMMMMMMMs        yMMMMs
.///////:-        -/////////-         .::.

Hey there! Interested in the code behind dev.to? Well, you're in luck - we're open source!

Come say hi, tell us what you're debugging, or even lend a hand in our repo: https://github.com/thepracticaldev/dev.to

Did you find a bug or vulnerability? Check out our bug bounty info here: https://dev.to/security
```
DEPOP - Scala Opportunity in London :)
Tags: scala, career
Published: 2020-01-16 17:30:33

Depop | Mid-Senior Scala Engineer | London | Onsite| Full Time | £50K-90K | 

Hey Guys,
 
Depop is a growing social marketplace that lets you buy and sell unique fashion items and is now scaling the engineering team after a £50 million Series-C investment. With a strong focus on and love for functional programming, you have the opportunity to work in an agile and diverse environment to help a vibrant community grow.

The tech stack for this role include: Scala - Play framework - AWS - Postgres - Kinesis

As such you should have experience in Scala and some of its libraries. 
If you are interested and want to apply, please follow the link here http://bit.ly/DepopScalaLondon, or you can email me at nikolaus@functionalworks.com or PM me here.

Thanks for reading and bearing with me :)
Sort replies by time at dev.to (especially welcome threads)
Tags: help
Published: 2020-01-16 17:26:27

Friends, I'm sorry for annoying with such a silly question, but I can't find how to sort replies by time rather than popularity. Without it browsing "Welcome" threads is quite cumbersome:

https://dev.to/thepracticaldev/welcome-thread-v56-1bhj

_Most probably here is some magic button, but I can't find it or google for it (google gives zounds of answer about sort algorithms when used with dev.to, ha-ha)._

Thanks in advance!
autoposting from github to devto
Tags: devto, autopost, github
Published: 2020-01-16 17:22:22

im trying out autoposting from github to devto as per [devto autoposting](https://dev.to/maxime1992/manage-your-dev-to-blog-posts-from-a-git-repo-and-use-continuous-deployment-to-auto-publish-update-them-143j) and its fantastic IF you format your `dev-to-git.json` correctly

my devto pages github repo is at 
* https://github.com/osde8info/my-dev-to-pages/

my devto autoposted pages are at
* https://dev.to/osde8info/devto-auto-post-test-post-a-2d93
* https://dev.to/osde8info/devto-auto-post-test-post-b-23j
* https://dev.to/osde8info/devto-auto-post-test-56j4
* https://dev.to/osde8info/devto-auto-post-test4-jj7
* https://dev.to/osde8info/devto-auto-post-test5-1kg5


test locally by running embed and pretty locally before you PUSH to github 
```
$ yarn embed
$ yarn prettier
``` 

see if you are getting yarn prettier errors "EXIT 1" is BAD

LOCAL ERORRS
```
$ yarn prettier:check
yarn run v1.21.1
warning package.json: No license field
$ yarn run prettier "**/*.{js,json,scss,md,ts,html,component.html}" --list-different
warning package.json: No license field
$ prettier '**/*.{js,json,scss,md,ts,html,component.html}' --list-different
dev-to-git.json
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

TRAVIS ERORRS
```
$ yarn run v1.3.2

(node:6183) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

warning package.json: No license field

$ yarn run prettier:base --list-different


$ yarn run prettier "**/*.{js,json,scss,md,ts,html,component.html}" --list-different

warning package.json: No license field

$ prettier '**/*.{js,json,scss,md,ts,html,component.html}' --list-different

dev-to-git.json

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed with exit code 1.
```