teleren/devto huggingface dataset:
How to connect to AWS Elasticsearch cluster from outside of the VPC
Tags: elasticsearch, aws, cerebro
Published: 2019-11-20 09:44:38

### 1. Make a tunnel to an EC2 instance that is in the same VPC

```bash
ssh -fN -L 9200:youresclusteraddress:443 user@host
```

It may look ugly, so you can add this to `~/.ssh/config` file; add the following content to the file by `vim ~/.ssh/config`

```
Host myestunnel
  HostName host
  User user
  IdentitiesOnly yes
  IdentityFile ~/.ssh/sshkeyfile
  LocalForward 9200 youresclusteraddress:443
```

And then run:

```bash
ssh myestunnel -fN # with -f for "fork into background" and -N for "run no command"
```

Check the connection by:

```bash
curl -k https://localhost:9200/_cat/health
```

Or open [`https://localhost:9200/_cat/health`](https://localhost:9200/_cat/health) in browser.

If you see something like this (`1574240905 01:08:25 846366659123:clustername green 2 5 4 6 0 0 0 0 - 100.0%`) that means it's working well.

You may see this, just trust it.

![trust](https://thepracticaldev.s3.amazonaws.com/i/3xfqkfq0tbzzn0b1xfxp.png)

### 2. Use a beautiful GUI for querying and manage your cluster

There are some [GUI applications for Elasticsearch](https://www.slant.co/topics/11537/~elasticsearch-gui-clients). I like only one of them, it's [`cerebro`](https://github.com/lmenezes/cerebro).

#### 2.1 Install cerebro

```bash
wget https://github.com/lmenezes/cerebro/releases/download/v0.8.5/cerebro-0.8.5.zip
unzip cerebro-0.8.5.zip && mv cerebro-0.8.5 cerebro && cd cerebro
```

And run:

```bash
bin/cerebro -Dhttp.port=9201 -Dhttp.address=127.0.0.1 -Dplay.ws.ssl.loose.acceptAnyCertificate=true &
```

**Note** `play.ws.ssl.loose.acceptAnyCertificate=true` means no verify SSL.

Open [localhost:9201](http://localhost:9201) and connect to [https://localhost:9200](https://localhost:9200)
Looking to build a safe storage for your crypto currency and tokens? 
Published: 2019-11-20 09:43:27

 If meticulous user authentication is something you are keen on, then you should consider the services of Ionixx Technologies, a design-driven software solutions company with a blockchain focus. They have a strong project and solutions experience in crypto wallet development and are probably the best fit for all your crypto wallet development services. Schedule your free consultation today to speak to them.

To know more, https://www.ionixxtech.com/crypto-Wallet-exchange-development-company
Looking for a reliable cryptocurrency exchange development company to trade with your cryptocurrencies? 
Published: 2019-11-20 09:42:20

Talk to us! Ionixx has a team of experts who can develop safe, convenient and user-friendly exchange solutions for effective trading. Key features of our cryptocurrency exchange development services include access to advanced trading functionalities, decentralized trading of currencies, bug fixes,and two-way authentication among others.

To know more, https://www.ionixxtech.com/crypto-Wallet-exchange-development-company
Blockchain Application Development Company
Published: 2019-11-20 09:36:09

Looking for the best blockchain development company that offers end-to-end solutions right from consulting to post-delivery support, irrespective of your company size? Look no more! At Ionixx Technologies,we work with both startups to enterprises to get to the niceties before delivering the big picture. If you are seeking a tailored suite of blockchain development services from blockchain consulting to custom development, your answer to it is just a call away! 

Contact us for a free consultation, mail us @ info@ionixxtech.com or +1 (909) 757 - 3707

To know more about us : https://www.ionixxtech.com/blockchain-development-company 

Our Blockchain Services:

Private Blockchain Development
Blockchain Proof of Work Development
Blockchain Consulting Services
ICO Development
Blockchain Ethereum Smart Contract Development
Blockchain Decentralized Application Development
Crypto Wallets and Exchange Development
Blockchain Frameworks Development
Tips for staying healthy while travelling
Tags: fitnesstrainer, healthywhile, travelling, annadeeter
Published: 2019-11-20 09:05:57

Whether you are vacationing in Dubai or on a business trip to China. Maybe you are just paying a visit to a family friend or attending a ceremony in South Africa. Whatever the case may be, one of the horror stories that come with traveling is- extra weight. The weight that cost you energy and a lot of time has now broken the maximum you have always wanted. Well, those enticing sushi cannot be restricted. Besides, who get time to work out while vacationing? Anna Deeter, a fitness guru who through her personal experience in fitness and staying fit, inspire and mentor women to do the same. Here are amazing tips she shared to ensure you stay healthy and fit while on the go.
🔴 LIVE [Role-based auth in Angular 8] 🔑
Tags: angular, security, javascript
Published: 2019-11-20 08:13:49

---
title: 🔴 LIVE [Role-based auth in Angular 8] 🔑
published: true
tags: #angular #security #javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7fjtl8x1d4do9ch7h5ce.png
---
**Join me LIVE on Monday, 25 Nov, 19:00 GMT** to learn about:
[LINK] https://youtube.com/watch?v=p34F1qGAxBQ
👉 the architecture of role-based app
👉 possible security vunerabilities
👉 Router Guards & Interceptor
👉 some tricks with RxJS
👉 Express.js JWT middleware & more!
YPSKA #9 Svelte
Tags: javascript, svelte, framework
Published: 2019-11-20 07:23:51

So you're building a new website? Time to choose framework? React, Angular or Vue? Why not try out [Svelte](https://svelte.dev/)? In my opinion it looks very promising. It take a different approach than for instance React and Vue, instead of doing all the wiring at client-side it "compiles" your code into a more browser-digestible format at build time. This can have a great impact on performance. As a bonus, Svelte can also detect problems with your html at build time and notify you about that. 

There's a great [tutorial](https://svelte.dev/tutorial/basics) to get started, so there's no reason for you not to dive into the Svelte world right now.
My 'Simple' Life - Morning Routine
Tags: productivity, lifestyle, tips
Published: 2020-01-29 09:55:54

---
title: My 'Simple' Life - Morning Routine
published: true
date: 2019-11-20 06:35:36 UTC
tags: productivity,lifestyle,tips
canonical_url: https://www.jcmc.xyz/productivity/lifestyle/tips/2019/11/20/my-morning-routine.html
---

I am a big believer in “work smarter not harder”, hence why I am a programmer - and a Python programmer at that. If I have to do a job more than once you can guarantee there will be a little script for it somewhere. The same works for real life - I have standard routines for anything I find myself doing regularly. Removing thought and decision making from boring everyday tasks _in theory_ leaves more space for my poor brain to think about more fun and complicated things like optimising SQL and why my photo uploader is giving me a bazillion 500 errors.

It never occurred to me that this approach was strange til I was reading a thread on Reddit where someone was extolling the virtues of a solid morning routine and I realised that not everyone works this way.

Given I am about to leave my current job and start an entirely new one, which will be a big change from “must be in the office at 8:30” to working remotely from my ‘office’ I suspect this routine is going to change dramatically, so I am writing it here for posterity :D

* * *

**My Simple Life - Work Morning**

Timing is relative, sometimes I get up at 5:30, sometimes 7 but the basic routine remains the same regardless:

1. [evening before] Set up coffee machine (_see point 11_)
2. [evening before] Choose clothes and dump in the spare room
3. Kill alarm and get out of bed
4. Herd cats downstairs
5. Go for a wee, probably with a cat trying to sit on my knee (inconvenient)
6. Go feed the cats in the kitchen
7. Brush teeth while shower warms up
8. Shower (this has a whole routine of its own, which is apparently very weird, but it makes sense to wash things in the same order right? So you know you’ve not missed a bit…? Whatever, it’s what I do)
9. Dressed, hairdryer, many hair products
10. Back downstairs to kick the cats outside
11. Put the coffee on (because I will have inevitably forgotten to set the timer the previous evening)
12. Drink a big water and take vitamins (healthy af me)
13. Empty dishwasher while coffee is making
14. Pour coffee
15. Sit on sofa
16. Reddit for far too long
17. Race to put on coat and shoes and things in bag and omg I can’t find my keys how did that cat get back inside crap I’ve woken up the child…
18. Keys are always in the same pocket, they are not lost
19. Child needs a hug before I can leave
20. Leg it to bus
21. Murder podcasts
22. Wander to work
23. More coffee to get over the drama of the bus
24. Bum about chatting til standup
25. Breakfast
26. Begin useful things
18.11.19 - boot camp
Tags: devjournal, datascience, machinelearning, selftaught
Published: 2019-11-20 05:08:04

<i>My weekly accountability report for my self-study approach to learning data science.</i>

Shhhh. I skipped last week. Don't tell on me, ok?

Where am I at?

<ul><li>The biggest thing is participating in <a href="https://fullstackdeeplearning.com/">Full Stack Deep Learning</a>. This was a 2-day boot camp in Berekely. It was intense in a good way and an uncomfortable way. It some ways it was straight forward. Show up, listen, learn and network. But it was a stretch for me (I'm noticing this is a pattern) but I ultimately decided that it was a good one. I met a bunch of nice people and I'm looking forward to putting all the things I learned in to practice. I think it would help me a lot to share what I've learned, so I might try as I'm working through the labs and studying to pick out some highlights from many of the lectures and blog about it.
<p>
It was great because it covered things that I might get in bits and pieces if I'm paying attention to blog posts and tweets. But the advantage of curriculum-based instruction is relying on someone else's expertise of what is relevant to learn. Self-taught you have to make sure you trust your teachers. But the instructors (Pieter Abbeel, Josh Tobin, and Sergey Karayev) were fabulous and the bread and depth of knowledge were excellent.
<p>
Besides the lectures and labs, one of the features of the boot camp is the ability to take an exam and if you score high enough to access the recruiter network. You have a month and can take the test multiple times. That being said, I haven't looked at the questions yet and I'm not sure if I'll pass. Ultimately I think it's a great idea and there is no penalty for failing. It's not like the time I spend studying for it or taking it will be wasted time.
<li> My other studies weren't terribly focused last week. Freelancing was good. I'm getting to flex my SQL skills and am playing around with some NLP libraries. In general, both the boot camp and the work I'm doing are making me very aware of the way in which engineering with data and the probabilistic nature of it is quite different from traditional software engineering. And that's requiring an adjustment.
<li> Finally, does anyone have any suggestions on how to write blog posts quicker. Or should I just keep carving out more time than I think I should for this?
Tools I use to make UWP Apps
Tags: windows, tools, uwp, workflow
Published: 2019-11-20 05:02:26

---
title: Tools I use to make UWP Apps
published: true
description: Over the 2.5 years I've spent making UWP apps, here are the tools I use every day to design and code them.
tags: windows, tools, uwp, workflow
cover_image: https://images.unsplash.com/photo-1538370621607-4919ce7889b3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1049&q=80
---

---

Over the 2.5 years I've spent making UWP apps, here are the tools I use every day to design and code them.

# Design

### [Pen and paper](http://lmgtfy.com/?t=i&q=pen+and+paper)

When I come up with an idea, I write it down as soon as possible so I don't forget it. Then I start doing rough sketches of what the app screens would look like. I always start with the small screen sizes first. (I'll discuss why in another article).

### [Figma](https://www.figma.com)
After drawing out app screens on pen and paper, I start creating the screens in full detail on Figma. I personally love it because I can work on my design projects from anywhere since Figma is cloud-based!

### [Character Map UWP](https://www.microsoft.com/store/productId/9WZDNCRDXF41)
While designing the app in Figma, there are almost always Windows 10 specific icons that I need to use. Because of this, I search for the icons I need using Character Map UWP then copy them into Figma. Note: When I mean search, I mean literally search for the icon by its name. It's amazing!

### [Inkscape](https://inkscape.org/)
Usually, after I've finished designing the app, I create use Inkscape to create the app logo and store assets like the hero wallpaper, screenshots and poster art.

# Code

### [Visual Studio 2019](https://visualstudio.microsoft.com/)
It's pretty much the IDE that does it all. This is the preferred program used to create UWP apps. Code completion, debugging and now pair programming are the really awesome features that Visual Studio does well! By the way, the community edition is free!

### [Github](https://www.github.com/)
For every project I make, I always create repositories here. I mainly use this to have backups when things go wrong and to transfer my progress to other devices.

### [Github Gist](https://gist.github.com)
For lines of code that I write a lot, I save them as snippets on here. I wish it was more visible and more love was given to it.


### [Notifications Visualiser](https://www.microsoft.com/store/productId/9NBLGGH5XSL1)
This app makes the process of creating notifications (Both Toast and Live Tile Notifications) super easy, allowing you to test the notifications with templates and allowing you to export the code to produce the notification when you are done! Saves so much time.


---

If you have any more suggestions, please feel free to reply below. Thank you!
Object.create, basic understandings
Tags: javascript
Published: 2019-11-20 04:53:40

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/b8yfxt48ggdbx4cxd46x.png)
```javascript
    const obj1 = {test: "Hello"};
    const obj2 = obj1; 
```
> obj2 is not the copy of obj1, but it is obj1 too.  in javascript
> objects are mutable, they are addressed by reference, not by value.
```javascript
    console.log(obj1) //{ test: 'Hello' }
    console.log(obj2) //{ test: 'Hello' }
    obj1.test = "Hello Obj1";
    console.log(obj1) //{ test: 'Hello Obj1' }
    console.log(obj2) //{ test: 'Hello Obj1' }
```
>   Another case
```javascript
    const obj1 = {test: "Hello"};
    const obj2 = Object.create(obj1);
    console.log(obj1) //{ test: 'Hello' }
    console.log(obj2) //{}
    console.log(obj2.test) // Hello
```

> When you create an object using the Object.create then its values
> become proto to the created object
```javascript
    obj1.test = "Hello Obj1";
    console.log(obj1) //{ test: 'Hello Obj1' }
    console.log(obj2) //{}
    console.log(obj2.test) // Hello Obj1
    obj2.test = "Hello Obj2";
    console.log(obj1) //{ test: 'Hello Obj1' }
    console.log(obj2) //{ test: 'Hello Obj2' }
    console.log(obj2.__proto__) //{ test: 'Hello Obj1' }
```

> It creates a new property for the test but still the prototype value
> refer to obj1
How I got a dev job 5 months out of high school
Tags: career, beginners, javascript, typescript
Published: 2019-11-20 04:13:41

I have one word that sums up the journey to getting a job and that would be persistence. I am not writing this article to brag but I am writing to inspire. 

I started coding freshman year of high school when I made the decision to take the path of vocational education. Vocational education for anyone that isn’t aware is where you learn a career skill or trade alongside your traditional high school education. At the vocational school I attended I learned all the basics of HTML, CSS and Javascript. I didn’t get taught how to build APIs or use Javascript frameworks so I set out to teach myself.
 
At the start of 2019 I decided that I was going to dedicate every spare moment I had to learning and getting better. This meant that I woke up at 5am everyday to code before school this also meant that anytime that wasn’t spent with friends, family or work I was ultra focused on coding. 

By May 2019 I started to pull together my portfolio of a few projects that I made in angular and start to build my resume. I also did some mentoring sessions with a senior developer that really helped me define the path that I would need to take in order to get to where I wanted to be. So from June until September I applied to every single job that I could find on linkedIn that fit my ability (363 to be exact).

I had my first ever technical interview in september 2019, 4 months after graduating high school. I studied for an entire week reviewing JS fundamentals and whiteboarding. Long story short I didn’t get that exact job but I stayed persistent and continued to apply for jobs everyday. 

I applied for a job that I wasn’t qualified for just hoping that someone would see my resume and I could tell my story and show my work. Next thing I know I am talking with the head of development for the company and having another technical interview. This interview goes very well and I fly down to check out the office and meet the team.

That brings us to where I am now. I am currently working for a company in Louisville kentucky where I am developing products for the home healthcare field.
What's Your Fav. Dev Laptop? Why?
Tags: discuss
Published: 2019-11-20 03:03:06

---
title: What's Your Fav. Dev Laptop? Why?
published: true
tags: discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9kte6mijb49tdr16gzpv.jpg
---

As the title suggests: What's your favourite laptop for coding and development? Why?

Mine? I really like the Dell XPS series. But I know there are probably some better ones out there 😉
Day9:Read CSV File - 100DayOfRust
Tags: rust
Published: 2019-11-20 02:41:58

Today we are going to create a CLI to read a csv file that contains student score, then calculate the total and average score.

To keep the data simple, here is our `examresult.csv` content:

```
Alice, 90
Bob, 85
Chris, 92
Delan, 88
```

The first column is student name and the second is score

## Parse file path

To make our CLI accept an arg that user can specify the CSV file path, we use an external crate called [StructOpt](https://crates.io/crates/structopt). With it we can easily parse command line args.

First let's create our CLI program: 

```bash
cargo new readcsv
```

Then go to the foler `cd readcsv`, add `StructOpt` crate to the dependencies section in `Cargo.toml`:

```
[dependencies]
structopt = "0.3"
```

## Read CSV File

Now let's jump to the `main.rs` in the `src` folder, add code:

```rust
use std::fs;
use std::path;
use structopt::StructOpt;

#[derive(StructOpt)]
struct Args {
    #[structopt(short="p", long="path")]
    path: path::PathBuf,
}


fn main() {
    let args = Args::from_args();
    let content = fs::read_to_string(args.path)
                      .expect("File not found");
    let mut total_score = 0;
    let mut student_count = 0;
    content.lines().for_each(|line| {
        let fields: Vec<&str> = line.split(",").collect();
        let score = fields[1].trim().parse::<i32>().unwrap();
        total_score += score;
        student_count += 1;
    });
    println!("Total score is: {}, Avg is {}", 
             total_score, 
             (total_score as f32) / (student_count as f32));
}
```

You can see it is very easy to use StructOpt to collect command line args. After get the arg, we read file content to the `content` variable, then use a `for_each` iterator with a closure to calculate the total score. In the closure, we split line by "," and convert the second column value to integer. At last we print out the total and average score.

One benefit of `StructOpt` is, it will auto check the command line arg and print out its usage. If we use:

```
$ cargo run
```

without specifying the CSV file path, it will generate information like below:

```
error: The following required arguments were not provided:
    --path <path>

USAGE:
    readcsv --path <path>
```

While shows us that we need to pass `--path` arg. Now let's pass it:

```
$ cargo run -- --path=examresult.csv
```

Now it succeeds, result:
```
Total score is: 355, Avg is 88.75
```
Getting around CSS with Sass and Less
Tags: tutorial, beginners, webdev, javascript
Published: 2019-11-20 00:57:32


I was reluctant to tackle this project because CSS is undoubtedly my least favorite of the 3 core web languages: JavaScript, CSS, HTML. To me it’s been a necessary evil, or a time suck on days I want to procrastinate while maintaining the illusion of productivity.

There are three things I hate about CSS:

1. While being relatively easy to write, CSS files quickly become unmanageable in terms of line count and variable names
2. It’s a necessary evil, emphasis on necessary. CSS is inevitable
3. I’m bad at writing CSS quickly and haven’t been getting any better. CSS experience doesn't seem to build upon itself.
 -   Unfortunately, I’ve been the sort of coder who must spend hours Googling the CSS code to create any formatting beyond font-styling, coloring and floats.

Then, I saw a tweet earlier this week that alerted me to CSS language extensions, namely SASS and LESS. From what I’ve read, Sass is the most popular, while Less is lightweight and ideal for smaller projects.

While Sass and Less seem to take some of the pain out of formatting your apps, using one does not mean it can replace all your CSS. Sass and Less share a lot of the same features. But SASS is based on Ruby, while LESS uses JavaScript.

I have spent zero time working with either Sass or Less so there’s not much I can offer in terms of feedback based on my experience. My goal for this blog post was to offer that feedback, but my laptop battery stopped charging yesterday.

I quickly wrote this blog in case my replacement battery does not arrive by tomorrow.

But of course, several developers have offered their insights on the differences. Check out this [gist]( https://gist.github.com/chriseppstein/674726), by Chris Eppstein, that provides a direct comparison between the two.
Anyone planning on doing Advent of Code this year?
Tags: discuss
Published: 2019-11-20 01:21:44

I wasn't able to keep up last year, but really love the challenge & intend to try again this year! Anyone else participating or interested? Check out the site if you've never heard of it before: [Advent of Code](https://adventofcode.com/2019/about)

![Excited Anna gif](https://media.giphy.com/media/3o7aD2bww8abIWwFmE/giphy.gif)
Partially Stage and Commit Changes in Git
Tags: git
Published: 2019-11-20 00:46:34

---
title: Partially Stage and Commit Changes in Git
published: true
description: 
tags: git
---

Did you know you can partially stage and commit your changes in git?

Suppose you have file `numbers.txt` checked into your git repo with the following content:

```
1
2
3
4
5
6
7
8
9
10
```

Modify `numbers.txt` to look like this:
```
1 is for one.
2
3
4
5
6
7
8
9
10 is for ten.
```

Use `git add -p` to interactively decide which chunks of the modified file to commit.  

Hit `n` to bypass the first chunk.   

```
diff --git a/numbers.txt b/numbers.txt
index f00c965..32b6ae7 100644
--- a/numbers.txt
+++ b/numbers.txt
@@ -1,4 +1,4 @@
-1
+1 is for one.
 2
 3
 4
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
```

Hit `y` to stage the second chunk.

```
@@ -7,4 +7,4 @@
 7
 8
 9
-10
+10 is for ten.
Stage this hunk [y,n,q,a,d,K,g,/,e,?]? y
```

Now commit as normal.

```
$ git commit -m "Modify the 10th line"
```

You still have the changes to line 1 in your workspace but now your modification of line 10 is committed to the repo.