teleren/devto huggingface dataset:
Kubernetes Deployment & ReplicaSet
Published: 2020-09-15 12:14:12

## What is a ReplicaSet?

A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. A ReplicaSet ensures that a specified number of pod replicas are running at any given time. We often don't need to create a **ReplicaSet** directly. Instead we use **Deployment** to manage a ReplicaSet. Let's first take a look at how should we create a ReplicaSet.

We will create a ReplicaSet to ensure there is always 3 instances of a nginx container.

Here **.spec.selector** is a label selector and it is used to identify potential Pods to acquire by the ReplicaSet. In our case it will look for the Pods which have the label **tier: frontend**.

```
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx-replicaset
  labels:
    tier: frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: my-nginx
        image: nginx
```
Save this manifest into replicaset.yaml and apply it.

```
$ kubectl apply -f replicaset.yaml
replicaset.apps/nginx-replicaset created

$ kubectl get replicaset
NAME               DESIRED   CURRENT   READY   AGE
nginx-replicaset   2         2         2       19s

$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
nginx-replicaset-7db6b   1/1     Running   0          19s
nginx-replicaset-ncz56   1/1     Running   0          19s
```
We can see that our ReplicaSet has been deployed and there are 2 PODs just as we specified.

## To the Deployments!
Now we have seen what is a ReplicaSet and how to create it, it is time to integrate it into a Deployment.

> A Deployment provides declarative updates for Pods ReplicaSets.

Let's create a Deployment manifest. Instead of creating the manifest from scratch, we can use **kubectl** to create a template file for us. With the **--dry-run** flag, we tell kubectl to not create the resource. This way, we can easily modify the attributes later. 

```
$ kubectl create deployment nginx-deployment --image=nginx --dry-run=client -o yaml > deployment.yaml
```
```
 $ kubectl get deploy
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   1/1     1            1           4m9s

$ kubectl get po
NAME                                READY   STATUS        RESTARTS   AGE
nginx-deployment-5969c7f455-j6685   1/1     Running       0          3m39s
```

After creting the deployment, we can see that only 1 Pod is created. This is because we didn't specify a value for **replicas** option. We can scale our deployment by editing the yaml file or we can use the imperative way. 

```
$ kubectl scale deploy nginx-deployment --replicas=2
deployment.apps/nginx-deployment scaled

$ kubectl get deploy
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   2/2     2            2           12m

$ kubectl get po
NAME                                READY   STATUS        RESTARTS   AGE
nginx-deployment-5969c7f455-9nrs7   1/1     Running       0          71s
nginx-deployment-5969c7f455-j6685   1/1     Running       0          6m20ss
```
Why would you want an API to print a PDF?
Tags: typescript, node, javascript
Published: 2020-09-15 12:14:01

Why would somebody need an API to just print a PDF file? Well... Hear my short story:

At the company where I work, we developed a small "kiosk" React app that is running on a full-screen browser and uses speech recognition to gather some details and then automatically print a receipt. 

The issue is when you issue the command at the browser to print the page, it opens the system's print dialog. As a result, the experience becomes mediocre for the user. The app is running on localhost (and will never run on the web) so this allowed me to create a simple solution: 

Run a small **nodejs backend** on localhost that directly interfaces with the printer and issues the command to print without opening any system dialog. 

Because I some of you might benefit from it, I published it on Github here, to check it out. It's fairly basic but it does its job (and why develop something when it is already working?)

It could also be used for IoT applications, I have some usecases in mind for my small RasPi.

You can check it out here: 

{% github chrispanag/printer-api %}
What's the output?
Tags: javascript, codenewbie, webdev, beginners
Published: 2020-09-15 12:11:05

```
function func(){
    return foo;

    foo = 1;
    function foo(){}
    var foo = 'hello';
}

console.log(typeof func());
```

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
Best  Python Frameworks for Web Development 
Tags: python, webdev, productivity, beginners
Published: 2020-09-15 12:04:12

Python frameworks help to automatically reduce the development time of the developer and automate the redundant project. The best part is that Python allows a wider range of frameworks where every framework has its own benefits as per the varied needs of a project.

Python is a general-purpose, high-level programming language for desktop GUI applications, web sites, and web applications. Besides, it being a high-level programming language enables you to concentrate on the core functionality of the application by dealing with joint programming tasks.

It is a daunting job to select the best match for your project. Here comes the simple, flexible, high-level programming language(Python) at the top of the popularity list to our rescue, that has several python frameworks to support web applications of different sizes.

Python frameworks is a set of web software modules or packages that automatically implement common solutions to concentrate on the application logic rather than on the basic processes.

Types of Python frameworks

