teleren/devto huggingface dataset:
Advent of Code 2019 Solution Megathread - Day 1: The Tyranny of the Rocket Equation
Tags: adventofcode, challenge, adventofcode2019, spoilers
Published: 2019-12-01 05:30:45

---
title: Advent of Code 2019 Solution Megathread - Day 1: The Tyranny of the Rocket Equation
published: True
description: Help calculate the fuel needed to reach Santa on the first challenge of the 2019 Advent of Code.
tags: adventofcode,challenge, adventofcode2019, spoilers
series: Advent of Code 2019 Solutions
cover_image: https://imgur.com/OVTZtTs.png
---

Well, we're off to a running start! Since the leaderboard is safely locked, we can go ahead and post our solutions now!

### [Day 1 - The Problem](https://adventofcode.com/2019/day/1)

Looks like Santa got himself in a bit of trouble this year! Seems like we're not dealing with [time shenanigans](https://adventofcode.com/2018), [printer trouble](https://adventofcode.com/2017), [high-precision clock fueling](https://adventofcode.com/2016) or [weather machine woes](https://adventofcode.com/2015). This year we need to get Santa and his sleigh back from ***the edge of space***.

But first... we need to get to him. Getting to him requires fuel. Let's calculate how much we'll need to make the trip.

Part 1 of this problem was a nice straightforward warmup. Part 2 was only a little bit trickier than the first, but I overthought it and gave myself the wrong answer anyway.

### Ongoing Meta

#### Dev.to List of Leaderboards

* `120635-5c140b9a` - provided by [Linda Thompson](https://dev.to/lindakatcodes) 

 If you were part of [Ryan Palo](https://dev.to/rpalo)'s leaderboard last year, you're still a member of that! 

If you want me to add your leaderboard code to this page, reply to one of these posts and/or send me a DM containing your  code and any theming or notes you’d like me to add. (You can find your private leaderboard code on your "[Private Leaderboard](https://adventofcode.com/2019/leaderboard/private)" page.)

I'll edit in any leaderboards that people want to post, along with any description for the kinds of people you want to have on it. (My leaderboard is being used as my office's leaderboard.) And if I get something wrong, please call me out or message me and I’ll fix it ASAP.

There's no limit to the number of leaderboards you can join, so there's no problem belonging to a "Beginner" *and* a language specific one if you want.

#### Neat Statistics

I'm planning on adding some statistics, but other than "what languages did we see yesterday" does anyone have any ideas?
Git it? Got it? Good.
Tags: git, beginners
Published: 2019-12-01 05:25:23

Hey everyone! This will be a short and sweet blog on git commands. Let's *git* started (that was cringy for me too but I couldn't resist!).

## Git init
This might be the simplest command. It creates a new repo and all you have to do is type this:

                      git init [repository name]


## Git clone
This will to create a copy or "clone" of an existing repo. Just type:

                      git clone [url to the repo]

A handy shortcut that can be created is *gcl*, if you're into saving keystrokes check I'd suggest using it.

## Git diff
Git diff shows the differences in files that have not yet been staged. To see them, all you have to type is "git diff".

### Git diff --staged
This will show you the differences in the files that have been staged.


### Git diff [branch1] [branch2]
Shows the differences between the specified branches.


## Git reset
This will unstage a file but keep the contents the same.

git reset [file name]

### Git reset [commit]
This command undoes all commits after the specified commit but changes are only saved locally.

### Git reset -hard [commit]
Returns content back to the specified commit.

## Git rm
Will delete the file from your working directory and stages it.

git rm [file]

## Git remote

This command will connect your local repo to the remote server:

git remote add [variable name] [remote server link]


Example:

git remote add origin https://github.com/youracccount/repo.git


That's it for this time. Let me know what git commands you use often or think are important to know in the comments!!!

Resources:

