teleren/devto huggingface dataset:
Cat facts with Python and API
Tags: python, programming
Published: 2019-10-21 21:19:55

Did you know you can get cat facts with Python?

There's a <a href="https://alexwohlbruck.github.io/cat-facts/docs/">API for cat facts</a>. Yes, really :)

An API lets you get data, it's a "data provider". They are used in almost every web app. This lets you practice with APIs and Python.

It has two end points

| URL        | what           |
| ------------- |:-------------:| 
| /facts  | Retrieve and query facts
| /users* | Get user data

If you open the url <a href="https://cat-fact.herokuapp.com/facts">https://cat-fact.herokuapp.com/facts</a> you get all the facts in JSON data. An id would give only a single object.

So how to use that in Python?


This little program with requests will do it:

    #!/usr/bin/python3
    #_*_coding: utf-8_*_
    import time
    import json
    import requests
    
    data = requests.get('https://cat- fact.herokuapp.com/facts/58e0086f0aac31001185ed02')
    print(data.json())

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpeopledotcom.files.wordpress.com%2F2017%2F08%2Fcat-meme-2.jpg&f=1&nofb=1" alt="cat fact">

## Get cat fact

What if you want only one fact?

You can add the id like this:

    data = requests.get('https://cat-fact.herokuapp.com/facts/58e0086f0aac31001185ed02')

Then use the text attribute (see inside json object) to get the fact

    #!/usr/bin/python3
    #_*_coding: utf-8_*_
    import time
    import json
    import requests
    
    data = requests.get('https://cat- 
    fact.herokuapp.com/facts/58e0086f0aac31001185ed02')
    print(data.json()['text'])

This is how you can interact with the API. Try it out on your own :)

**Resources:**

* <a href="https://pythonbasics.org/">Learn Python Programming</a>
* <a href="https://pythonbasics.org/json/">More on JSON</a>
* <a href="https://alexwohlbruck.github.io/cat-facts/docs/">API with data about cats</a>
Python SnakeBytes: The Walrus Operator
Tags: python, coding
Published: 2019-10-21 21:12:12

---
title: Python SnakeBytes: The Walrus Operator
published: true
description: Learn a Python trick in a minute or less!
tags: python, coding
series: Python SnakeBytes
cover_image: https://thepracticaldev.s3.amazonaws.com/i/48xzce3q3ffqmuxzwcz2.jpg
---

The **assignment expression**, also known as the **walrus operator** (`:=`), was introduced in Python 3.8. An assignment expression performs assignment, while also returning the assigned value from the expression. This allows you to store and test a value in the same line.

```python
temps = [56, 72, 65, 77, 73]

if ((average := sum(temps) / len(temps)) > 80):
    print("It sure is warm!")
elif (average < 50):
    print("It's quite cold.")
else:
    print("Nice weather we're having.")
```

The `average` variable was defined within the `if` expression, so it can be reused in the `elif`.

When used in a comparison, it may be necessary to wrap the assignment expression in parentheses, as seen here. Otherwise, the result of the comparison will be stored.

But always remember: **readability matters**. Only use the walrus operator if it will actually make the code more readable. My use of the operator in the example would probably only be justifiable if I don't intend to reuse the `average` variable outside of the conditional.

---