Before diving straight into the Python frameworks for web development, Let us first discuss the 3 primary types of python frameworks that exist-

Full-Stack Framework
Micro Framework
Asynchronous Framework
Let’s understand what each of these entails-

Full-Stack Framework

It offers the basic component structure for various web solutions- i.e. frontend, backend, and database. If we want to build a wide system that can be loaded with lots of features, a full-stack framework comes in handy.

Micro Framework

A micro-framework is an extremely light-weight framework with no additional features or functions available. Micro-frameworks works best if you need to add huge quantities of code and additional specifications manually.

Asynchronous Framework

It is a micro-framework that allows us to mainly manage a vast range of concurrent links. It is primarily built for Python and it utilizes the Asyncio library.

Top Python Frameworks
CherryPy
Pyramid
Flask
Sanic
Pylons
TurboGears
Fastapi
Quixote
Django
Muffin
Ray
 
For Any Query Regarding article visit Source - https://codersera.com/blog/python-frameworks-for-web-development
When everything started
Tags: dotnet, startup, mongodb, 100daysofcode
Published: 2020-09-15 02:46:20

Although I have a postsecondary CS degree, my University was all about Marketing, previous to that I produced a TV Show at the age of 18, and if wasn't for a college friend that push me to do an online event registration form (back in 2014) for a symposium, I maybe never really get seriously about coding or huge programming apps (btw, that friend works on FB right now so, it was not any kind of push, it was a butterfly effect push).

More than 10 years ago here I am... learning ENGLISH (like... english, english... maternal language) and as of now I code  easily in c#, JS, TS, not that easy on C and C++, Swift (moderate), love MongoDB (currently using atlas to avoid the DevOps part), using AWS (same reason as Atlas) and already have a multimillion usd yearly revenue... client (no, my company is not multimillion nothing, yet).

I started this first post as an exercise to loose the fear to expose my self (in writing and toughs) and, I have to say, 16th days ago I started the challenge #100DaysOfCode and is beginning to seems like a jenga so in an effort to redirect my focus, I will write, sometimes about code, sometimes about what I have learned throughout the years (according to Malcolm Gladwell I should be an expert by now), and... I forgot to mention, I'm currently trying to make a startup so... keep in touch, this is only the beginning.

The coding part of the post:

Today DotNet 5.0 RC1 was released... and thats a good news, speacially for me a new type of keyword: record

Check this link for more info
https://devblogs.microsoft.com/dotnet/announcing-net-5-0-rc-1/

PS: I Promise future blogs will be more about coding :D
Deploy Your React App For FREE
Tags: html, react, javascript, css
Published: 2020-09-15 12:02:07

Are you looking for website where you deploy your react project for free?

In this article, I am going to share a video which exactly shows you How to deploy your react app for FREE without running npm run build single time.
I know running npm run build everytime whenever you make changes in your app is annoying.
So, This video is for you.
https://youtu.be/NExBQ7LFQN0
Please go check it out.

Please do like share and SUBSCRIBE if you find the video helpful.

Thank You
Daily Developer Jokes - Tuesday, Sep 15, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-09-15 12:00:11

---
title: "Daily Developer Jokes - Tuesday, Sep 15, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Tuesday%2C%20Sep%2015%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258a87ad7e.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___!false___

It's funny 'cause it's true.
 -->
IntelliJ vs Eclipse vs VSCode
Tags: java, codenewbie, webdev, tools
Published: 2020-09-15 11:54:37

When I started out learning Java at Lambda, we could have used VSCode or used our student pack for a free year of IntelliJ IDEA. I gave VSCode all of one day to get it set up for Java usage but Lambdas curriculum showed examples using IntelliJ. My choice was obvious at the time as I really didn't want to be stuck behind. IntelliJ impressed me far more than I thought it would haha!

Fast forward to May of this year with the new job and here I have become comfortable with Eclipse. I have been back and forth using Eclipse and finally setting up VSCode for Java development. I like to change it up occasionally at work and get experience. 

## ANYWAYS
What a long round-a-bout to get to the point of this post! Now that I have experience using all three code editors for Java development, I think I can give my opinion on learning curves and etc like that!

#### keep in mind this is a very small list from my point of view*

## Eclipse
* runs on anything that supports JVM
* very basic hardware demands 
* immense ecosystem of plugins 
* bigger learning curve
* commonly used IDE 
* more frequent software updates
* free

## IntelliJ 
* beginner friendly
* code completion
* smaller learning curve
* preferred IDE by new and experienced Java devs
* two editions depending on your needs
* version control to manage branches, browse changes, and merge conflicts
* indexes the entire project when you start up (speeds up search process )