- [Git Commands and Examples](https://dzone.com/articles/top-20-git-commands-with-examples)
The Best Pack Of Tools For Cyber Security Students | Lockdoor Framework
Tags: security, sofianehamlaoui, cybersecurity, redteaming
Published: 2019-12-01 04:49:44

Lockdoor is a Framework aimed at helping penetration testers, bug bounty hunters And cyber security engineers. This tool is designed for Debian/Ubuntu/ArchLinux based distributions to create a similar and familiar distribution for Penetration Testing. But containing the favorite and the most used tools by Pentesters. As pentesters, most of us has his personal ' /pentest/ ' directory so this Framework is helping you to build a perfect one.

We all know that there a lot of frameworks and similar tools like lockdoor, So what made lockdoor different, was Adding The Favorite and most used tools by pentesters, Automating the Pentesting process to help you do the job more quickly and the best part ! CHEATSHEETS & RESOURCES! So yes, that's why we made a quick video about lockdoor.

◉ Repo: https://github.com/SofianeHamlaoui/Lockdoor-Framework 

◉ The tool developer’s Twitter account : https://twitter.com/S0fianeHamlaoui

◉ Kitploit post about the tool : https://www.kitploit.com/2019/10/lockdoor-framework-penetration-testing.html

◉ The Shadow Brokers video : 
https://youtu.be/6njKRrKQtow

With a lot of articles and awesome people sharing it everywhere with anyone.
Day13:Sort Vector - 100DayOfRust
Tags: rust
Published: 2019-12-01 03:41:57

Sort vector: use `sort` and `sort_by` method

```rust
#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
struct Person {
    name: &'static str,
    age: i32,
}


fn main() {
    // sort vector of int
    let mut v = vec![3, 1, 4, 2, 5];
    v.sort();
    println!("V is {:?}", v);
    
    // sort vector of float
    // float number implemented PartialOrder trait
    let mut v2 = vec![1.3, 3.2, 1.05, 2.3];
    v2.sort_by(|a, b| a.partial_cmp(b).unwrap());
    println!("V2 is {:?}", v2);
    
    // sort vector of self-defined struct
    let mut v3 = vec![
        Person {name: "Bob", age: 12},
        Person {name: "Alice", age: 18},
        Person {name: "Chris", age: 17}
    ];
    v3.sort_by(|a, b| a.age.cmp(&b.age));
    println!("V3 is {:?}", v3);
    
    v3.sort_by(|a, b| a.name.cmp(&b.name));
    println!("V3 is {:?}", v3);
    
    // we can directly call sort b/c struct
    // has derived Eq, Order, PartialEq and PartialOrder
    v3.sort();
    println!("V3 is {:?}", v3);

}
```

Result:
```
V is [1, 2, 3, 4, 5]
V2 is [1.05, 1.3, 2.3, 3.2]
V3 is [Person { name: "Bob", age: 12 }, Person { name: "Chris", age: 17 }, Person { name: "Alice", age: 18 }]
V3 is [Person { name: "Alice", age: 18 }, Person { name: "Bob", age: 12 }, Person { name: "Chris", age: 17 }]
V3 is [Person { name: "Alice", age: 18 }, Person { name: "Bob", age: 12 }, Person { name: "Chris", age: 17 }]
```
Welcome to PHP 7.4.0 (I upgrade from 7.3.12)
Tags: php, selfnote, welcomenote, sayhello
Published: 2019-12-01 02:14:26

---
title: Welcome to PHP 7.4.0 (I upgrade from 7.3.12)
published: true
description: Just say welcome to PHP 7.4.0
tags: php, self note, welcome note, say hello
cover_image: https://thepracticaldev.s3.amazonaws.com/i/wlpehv85v3lzukqq05lq.jpg
---

Dear PHP,
I am using you since... maybe 5.3 and you already helped me a lot on my nerd journey. Today I open php.net and I forgot that Nov 28 is the historical day. It's the launch of PHP 7.4.0.

Congrats to all PHP core team, QA team and all others people that make this happen.

Currently I have PHP 7.3.12 running on my CentOS 7.7 using Remi repo. How to update? I just do this.

```bash
yum-config-manager --enable remi-php74
yum update
```

then

```bash
php -v
```

then see below 

```bash
[root@sony]# php -v
PHP 7.4.0 (cli) (built: Nov 26 2019 20:13:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
```

Ow nice :)

PHP 7.4.0 comes with several improvements and new features.

- Typed Properties
- Arrow Functions
- Limited Return Type Covariance and Argument Type Contravariance
- Unpacking Inside Arrays
- Numeric Literal Separator
- Weak References
- Allow Exceptions from __toString()
- Opcache Preloading
- Several Deprecations
- Extensions Removed from the Core

Ow ow, someday I will use those new things step-by-step as needed.

Thank you PHP.

Reference:
- https://www.php.net
- https://blog.remirepo.net/post/2019/11/28/PHP-version-7.4.0-is-released
Node.js VS Rails?
Tags: rails, node, javascript
Published: 2019-12-01 01:10:31

