teleren/devto huggingface dataset:
PowerShell Core | Instalação no CentOS
Tags: linux, powershell, centos7, howto
Published: 2019-11-17 17:24:47

---
title: PowerShell Core | Instalação no CentOS
published: true
date: 2019-06-10 01:12:49 UTC
tags: linux,powershell,centos7,how-to
canonical_url: 
---

Instalação do PowerShell manualmente e através de gerenciador de pacotes

![](https://cdn-images-1.medium.com/max/1024/1*yBLUGiGgK4FBVu-_7jSzPA.jpeg)

Fala pessoal, beleza ? Após minha palestra que rolou dia [23/05 na FC Nuvem](https://www.meetup.com/DevOps-Professionals/events/259008623/), fiquei de disponibilizar um passo a passo para instalar o PowerShell no CentOS as demos que que fiz na palestra havia me baseado na distro do Ubuntu 18.02.

Os passo a seguir são bem comuns para quem está habituado com bash e sistemas baseados no Unix, porem se você utiliza/administra servidores Windows essa será uma ótima oportunidade de conhecer um outro SO com toda a facilidade que o PowerShell nos traz.

Vamos lá:

![](https://cdn-images-1.medium.com/max/957/1*fINcFNFKzIJ-yVZYEhnz0w.png)<figcaption>Executando o download e registrando o repositório da Microsoft</figcaption>

![](https://cdn-images-1.medium.com/max/960/1*L-GH_-jaHd6ppvtTqSXrqg.png)<figcaption>Executando o yum install -y powershell</figcaption>

Executando de fato a busca pelos pacotes do PowerShell no repositório da Microsoft e validando as dependências.

![](https://cdn-images-1.medium.com/max/962/1*4SjbuHnb_X6IEkWam4ymHA.png)<figcaption>Retorno da instalacao do PSCore com 55mb</figcaption>

Para executar o PowerShell, vamos digitar no bash **pwsh** , ele vai retornar a versão instalada e já podemos executar nossos scripts dentro no Linux.

![](https://cdn-images-1.medium.com/max/1024/1*Ocm3Py0I3Nzo0ZD1MU55lg.png)<figcaption>Utilizando o PowerShell no CentOS</figcaption>

{% gist https://gist.github.com/EwertonJordao/4637e4eb959a53858a1dcb4f85001fb0 %}

Plus ➕ baixando o PowerShell Core direto do repositório do [GitHub](https://github.com/PowerShell/PowerShell).

![](https://cdn-images-1.medium.com/max/1024/1*9TiVVCxfEJW9CetK1juxCA.png)<figcaption>Acessando o repositório do PowerShell</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*JbU4-2cx7AfmfN0MhX8Wig.png)<figcaption>Verificando os últimos releases (PS 7 preview já disponível)</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*DGCBClVaq0TJ020raJ8pTw.png)<figcaption>Lista das distribuições Linux suportadas pelo PowerShell Team</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*HfiNn7GNP5Cs-WxXgjCTqw.png)<figcaption>Realizando o download para a distribuições baseadas em RHEL</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*1PGC-MjK1ouwS5Kfah0dLw.png)<figcaption>utilizando o yum para realizar a instalação</figcaption>

Observe que o repositório é o diretório local Downloads/ depois da instalação podemos utilizar o PowerShell Core.

É isso, pessoal. Essa é uma demonstração de como é simples instalar o PowerShell em uma distribuição Linux baseada em RHEL.

Não se esqueça, **PS é vida**  😍.
Please help me build a cloud visual SLAM system for cellphones
Tags: robotics, discuss, help, docker
Published: 2019-06-10 00:25:16

---
title: Please help me build a cloud visual SLAM system for cellphones
published: true
description: 
tags: robotics, discuss, help, docker
---

Hello hackers, tinkers, webdevs, sysdevs, roboticists, and all coders! I've been excited about [cloud robotics](https://en.wikipedia.org/wiki/Cloud_robotics), a field of robotics that utilizes the power of cloud computing, and want to share the excitement with you and suggest a project we can potentially work together. The project that I'm thinking of is "cellphone visual SLAMing". The idea is to run a visual SLAM system on cloud so mobile devices like a cellphone can build 3D maps by simply uploading camera data to the cloud.

Here are the steps I'm thinking:

1. Try creating a 3D map using [ORB_SLAM2](https://github.com/raulmur/ORB_SLAM2) and desktop camera images.
   The main goal of this step is to get comfortable with a visual SLAM library and feel out the limitations.
2. Try creating 3D maps using ORB*SLAM2 running on a desktop and cellphone camera images.
   ORB_SLAM2 supports [ROS](https://www.ros.org/). So one can easily capture device camera images using [HTML5's `MediaDevices.getUserMedia()`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia), turn them into ROS image messages, and publish them using [roslibjs](https://github.com/RobotWebTools/roslibjs) so ORB_SLAM2 can use the images collected from a remote device.
3. Run the ORB_SLAM2 to cloud.
   I have not tried it, but it seems like it is fairly easy to [containerize a ROS package and deploy it on cloud](https://docs.docker.com/samples/library/ros/).

That's it! Are you interested in trying this idea out? If you have experiences with visual SLAM and have suggestions? Let me know, I'd love to hear your thoughts.


<br>
### Updates

_2021/01/02_ I have moved on as I don't get to spend time on tinkering but still think this is a fun project to try one day.
_2020/11/23_ [Fyusion](https://fyusion.com/) and [CANVAS](https://canvas.io/) seem to provide products with related technolgoies.
_2020/05/02_ It seems like [se2lam](github.com/izhengfan/se2lam) could be used instead of ORB_SLAM2.
C# Uri Trailing Slash
Tags: c, programming
Published: 2021-01-11 00:53:01

---
title: C# Uri Trailing Slash
published: true
date: 2019-06-09 23:17:34 UTC
tags: C,Programming
canonical_url: https://jamienordmeyer.net/2019/06/09/c-uri-trailing-slash/
---

![](https://jamienordmeyer.net/wp-content/uploads/2019/06/what.png)

Many libraries that deal with pathing (taking path “fragments” and appending them together to form a larger path) do not care whether you add trailing separator characters or not. If you supply them, they let the fragment be. If not, then the fragment separator is automatically added. For instance, both Node’s _path_ library, as well as.NET’s System.IO.Path methods, allow you to provide file path fragments, and if there are missing path separators between, they will be added automatically.

Apparently, this is the the case for Uri’s in .NET. Looking through the [documentation](https://docs.microsoft.com/en-us/dotnet/api/system.uri?view=netframework-4.8), there is no direct equivalent for concatenating Uri path fragments. The way that you have to do so is with the Uri constructor. I ran into this issue last week at work, and it cost me a several hours of lost time as I troubleshot the issue. Take a look at this code snippet, which I ran in LinqPad:

```
void Main()
{
	var baseUri1 = new Uri("http://www.somesite.com/api/person/100/hobbies");
	var baseUri2 = new Uri("http://www.somesite.com/api/person/100/hobbies/");
	
	var compositeUri1 = new Uri(baseUri1, "13");
	var compositeUri2 = new Uri(baseUri2, "13");
	
	Console.WriteLine(compositeUri1.ToString());
	Console.WriteLine(compositeUri2.ToString());
}
```

baseUri1 has no trailing slash in the Uri, whereas baseUri2 does. If the Uri class worked like other pathing classes, I’d expect both Console.WriteLine calls to produce http://www.somesite.com/api/person/100/hobbies/13. However, that is NOT the case. Instead, I get the following:

> http://www.somesite.com/api/person/100/13 http://www.somesite.com/api/person/100/hobbies/13

Notice that _hobbies_ is completely missing from the first Uri. It didn’t just append 13 to hobbies… it actually _removed_ hobbies from the Uri altogether before appending the 13. What…?!? I assumed that the Uri class would add the missing trailing slash, so when my code was not working after deployment to our development environment, it wasn’t immediately clear why it couldn’t reach the REST API that it was relying on. Only after adding in additional logging was I able to figure out that the URI being used to talk to our API was invalid.

I do my absolute best to not make assumptions, especially when using the .NET BCL classes and methods. However, it looks like we can still be bit from time to time when something works one way, while we expected that it worked another…
2 Minute Self Signed SSL Certificate for localhost
Tags: javascript, webdev
Published: 2019-06-09 22:49:06

This weekend I was tasked with building a login system using passport.js's facebook strategy. Sure it was going to be easy...

Issue was that Facebook dev now enforces 'HTTPS' so you need a self signed SSL certificate for localhost:3000 or whatever port you're using.

Pretty easy.... <b>(till you're in production mode and you realize why your pet has a happier life than you)😂🐶😹⌨️</b>

In Express v.4 The bin directory serves is where you define your startup scripts. The 'www' file contains code to start your express app as a web server. So 'app' is passed as a handler to your web server. If using express generator with "$ npm install express-generator -g" a template with the bin directory and 'www' file is created for you.


In your terminal:

```
//Note: you will be presented with lots of options. Be sure to fill the Common Name option as localhost

 $ openssl req -nodes -new -x509 -keyout server.key -out server.cert

//convert cert and key to PEM Files

 $ openssl x509 -in server.cert -out cert.pem -outform PEM
 $cat server.cert server.key > key.pem

```

copy both cert.pem and key.pem in project directory. And then in 'www' within your bin directory, you will need to reference your certificate

```
/**
 * Module dependencies.
 */

const app = require('../app');
const debug = require('debug')('node-passport-social:server');
const http = require('https');
const fs = require("fs");

/**
 * Get port from environment and store in Express.
 */

const port = normalizePort(process.env.PORT || '3000');
app.set('port', port);

/**
 * Create HTTPS server.
 */

const privateKey = fs.readFileSync('./key.pem');
const certificate = fs.readFileSync('./cert.pem');

const server = http.createServer({
  key: privateKey,
  cert: certificate
}, app);

/**
 * Listen on provided port, on all network interfaces.
 */

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

/**
 * Normalize a port into a number, string, or false.
 */

function normalizePort(val) {
  var port = parseInt(val, 10);

  if (isNaN(port)) {
    // named pipe
    return val;
  }

  if (port >= 0) {
    // port number
    return port;
  }

  return false;
}

/**
 * Event listener for HTTP server "error" event.
 */

function onError(error) {
  if (error.syscall !== 'listen') {
    throw error;
  }

 const bind = typeof port === 'string'
    ? 'Pipe ' + port
    : 'Port ' + port;

  // handle specific listen errors with friendly messages
  switch (error.code) {
    case 'EACCES':
      console.error(bind + ' requires elevated privileges');
      process.exit(1);
      break;
    case 'EADDRINUSE':
      console.error(bind + ' is already in use');
      process.exit(1);
      break;
    default:
      throw error;
  }
}

/**
 * Event listener for HTTP server "listening" event.
 */

function onListening() {
  const addr = server.address();
 const bind = typeof addr === 'string'
    ? 'pipe ' + addr
    : 'port ' + addr.port;
  debug('Listening on ' + bind);
}

```

And then in your browser open https:localhost:3000
React-Easy-Edit - library for inline editing components
Tags: javascript, react
Published: 2019-06-09 21:38:23

Hello All,

I recently released my first react library called react-easy-edit which simplifies the implementation of inline editing. Could you please review the library? I would really appreciate any feedback you can give me. Let me know if you would like to know more information on any library feature or if you feel that I would need to update the Readme file with more examples.

https://github.com/giorgosart/react-easy-edit

Thank you!
Connect to Amazon Athena with a SQL client
Tags: aws, sql, data, database
Published: 2019-06-09 20:35:17

[AWS Athena](https://aws.amazon.com/athena/) lets you run SQL on S3 data, which is very powerful. I wanted to connect to Athena using a SQL client like SQL Workbench, on my Mac so that I could execute those queries to get the insight I wanted into my data. Let us get started 🚀

## Prerequisites
- Ensure you have Java installed from [here](https://java.com/en/download/mac_download.jsp)
    - :warning: *If you are using Windows/Linux, make sure you install the appropriate Java distro*
- Install SQL Workbench from [here](http://www.sql-workbench.eu/download-archive.html)
- Download the Athena Driver from [here](https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html)

## Setup the Athena Driver
- File -> Manage Drivers

![](https://thepracticaldev.s3.amazonaws.com/i/crm75f28etstyymotc73.png)

- Select the Athena driver if available in the list. If it does not exist, don't worry. You can select any of the options and make it an Athena driver by following the next steps 
- Lets say you select the `Adabas` driver ( assuming thats one on the list )
    - Change the `Name` to `Athena-DEV`
    - In the `Library` section, upload the athena driver you installed earlier 
    - Change the `classname` to  `com.simba.athena.jdbc.Driver`
    - You can leave the `Sample URL` field empty
- Your final Driver setup should look like 

![](https://thepracticaldev.s3.amazonaws.com/i/8l07l2mpafb34dm8dyov.png)

- Hit `OK` to save configuration

## Setup the Athena Connection
- File -> Connect Window

![](https://thepracticaldev.s3.amazonaws.com/i/isk1s2w7phkmrkqo7jaw.png)

- Click the icon on the top left to `Create a new connection profile`

![](https://thepracticaldev.s3.amazonaws.com/i/m8nbxkpp4b3f04drcbh1.png)

- You should have this as the view now

![](https://thepracticaldev.s3.amazonaws.com/i/xxp98hi27dk5o09etg4m.png)

- Connection Name ( uppermost text box ) = `Athena-DEV`
- Driver = `Athena-DEV` in the dropdown ( since you already created the driver in the steps above )
- URL = `<your-athena-instance-based-on-region>` eg. `jdbc:awsathena://athena.us-east-1.amazonaws.com:443`
- Username = `<AWS_ACCESS_KEY_ID>`
- Password = `<AWS_SECRET_ACCESS_KEY>`
- Click the `Extended Properties` box and add a property `S3OutputLocation` as the key. For the value, use the Amazon S3 location where you would like to store the results of the queries, prefixed by s3://. Eg. If you have a bucket named `my-personal-bucket` and you want to store the results in a folder called `test-run`, then the value would be `s3://my-personal-bucket/test-run`
- Click OK
- Hit the `Test` button and you should be successfully connected to Athena in your region!

![](https://thepracticaldev.s3.amazonaws.com/i/uz18oqg3rwj547menp4i.png)

**You can now go ahead and query your S3 data out of Athena** 🔥

---

To know more about me, visit my [website](https://www.arjunrao.co), or follow me on [Twitter](https://mobile.twitter.com/raoarjun). If you want to share your own experience or have thoughts about what you just read, feel free to comment below! 👏👏👏
How archery helps me as a developer
Tags: productivity, focus, stamina, mentalhealth
Published: 2019-06-09 20:22:16

---
title: How archery helps me as a developer
published: true
description: I explain how my love of archery helps me focus in my role as a web developer
tags: productivity, focus, stamina, mental health
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ywx1xz7e652phepqb81a.jpg
canonical_url: https://flipsphere.net/2019/06/09/how-archery-helps-me-as-a-developer.html
---
Archery has always been one of those things which interested me, but it took me a long time to finally get into it. 

When I was a kid I had one of those Nerf bows from the 90's which I absolutely adored! I'd fire that foam arrow everywhere - even though it was all bent and warped and never fired straight. I think I shot my first real recurve bow on a school trip when I was 11 or 12. 

I didn't touch a bow again until my first wedding anniversary. My husband and I were in Hastings, UK, and decided to sign up to a "have-a-go" target sports event. We got to try bore-rifle shooting, axe throwing, and archery! (Axe-throwing is actually a lot harder than it looks!!). It was after this trip we decided to finally sign-up to our local archery club.

One thing which struck me immediately was how tiring archery can be! It's not just the physical strain of holding the bow in one hand whilst drawing your string with your back muscles, but also the mental strain of focusing on your target and calming your mind.

It's that composure training which has really helped me concentrate as a developer. When you are staring down your sight, steadying your hand and calming your breath, you cannot let anything distract you. Your attention needs to be on your breathing and your target. Ignore the person behind you laughing, or what the archer beside you is doing. Everything is about being in control of what you are doing, and understanding how everything feels.

As developers, we do the same.

We need to ignore everything around us and focus on the piece of code we're writing. We're taking highly complex scenarios and breaking them down into manageable chunks, all whilst holding the map of where different functions are called within our heads. Any distraction can cause this complex route to disappear.

Naturally this can be very mentally draining, however archery is helping me to increase my mental stamina.


Being able to reach that state of focus and composure is in a way quite meditative. After a stressful day in the office, forcing yourself to breathe slowly and focus solely on the target offers a great relief. There is also the physical stress release benefits of walking back and forth to the target to retrieve your arrows (and often having to rummage around in the grass to find the arrows which have avoided the target...)

![](https://thepracticaldev.s3.amazonaws.com/i/7robhfdf5qijmcd7xahr.jpg)
(bow tax)
Sites build with Gatsby
Tags: javascript, discuss, webdev, gatsby
Published: 2019-06-09 20:03:26

---
title: Sites build with Gatsby
published: true
description: What have you built with Gatsby so far?
tags: javascript, discuss, webdev, gatsby
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ockyj7z2epnlsu5tponi.png
---

I've been using Gatsby for my [blog](https://florin-pop.com) for around 4 months now and I can say that it's pretty amazing! I love it!

What websites have you built using **Gatsby**? How do you like it so far?

For those who don't know yet, *Gatsby is a free and open source framework based on React that helps developers build blazing fast websites and apps*. Read more about it [here](https://www.gatsbyjs.org/).
Is it possible to write this code in a simpler way?
Tags: javascript, codenewbie, beginners, refactorit
Published: 2019-06-09 19:30:31

I just made this piece of code in order to light the bulb and switch it off.

The bulb has an "on" class. And an "off" class. So, in order to be in a certain status there must be at least one class activated for the #bulb.

I first thought about just toggling the "on" class and leaving the off behind, but didn't work for two reasons:

1) the classList.toggle function only admits one class at the time. So the "off" class doesn't dissapear if the "on" is included at the time.

2) both classes cannot co-exist at the time since they are formatting the same object. So what I got was an off bulb with yellow shadow.

So I came up with this conditional, to make it dissapear. 

I would love to know other ways possible to make it simpler. Any suggestions?

Be gentle with me, this is my very first working code in JavaScript. :)


<a href="https://codepen.io/nanythery/pen/WBVVMQ"> Click to check the Codepen</a>

This is the code:


function switchBulb(){
  var element= document.getElementById("bulb");
  var status = element.classList.toggle("on");
  if (status !== false){
    var status = element.classList.remove("off");
  } else
    var status = element.classList.add("off");
}
Diun - Docker image update notifier
Tags: docker, registry, notification, go
Published: 2019-06-09 19:26:21

---
title: Diun - Docker image update notifier
published: true
description: Receive notifications when a Docker image is updated on a Docker registry.
tags: docker,registry,notification,golang
---

{% github crazy-max/diun %}

[**Diun**](https://github.com/crazy-max/diun) 🔔 is a CLI application written in [Go](https://golang.org/) to receive notifications 📥 when a Docker 🐳 image is updated on a Docker registry.

Here are the main features :

* Allow to watch a full Docker repository and report new tags
* Include and exclude filters with regular expression for tags
* Internal cron implementation through go routines
* Worker pool to parallelize analyses
* Allow overriding os and architecture when watching
* Beautiful email report
* Webhook notification

If you choose `webhook` notification, a HTTP request is sent with a JSON format response that looks like:


```json
{
  "diun_version": "0.3.0",
  "status": "new",
  "image": "docker.io/crazymax/swarm-cronjob:0.2.1",
  "mime_type": "application/vnd.docker.distribution.manifest.v2+json",
  "digest": "sha256:5913d4b5e8dc15430c2f47f40e43ab2ca7f2b8df5eee5db4d5c42311e08dfb79",
  "created": "2019-01-24T10:26:49.152006005Z",
  "architecture": "amd64",
  "os": "linux"
}
```

And here is an email sample if you use `mail` notification:

![](https://thepracticaldev.s3.amazonaws.com/i/9spc95rk5v8hnejjp7ec.png)

This application is in its early stages so your feedback is welcome! 🙂

---

Support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) 👏 or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