##  VSCode
* good for working on single file or smaller things
* many extensions to turn it into a full fledged IDE
* not as preferred as IntelliJ
* debugger not as good as IntelliJ
* no extensions installed upon use
* live share functionality
* built on top of an Electron platform where as IntelliJ is running on an older JVM
* ease of multiple windows when coding

Obviously there are many more points to touch on with each code editor but probably would take a bit more than a post to get to every point...

All in all, my personal preference will always be IntelliJ. I encourage devs (especially newer devs) to give each a go to see what suits their needs.
Hackathon Event
Published: 2020-09-15 11:53:09

*Everybody has a creative potential and from the moment you can express this creative potential, you can start changing the world.*

With people stuck in their homes during these vulnerable times, we should not limit our potential and always strive to learn more. 

**IOSD-DTU** presents **HACKFINITY**

Hackfinity is a Hackathon which gives a great opportunity to all the hackers out there to create something innovative in this lockdown and a time to be cherished.

**Mark the dates:** 30th September to 2nd October

Exciting and amazing prizes await all the winning teams. Don't miss out on this platinum chance to create and express yourself through your creativity .  

**Register at:** https://hackfinity.hackerearth.com/
犯了一個 Python 低級錯誤
Tags: python
Published: 2020-09-15 11:12:33

剛剛寫了一個類似這樣的類別：

```python
class PWM():
    def __init__(self, freq):
        self.freq = freq
    def freq(self, freq):
        self.freq = freq
```

然後測試一下就炸掉了：

```python
>>> a = PWM(20)
>>> a.freq("hello")
Traceback (most recent call last):
  File "<pyshell>", line 1, in <module>
TypeError: 'int' object is not callable
```

原來是物件的方法和物件的屬性同名, 所以在建立物件時, self.freq 已經在 __init__ 中被設定為整數了, 等到執行 a.freq() 的時候, Python 發現這個 freq 是 int 物件, 並不能被叫用, 所以通知我 int 物件是不可叫用的喔！！
EuroPython 2020: First batch of edited videos available
Tags: europython, conference, videos, python
Published: 2020-09-15 11:09:59

We’re happy to release the first 30 cut videos of EuroPython 2020. You can watch them on our YouTube channel: http://europython.tv

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6yjbnnkthyvgjr5yc1y4.png)