[PEP 572: Assignment Expression](https://www.python.org/dev/peps/pep-0572/)
HTTPS Locally in Vue.js
Tags: javascript, security
Published: 2022-08-25 13:39:59

---
title: HTTPS Locally in Vue.js
published: true
date: 2019-10-21 20:48:13 UTC
tags: JavaScript,Security
canonical_url: https://davidtruxall.com/https-locally-in-vue-js/
---

As I have been experimenting with FIDO2 and Yubikey, I discovered that in order to test it running locally, I needed to run the site with SSL/TLS. Vue does support this, but there were a few steps:

1. Create certificates Locally
2. Trust the new certificates
3. Add the certificates to the project

There are plenty of articles detailing the first two steps, here’s two:

- [Using A Mac](https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/)
- [Using Windows](https://zeropointdevelopment.com/how-to-get-https-working-in-windows-10-localhost-dev-environment/)

After creating the Certificate Authority and certificates, you should end up with three files, the CA certificate, a TLS certificate, and a private key file. Besides these three files, it’s very important that you trusted the CA certificate in your operating system. Create a new directory in the root of your web project and call it “certs”. Move all three files to that directory.

If your project does not have a `vue.config.js` file, create one in the root of the project. Vue uses this file to hook into WebPack when running and building your site. Add the following to that file:

```

'use strict'

const fs = require('fs')
const appRoot = process.cwd()

module.exports = {
  devServer: {
    host: 'localhost',
    port: 8080,
    https: {
      key: fs.readFileSync(`${appRoot}/certs/server.key`),
      cert: fs.readFileSync(`${appRoot}/certs/server.crt`),
      ca: fs.readFileSync(`${appRoot}/certs/rootCA.pem`)
    },
    hotOnly: true
  }
}

```

Of course, you’ll need to substitute your filenames for the files in my code snippet. The snippet allows WebPack to use the Node.js built-in `fs` library and it acquires the current working directory (cwd) in order to get an absolute path to your certificate files. The WebPack devServer then uses those to serve up your site locally over https.
Hosting your website with Netlify
Tags: webdev, netlify, frontend, hosting
Published: 2019-10-21 20:45:26

I love how easy it is to set up automatic hosting of a website with Netlify.

Sign in to [Netlify](https://app.netlify.com/) and click the "New site from Git" button. Select your git repository, either GitHub, GitLab or Bitbucket, and give access to the wanted repository. 

If you have build commands, such as `npm run build`, you can enter those. Commands can be chained with &&.

Enter the path of the directory to publish. The directory containing the index.html file

Now hit Deploy site and you are done. New pushes to your git repository will automatically be published to your website. You can change your subdomain in "Site settings" and "Change site name".

Terminal commands you don't need, but might find useful:
```
# Install netlify cli globally
npm install netlify-cli -g

# Serving your site on localhost
netlify dev

# Connect folder to Netlify project
netlify init

# Serve your local development online ang get a url you can distribute
netlify dev --live

# Manually deploy
netlify deploy --prod
```

That's all, thank you for reading 💙

This article is part of Hosting a Website series, I usually choose Firebase when I want to deploy manually or are using other Firebase products and Netlify if I want CD (continuous delivery). Though both manually and CD is possible to achieve with both of them.
Very nervous for 1st day at HACK REACTOR
Published: 2019-10-21 20:36:58

Tomorrow, is going to be my 1st day at Hack Reactor immersive. It seems a bit insane that it’s actually happening! ! I feel like I am not prepared enough or ready for this day yet. I have learned a lot of things over the past months. I should feel more confident about my skills. However, I am still super nervous to start. I am also excited to begin the program. All this prior preparation is leading to something.

I keep hearing from others how this feeling is normal. Also heard that during Hack Reactor you do not even have time to feel scared since you are always busy doing something. The program moves so fast that I probably won’t be able to feel scared or unprepared…Similar to playing a sport by just playing it, you know? (i am a huge sports guy, you’ll see all my sports analogies). I do not remember feeling scared about the game while actually playing the game. You just play the game.

During my pre-class for the immersive our instructor provided us with a tip for success. This is probably one of the best things I heard. It might exactly what I needed at the time. Our instructor made a reference to the Simpsons. Do you like the Simpsons?!? I love the show! One of my favorite episodes it’s called ‘Do It For Her” , this is an episode in which Homer Simpson covers up a poster at work with photographs of Maggie in order to create a positive message. You simply have to watch the short video below to understand it (you might cry, so don’t watch it!!). This 3 minute video was all I needed to feel motivated again! Motivation is like a battery, sometimes you need charge it again, correct?

{% youtube x2mS3uDqQL4 %}

Anyways, I hate to admit but I teared up after watching the video. I was on the verge of giving up in coding. I thought about going back to finance and do excel all day at work. After watching the video, I remembered thinking about my ‘why’, like Homer Simpson, I felt some kind of motivation that led me to this moment. I am very scared about Hack Reactor but I know my ‘why’ && this is all I need to complete the program!
Execute Cypher Task Updates
Tags: uncategorised, neo4j, ssis
Published: 2020-02-19 09:33:39

---
title: Execute Cypher Task Updates
published: true
date: 2019-10-21 20:30:16 UTC
tags: Uncategorised,Neo4j,SSIS
canonical_url: 
---

Last week, Anabranch released version 1.1 of the tools for Neo4j – which included a very welcome addition to the toolset – being able to pull data **from** a Neo4j instance.

After doing the demo [post](https://dev.to/cskardon/using-a-data-flow-to-move-data-from-neo4j-in-ssis-2on2-temp-slug-7463602) – I noticed a peculiarity – a quirk if you will with how the ‘Execute Cypher Task’ (see [here](https://dev.to/cskardon/neo4j-ssis-connecting-and-executing-cypher-in-a-control-flow-5f60-temp-slug-8430168)) worked with multiple Neo4j Connection Managers defined – it would execute the Cypher against all the Connection Managers, not any specific one. This makes sense in some form – as a Control Flow Task doesn’t have a ‘Connection’ selector unlike a Data Flow Task.

Version 1.2 of the tools fixes this and tidies up the Execute Cypher Task to have a better user interface as well.

## Adding Cypher

![](https://xclave.co.uk/wp-content/uploads/2019/10/image-21.png)

The Cypher box still has highlighting, but now lines up to the edges properly.

## Choosing A Connection

![](https://xclave.co.uk/wp-content/uploads/2019/10/image-22.png)

You can choose from a drop down which connection you want to use. You will only see Neo4j Connection Managers here. The name of the Connection Manager will be the one you set it to.

## Validation

![](https://xclave.co.uk/wp-content/uploads/2019/10/image-23.png)

You will get a red cross on your task if you’re missing things (in this case the connection). If you look in the ‘Error List’ you will be able to see all the errors:

![](https://xclave.co.uk/wp-content/uploads/2019/10/image-25.png)

## Getting 1.2

To get version 1.2, please visit: [http://bit.ly/neo4jssis](http://bit.ly/neo4jssis) register and you’ll be sent out the download link. Registration is only used to let you know of updates to the tools, no marketing!
NeoVIM register resetting upon start
Tags: neovim, register, shada
Published: 2019-10-21 20:23:13

I've had this super annoying issue in NeoVIM where my registers always gets reset to gibberish when i start NeoVIM. This will in turn fill my MacOS clipboard with the same gibberish.

This was especially annoying when switching to a newly opened NeoVIM instance aftere copying something i needed in said NeoVIM instance.

I did a bunch of Googling to see if i could find someone else with the same issue to no avail.

When trying to fix [another issue i had with my NeoVIM]() i managed to fix this issue at the same time! Hooray!

## TLDR;

If your NeoVIM always has the same registers when starting up you have a issue with your ShaDa temp files. It's easily fixed by removing the ShaDa directory `rm -rf ~/.local/share/nvim/shada`
Hosting your website with Firebase🔥
Tags: webdev, firebase, frontend, hosting
Published: 2019-10-21 20:19:35

I love how easy it is to host a website with Firebase.
## Set up
Create a project in the [Firebase console](https://console.firebase.google.com/) by just a few clicks.

If you haven't used firebase before, install the cli and login:
```
npm i -g firebase-tools
firebase login
```

Then initiate your project:
```
firebase init
```
Select "Hosting" with space then enter. Then select the project created in the Firebase console. Then enter the path to the folder your index.html file is located (i.e. public). If you have a single-page app and want all urls to point to index.html select yes.

## Deploy
```
firebase deploy
```
Congratulations, you have now hosted your website. You will find your page as a subdomain of firebaseapp.com and web.app. Like this https://projectid.firebaseapp.com and https://projectid.web.app. If you need your own domain, just go to Hosting in the firebase console and press the Connect domain button. Each time you need to update the content, just make the changes and hit firebase deploy again.

Check out [Firebase](https://firebase.google.com/products/hosting/) for more information.

## Conclusion
```
firebase init
firebase deploy
```

That's all, thank you for reading 🔥💙

This article is part of Hosting a Website series, I usually choose Firebase when I want to deploy manually or are using other Firebase products and Netlify if I want CD (continuous delivery). Though both manually and CD is possible to achieve with both of them.
E138: All ~/.local/share/nvim/shada/main.shada.tmp.X files exists, cannot write ShaDa file!
Tags: neovim, shada, macos
Published: 2019-10-21 20:17:00

I've had this annoying error message flashing by when quitting neovim for a while now:

![](https://i.imgur.com/ls4eYiz.png)

The only reference to it i found while googling was [this github issue](https://github.com/neovim/neovim/issues/85870). I ended up just `rm -rf ~/.local/share/nvim/shada` and it fixed this issue and another annoying issue I've had for a while.
4 ways to earn by writing or editing a Wikipedia page
Tags: marketing, wikipedia, writings, writers
Published: 2019-10-21 20:02:56

Being a writer is not an easy task. You need to have the skills and expertise to establish yourself as a writer or editor. However, today, the market is becoming more crowded with writers and the industry is growing more competitive. It is difficult for writers and editors to find a suitable job because many writers are providing services at highly reasonable pricing ranges. 

Becoming a writer doesn’t only mean to be able to develop skills and expertise as a writer. It is also essential to establish your name as a writer to find the required work. One may struggle to find a perfect genre of writing, but you need to explore the different styles of writing to develop your name in a particular genre. 

In the market today, many businesses are taking advantage of Wikipedia marketing and hire [Wikipedia editors](https://thewikiinc.com/blog/who-are-the-editors-of-wikipedia/) or freelance writers to produce a credible page for their business. Wikipedia writers are one of the highest-paid writers as it requires extensive research and technicalities in writing a Wikipedia page which for any writer can be a hassle. Here is a brief guideline which can help you to become a professional at writing: 

**Create an authentic Wikipedia account**

If you are an active contributor of Wikipedia, it is likely that you can publish your Wikipedia page without a hassle. Wikipedia can be very strict about upholding the legitimacy of the platform and may block any defective source or IP address. 

**Build a good track record:**

Build a reputation on the platform for a hassle-free publication of your article. You can start by editing the information present on Wikipedia to be recognised as a credible contributor to information on the platform. Making contributions at the platform before creating a Wikipedia page can build credibility on the platform, and you can get hired to provide services of Wikipedia page creation. 

**Replicate the writing style**

You need to make sure that your Wikipedia page abides by all the rules and strict guidelines of the platform. You must use easy vocabulary and tone of writing, so the information you incorporate in your article is understood by all. 

**Marketing**

Once you have your page published on the platform, you need to market it to get more projects which specialist in your field. You can take advantage of the social media page and make a video of the matters you have discussed on your page and give the link of your Wikipedia page in the description box.
Handle Angular 9|8 HTTP Requests with Observables
Tags: angular, angular98, http, httprequestswithobservables
Published: 2020-02-07 09:26:31

---
title: Handle Angular 9|8 HTTP Requests with Observables
published: true
date: 2019-10-21 20:02:18 UTC
tags: Angular, Angular 9|8 , HTTP, HTTP Requests with Observables
canonical_url: https://www.positronx.io/handle-angular-http-requests-with-observables/
---

The post [Handle Angular 8 HTTP Requests with Observables](https://www.positronx.io/handle-angular-http-requests-with-observables/) appeared first on [positronX.io](https://www.positronx.io).

**In this Angular 8/9 tutorial, we are going to learn how to handle asynchronous HTTP requests using Observable and RxJS operators.**

We are going to create a live country search module in an Angular app. For which we will be taking help of country list api and handle that API with RxJS observables and operators. Final output of this tutorial will look something like below.

[click here to read more](https://www.positronx.io/handle-angular-http-requests-with-observables/)
whats your dev setup
Tags: discuss, workstations, watercooler
Published: 2019-10-21 20:00:00

As far as hardware, I have a dell latitude e7450 with a 6th gen i5, 16 gigs ram, and a 256gb m.2. My software is Ubuntu 19.10, vs code, intellij 2019.3 EAP, Android studio, and git kraken. whats your setup?
Welcoming Molly - The DEV Team's First Lead SRE!
Tags: meta
Published: 2019-10-21 19:59:35

---
title: Welcoming Molly - The DEV Team's First Lead SRE!
published: true
description: 
tags: meta
cover_image: https://thepracticaldev.s3.amazonaws.com/i/97a2sge9bgapcn6szuep.png
---

We are so excited to welcome Molly to the DEV Team as our first Lead Site Reliability Engineer!


Molly has been an incredible DEV member -- we felt her impact the moment she joined. In less than one year, Molly has published over **fifty** posts and has left _several hundred_ comments offering her support and insights to the community. 

We are so lucky to have her on the team!

Everyone at DEV is eager to learn from Molly's expertise, and we can't wait to work together to bring the community a more stable and reliable DEV experience. To learn more about Molly's background and motivation for joining DEV, check out her post below: 

{% link https://dev.to/molly_struve/dev-meet-site-reliability-engineering-4em7 %}

![corgi-high-five](https://media.giphy.com/media/lr2bkSkxMWFCo/giphy.gif)
Why the NordVPN network is safe after a third-party provider breach
Tags: security, vpn, nordvpn
Published: 2019-10-21 19:54:23

---
title: Why the NordVPN network is safe after a third-party provider breach
published: true
description: 
tags: security, vpn, nordvpn
---

"We understand the security concerns that arose from the information found online by security researchers and will address them in detail here."

NordVPN clears about recent situation: https://nordvpn.com/blog/official-response-datacenter-breach/
The Quick and Dirty Guide to Pull Requests
Tags: github, beginners, tutorial
Published: 2019-10-21 19:06:24

![xkcd 1597](https://imgs.xkcd.com/comics/git.png)

As a beginner to programming, I’ve struggled to understand the complexities of GitHub. While I appreciate the basic concept of Git, the actual workflow can feel overwhelming at times.

My purpose here is not to give a deep or theoretical understanding of GitHub, but rather to document the commands you need to merge a branch into the master on a shared repository. (Note: this is different from making a Pull Request from a forked repository.)

If you do want a deeper understanding, I’ve linked to some good resources at the bottom of the post.

###Steps
**1. Create your branch**
   ```
   git checkout -B your-branch-name
   ```
   This command will both create and move you to a new branch.
   ![V 1](https://i.imgur.com/6g86sNZ.gif)

**2. Push your branch to GitHub**
   	Your branch will not automatically show up on GitHub. To push it up, run:

   ```
   git push origin [name_of_your_new_branch]
   ```

**3. Do your work**
   ![Working](https://thumbs.gfycat.com/GlitteringKnobbyAoudad-size_restricted.gif)


**4. Push your changes up to your branch on GitHub**
   ```
   git add .
   git commit -m “Message”
   git push
   ```
   ![V 4](https://i.imgur.com/NBL0Re5.gif)

**5. Open a Pull Request**
   Opening a pull request is you asking the repository’s maintainer, “Please pull my changes to master.”
   * On GitHub, make sure you’re on the branch you were working on.
   * Click “New Pull Request”
   * Make sure the “base” is what you want to merge into; in this case, I want to merge into master.
   ![V 5a-c](https://i.imgur.com/qqoD3fi.gif)
   * Write a title and description.
   * Click “Create Pull Request”
   ![V 5d](https://i.imgur.com/fB4dgNB.gif)


**6. Approve a Pull Request**
   Approving the Pull Request will probably be done by someone else on the team.
   * Click “Merge Pull Request”
   * Add a comment if desired.
   * Click “Confirm Merge”

   ![V 6](https://i.imgur.com/tGpsTNR.gif)


###What if there are conflicts?
When you open the pull request, it will let you know. You may continue to make the request anyway.
   ![Conflicts](https://i.imgur.com/L9jMfse.gif)

1. Click “Resolve Conflicts”
   This will show you the conflicts in the document. Edit whatever needs to be edited.
   ![C A](https://i.imgur.com/x8zNW39.gif)
2. Click “Mark as Resolved”
3. Click “Commit Merge”
   ![C B-C](https://i.imgur.com/PwYQUIB.gif)


###Resources
1. A high-level overview of the GitHub workflow: [link](https://guides.github.com/introduction/flow/ )
2. GitHub's two-page cheatsheet: [link](https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf)
3. Details on how to create a Pull Request: [link](https://help.github.com/en/articles/creating-a-pull-request)
4. GitHub Tutorial: [link](https://git-scm.com/docs/gittutorial)
Laravel 4 PHP 7.2+
Tags: laravel, php, dragons
Published: 2019-10-21 18:43:49

https://github.com/postedin/laravel-4-php-latest

We have legacy projects that are hosted on the same servers as modern (Laravel 6) projects. It's much more productive to run everything on the same PHP version than to try keep multiple provisioned correctly.

So we are currently maintaining Laravel 4 with PHP at the latest version.

Soon we will be moving our servers and just hosting legacy and modern separately, but that has been delayed for months now ¯\\_(ツ)_/¯.