Why is node.js so popular as a back-end server and what is so bad about Rails? You are right a small app for a local shop so they could do some marketing, not a full eCommerce page most probably Rails is fine. You won’t be getting that many hits and your costs will be minimal. However think Twitter or even a small e-commerce website if you will be using a blocking I/O which means the lines are shared and everything runs synchronously, the way Active Record(an ORM) works. When we query the database while we wait for a response the server won’t process a new request on the other hand non-blocking I/O when we will query the database we wait for a response or as we call them today promises. While we are waiting we can move on to the next request till we get a response. Think of a checkout counter at the grocery we wait for the cashier to finish with the person in front of us who needs a price check on an item even if we only have two items (seems like a waste of time).

With this architecture, we have the ability to build a bigger and better system. In addition, Node.js is lightweight and more efficient. Scalability and server costs are the companies’ number one priority. If the site will be slow it makes less money, if the hosting server CPU costs are high their profit margin will be smaller. Being a developer is not just about being able to write or even debug code. You need to understand things on a deeper level as this will help you decide what technologies are a good fit for each project.

All the best,

Simcha Greenbaum
What to do with an eclectic background?
Tags: career, help
Published: 2019-12-01 00:32:31

I'll start by getting to the point: What should I emphasize/de-emphasize in this background as I move into the data science job search?  
[This started as a comment to a [post](https://dev.to/paulasantamaria/does-your-background-make-your-work-unique-5g18) by Paula Santamaría, then morphed into a post in its own right.]  
I'm sure my background will make my work unique. (Currently I'm studying data science). I just hope that background, which is eclectic, will prove useful in my new career.


I got a degree in chemistry because I like to solve problems and ask how things work. During that degree I published a real deal scientific paper with a physics professor.  
I also got a degree in music because I love music and, perhaps equally important, I like performing.
I started a PhD program in chemistry to decode photosynthesis, solve renewable energy, and save the world. I ended up leaving with a master's degree, my tail tucked between my legs, and my health (mostly) intact.
After that, well after taking time to heal up, I tried a few different jobs: tutor, uber driver, freelance writer, Nothing stuck. 
But then I heard from a former grad school colleage who had done a coding camp and was now happily employed. I remembered that I had enjoyed the little bit of programming I did in grad school. It was perhaps the best part of a difficult time. So that got me thinking tech bootcamps. Furthermore, some combination of hype and genuine interest in programming and asking precise questions led me to data science.
To put it another way, I was still into science but I was sick of chemistry, and I liked programming. Data science just seemed to make sense.  

Since then, I've been self-studying programming and data science as well as taking a beginner data science course online with Metis, and working towards a computer science certificate, also online, from Loyola.
In January I will start the in person Metis Data Science Bootcamp, a 12-week intensive program with a project-centered curriculum and excellent career support.

When I look at that background I see some strengths and some weaknesses. My question is: which things will be valuable to focus on, on which things are better left unsaid?
Kubernetes is not just about Tech. It has a huge community!
Tags: kubernetes, cloudnative, community
Published: 2019-12-01 00:13:35

---
title: Kubernetes is not just about Tech. It has a huge community!
published: true
description: 
tags: Kubernetes, CloudNative, Community
---

## Intro

When talking about Kubernetes, the philosophy inherited from Google and the advantages of container technology are of course indispensable.

But Kubernetes has evolved so far not only in technology but also because of **the large ecosystem and the presence of the community**.

This time, I will introduce the various things that support Kubernetes.

## Kubernetes and SIGs

Kubernetes has several community types, all of which belong to the [kubernetes/community](https://github.com/kubernetes/community) repository.

- SIG (Super Interest Group)
- UG (User Group)
- WG (Working Group)

As you can see, SIG has many groups :D

If you would like to see the full list, see [here] (https://github.com/kubernetes/community/blob/master/sig-list.md).

On the list, you can see there are lots of chairs(persons who lead each group) and they are from different organizations for *vendor neutrality*.

## Why different organizations

Kubernetes was originally rewritten in Golang based on the idea of a distributed application platform called Borg that was originally developed by Google. Therefore, it started as an OSS led by Google.

Starting with the release of Kubernetes 1.0, the organization “CNCF (Cloud Native Computing Foundation)” launched by Google and the Linux Foundation has been managed by Kubernetes and has restarted as an open community independent of vendors. For more details, see [This TechCrunch article](https://techcrunch.com/2015/07/21/as-kubernetes-hits-1-0-google-donates-technology-to-newly-formed-cloud-native-computing-foundation-with-ibm-intel-twitter-and-others/).

Since then, various efforts have been made to ensure that all users contribute equally and participate in the community.

Kubernetes itself is a product with a clear idea, and it aims to make itself independent of any vendor.

However, in real-world, you would probably want something like these

- AWS integration
- Ease with on-prem bare metal
- L7 load balancers management on Kubernetes

The context of using Kubernetes changes in various usage scenes.
e.g.) Running Kubernetes as a batch platform, Using GPUs, or Running various web applications.

Kubernetes is very scalable for these demands.

- Custom controller
- Custom scheduler
- Custom metrics

These can be combined to suit your needs.

People submit various discussions, suggestions, and efforts every day in these communities to make Kubernetes a better place in the world.
Conversely, if you want to get involved with Kubernetes, the first thing you should get started with is the Kubernetes community.
Advent of Code 2019-01 with R & JavaScript
Tags: rstats, javascript, adventofcode
Published: 2019-12-02 13:19:20

---
title: Advent of Code 2019-01 with R & JavaScript
published: true
date: 2019-12-01 00:00:00 UTC
tags: rstats, javascript, adventofcode
canonical_url: https://colinfay.me/aoc-2019-01/
---

Solving Advent of Code 2019-01 with R and JavaScript.

[Disclaimer] Obviously, this post contains a big spoiler about Adventof Code, as it gives solutions for solving day 1.

[Disclaimer bis] I’m no JavaScript expert so this might not be theperfect solution. TBH, that’s also the case for the R solution.

## About the JavaScript code

The JavaScript code has been written in the same RMarkdown as the Rcode. It runs thanks to the `{bubble}` package:[https://github.com/ColinFay/bubble](https://github.com/ColinFay/bubble)

## Instructions

Find the instructions at: [https://adventofcode.com/2019/day/1](https://adventofcode.com/2019/day/1)

## R solution

### Part one

``` r
# Read
ipt <- read.delim( "input1.txt", header = FALSE )
# Get the sum of each element, divided by 3, rounded down, and substracted 2
sum( floor( ipt$V1 / 3) - 2 )


## [1] 3361299

```

### Part two

> Using a recursive function:[https://en.wikipedia.org/wiki/Recursion\_(computer\_science)](https://en.wikipedia.org/wiki/Recursion_(computer_science))

``` r
floorish <- function(x, start = 0){
  loc <- floor( x / 3) - 2
  if (loc > 0){
    start <- start + loc
    floorish(loc, start)
  } else {
    return(start)
  } 
}
sum( purrr::map_dbl(ipt$V1, floorish) )


## [1] 5039071

```

## JS solution

### Part one & Two

``` javascript
var fs = require('fs');

// Reading the file
var res = fs.readFileSync("input1.txt", 'utf8').split("\n").filter(x => x.length != 0);

// Turning to integer
res = res.map(x => parseInt(x));

// Doing the floor of division less 2
var val = res.map(x => Math.floor(x / 3) - 2);

// Suming
var add = (x, y) => x + y;

// Solution
console.log( val.reduce(add) );

// Creating the recursive function
function floorish(val, start = 0){
  loc = Math.floor(val / 3) - 2;
  if (loc > 0){
    start += loc;
    return floorish(loc, start);
  } else {
    return start;
  } 
}

// Doing the computation
console.log( res.map( x => floorish(x) ).reduce( add ) );


## 3361299
## 5039071

```
Windows development
Tags: development
Published: 2020-01-02 06:52:27

---
title: Windows development
published: true
date: 2019-12-01 00:00:00 UTC
tags: development
canonical_url: http://jamessessford.com/blog/windows-development
---

My general development environment on Windows consists of VSCode, Firefox, PHP, MySQL, Redis & Node.

```
- VSCode for editing files
- PHP to serve the application (php artisan serve)
- Windows Terminal running PHP tasks (php artisan queue:work)
- MySQL and Redis running as background services
- Node running webpack or gulp
- Firefox to view the website
```
Creating a Racing Bar Chart – Using React (Hooks) with D3
Tags: react, d3, svg, javascript
Published: 2019-11-30 22:26:14

{% youtube lx5k8oQHaJQ %}

Hi, this is part 9 of my "Using React (Hooks) with D3" series, and in this one, we create a Racing Bar Chart!

Code can be found on my GitHub:
https://github.com/muratkemaldar/using-react-hooks-with-d3/tree/09-racing-bar-chart

Enjoy!
Multiple front-ends, different frameworks, one application
Tags: frontend, microfrontends, javascript
Published: 2019-11-30 22:05:02

---
title: Multiple front-ends, different frameworks, one application
published: true
description: This is done with my own Microfronts library
tags: front-end, micro-frontends, javascript
---

Here's a quick demo.
AMA for explanations how this works.

https://build-theta-two.now.sh/#/side-by-side
Embarking on creating a personal website
Tags: help, advice, discuss
Published: 2019-11-30 21:29:16

---
title: Embarking on creating a personal website
published: true
description: 
tags: #help, #advice, #discussion 
---
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2ldr6xifisf1iw9d66z7.jpg)

Hi there guys! I'm a front end developer (with knowledge of Angular, Angular.js, jQuery, HTML, CSS, Sass, A11y) planning to create a personal website, I have investigated the posts here and they all seem great, what I'm wondering about is the following.

Which is the correct way to approach this?

1. Create it with pure HTML, CSS and Javascript Vanilla to display my design abilities (jQuery could be usable here too)

2. Use Angular to display a nice SPA, but without the source code (I could show it if I render Angular on the server-side, but honestly, I never tried that before)

3. Like the previous one, but using Bootstrap classes for the alignment and Material for the components.

And for the last part, it should be a static front end website or should I also do a backend for it? For example the contact page, I have some knowledge on Python so I could create an API for this.

Thanks for reading and your help folks! Cheers!
React Awesome Reveal v2 Released
Tags: react, webdev, css, javascript
Published: 2019-11-30 21:57:18

React Awesome Reveal has just received a major update featuring zero external dependencies and a cleaner API 🎉 Check it out at [github.com/dennismorello/react-awesome-reveal](https://github.com/dennismorello/react-awesome-reveal)

[Demo site](https://react-awesome-reveal.morello.dev)
Does your background make your work unique?
Tags: discuss, programming, skills
Published: 2019-11-30 21:50:30

---
title: Does your background make your work unique? 
published: true
description: What's the skill, hobby or weird habit that makes your work unique?
tags: discuss, programming, skills
---

Most of us, here in DEV, have tech-oriented jobs. Whether you are a frontend developer, backend developer, software analyst, project manager, team leader, etc., our job's final goal is to build software. 

However, everyone has a *different background*, and that's what makes each of us **unique** in some way. Even if we have a similar goal, we may **approach our careers differently** because of our unique skills and background, and I think that's awesome.

In my case, I love to *create* stuff. When I was a kid, the easiest way to do that was *drawing*. I was always drawing my favorite characters from movies or tv series. And as an adult, I decided to keep drawing in my free time.

Here's one of my latest drawings:

![https://i.imgur.com/Dx5jVQ4.jpg](https://i.imgur.com/Dx5jVQ4.jpg)

I love drawing whenever I can because it's nice to do something that's unrelated to work and it helps me connect with my childhood in a way. It's also kind of relaxing.

My passion for creating stuff has obviously affected my career: That's primarily why I decided to work independently and on my own projects. And the fact that I was able to draw and design has helped me a great deal with the branding and design for those projects.

For example, I created the logo and most of the icons for the app [Get rid of it](http://getridofit.uppernauts.com/), which I launched along with @maurogarcia_19.

![A screenshot of my app Get rid of it displaying the logo (which is a white open box) and grid with icons representing the things that you can get rid of (E.g: Football, a bunch of cd's, tools).](https://i.imgur.com/EeZZ9FS.png)

I also designed the logo and the octopus in our latest project [Cephhi](cephhi.com).

![A banner design I did to promote cephhi.com. It displays the logo (which is a red octopus tentacle with a green background) and Cephhi the octopus sitting in a desktop working on the tweets you asked him to publish!](https://i.imgur.com/qjBHNLI.png)

It's kind of weird because I specialize in backend development, which is pretty far away from the UI design, colors and logos. But I like weird, so it's ok.

I honestly believe that **embracing our own unique backgrounds** (and even weirdness) can help us become better developers because it helps us understand ourselves and what we really love to do. At least for me, when I love what I'm working on, I do it so much better.

# Does your background make your work unique? 💬
What's the skill, hobby or weird habit that makes (or could make) your work unique?

--- 

I love this subject and I know there's much more to discuss about it. But I have to study for 2 finals 😱, so I'll leave it here for now and probably pick it up in future posts.