* [EuroPython 2020 Playlist](https://www.youtube.com/playlist?list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW)

Over the next few days/weeks, we’ll keep releasing more videos in batches. We are working on over 130 videos in total, so please stop by and check the playlist for more videos, or subscribe to our YouTube channel.

Enjoy,
–
EuroPython 2020 Team
https://ep2020.europython.eu/
https://www.europython-society.org/
The Best Way To Architect Your Angular Libraries
Tags: angular, typescript, frontend, architecture
Published: 2020-09-15 11:08:47

---
title: The Best Way To Architect Your Angular Libraries
published: true
description: The ideas presented in this article are based on extensive experience from large enterprise environment (100 Angular SPAs and 30+ libs )…
tags: Angular, Typescript, Frontend, Architecture
cover_image: https://miro.medium.com/max/6000/1*yDEIKEkGUy3fspmEnW9UaQ.jpeg
---


# The context

>The ideas presented in this article are based on extensive experience from large enterprise environment (100 Angular SPAs and 30+ libs )…

To be more precise, the initial impulse to explore this topic was creation of a second “component framework” (think internal Angular Material) following this approach and comparing it to the original one which does NOT use the ng-packagr sub-entries…

## What we’re going to learn

* How to create Angular library implementing clean architecture from scratch (demo project included)
* How to implement sub-entry per feature (and how to simplify the process using ng-samurai schematics)
* How to define proper Typescript “paths” aliases
* How this architecture and setup automatically saves us from using incorrect imports or introducing circular dependencies
* How to analyze our library structure with madge
* How to consumer library in other applications
* How to make stuff private
* How to bring dependencies into consumer applications (dependencies vs peer dependencies)
* How to create demo application for a library in local workspace
* How to make this work with jest

[Read more...](https://medium.com/@tomastrajan/the-best-way-to-architect-your-angular-libraries-87959301d3d3)
Browser Cloud: Scale Cross Browser Testing To Deliver Quality Desktop Web Apps
Tags: browsercloud
Published: 2020-09-15 10:59:25

---
title: Browser Cloud: Scale Cross Browser Testing To Deliver Quality Desktop Web Apps
published: true
description: pCloudy has launched a groundbreaking feature called browser cloud, where you can test desktop web apps on real Windows/Mac machines.
tags: browsercloud

---
<img src="https://dev-to-uploads.s3.amazonaws.com/i/xyrdk2ehcigfwa5shbuz.PNG">

Most of the businesses have websites as the primary source of branding and communication. This is why they are looking for testing platforms that can improve the overall performance of the website and make an impactful first impression to gain a huge customer base. pCloudy has launched a groundbreaking feature called browser cloud, where you can test desktop web apps on real Windows/Mac machines. Testing your website in pCloudy’s browser cloud will ensure a stable and responsive user interface to provide a great digital experience.

<img src="https://www.pcloudy.com/wp-content/uploads/2020/09/1.png">

The factors that mostly obstruct the smooth functioning of a website are the various combinations of browsers, operating systems, and devices available in the market. To perform cross-browser testing on various combinations can be difficult as you might have to set up a device lab. pCloudy’s browser cloud consists of a gamut of OS, browser, and device combinations which will easily facilitate browser compatibility testing. Also, pCloudy being a cloud platform that is ideal for parallel testing increases the speed of testing web applications by multiple folds.

<img src="https://www.pcloudy.com/wp-content/uploads/2020/09/5.png">

Once you login to pCloudy, you just need to select the browsers tab and you will see all the devices with their OS versions and pre-installed browser versions. You can change the resolution of the screen and take screenshots of the issues that you find on the website. Testing websites on local networks is also possible through the Wildnet tool available in the <a href="https://www.pcloudy.com/scale-cross-browser-testing-with-browser-cloud/">browser cloud</a>. These are some of the features which make pCloudy highly recommendable for testing and developing high-performance web applications.

Enterprises are focusing on providing quality multi-experience to their customers. pCloudy is a great platform where you can test mobile apps, desktop web apps, and leverage integrations to deliver a quality experience through multiple channels.
Beta testers wanted!
Tags: cybersecurity, bughunting, pentesting, ethicalhacker
Published: 2020-09-15 10:54:40

[Limited positions] Hey guys, just wanted to share with the crowd that Skuudo has launched a beta testing program for its community solution for ethical hacking.  

[Skuudo](https://skuudo.com/) is a cross-platform application (html5) that leverages agile methodology and automation to assist in various aspects of the security testing process:

. Save your time and effort with the Agile Project Management that includes a rich visual Dashboard, Calendar and Kanban Boards for managing your daily tasks.

. Forget forever about the nuisance of manually writing reports with Automated Reports and Smart Report Templates.

. Never search Google again for cheatsheet-s or howto-s - discover and capture new knowledge with Patterns and Library. 

. Create and experiment with your unique hacking scenarios with Automation Playbooks. Include Automation Playbooks in your Patterns or Kanban Boards to automate every aspect of your projects.

. Challenge yourself, learn and build your hacking skills with Skuudo’s Challenges.

So if you like to contribute with the project , you can join to the Beta Tester Team on [Skuudo's website](https://skuudo.com/).
How get int from base64'd number bytes representation in Go
Tags: go, base64, cryptography, rsa
Published: 2020-09-15 10:51:54

To make sure we won't overflow, we need math/big from Go
```go
inputString := "Ag==" // base64'd byte representation of number 2

// first base64 -> bytes 
decodedBytes, _ := b64.StdEncoding.DecodeString(inputString)

// bytes -> big.Int
bigInt := new(big.Int)
bigInt.SetBytes(decodedBytes)

resultInt64 := bigInt.Int64() // == int64(2)
resultInt := int(resultInt64) // == int(2)
```

https://play.golang.org/p/DVxwwJHrbNu
Litterboxing
Tags: development, programming, security, code
Published: 2020-09-15 11:42:44

---
title: Litterboxing
published: true
date: 2020-09-15 10:49:00 UTC
tags: development,programming,security,code
canonical_url: https://craignicol.wordpress.com/2020/09/15/litterboxing/
cover_image: https://craignicol.files.wordpress.com/2019/06/img-20190524-wa0000.jpg
---

Sandboxing is a great idea. Isolate your processes. Isolate your data. Chinese Walls everywhere to ensure everything is kept separate, independent and secure. Whether that’s containers or SELinux

Litterbox – it’s like a sandbox but when you look closer it’s full of shit

> “There’s the inkling of a good idea in there. He’s almost describing a sandbox (without, of course, any of the isolation required) and front-end microservices (without a pipeline, or components). Can we call this pattern litterboxing? It’s a sandbox until you look closer and see it’s full of catnip.”

[https://thedailywtf.com/articles/comments/classic-wtf-i-am-right-and-the-entire-industry-is-wrong/1#comment-506416](https://thedailywtf.com/articles/comments/classic-wtf-i-am-right-and-the-entire-industry-is-wrong/1#comment-506416)