teleren/devto huggingface dataset:
Hacking Imposter Syndrome: A Cheat Sheet
Tags: beginners, learning, career, webdev
Published: 2020-09-08 02:30:02

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

[Direct Image URL](https://rilu.me/hisc-get) 

-----
[Follow me on Twitter](https://twitter.com/RickLuevanos) - It's the best way to learn about any new content I publish.
How to find SQL Server database Restore and Recovery time ?
Tags: sql, database
Published: 2020-09-08 01:59:40

Easy to way to determine Restore and Recovery time.

Simple query to find out SQL Server Database restore time and percentage of completion.

```

SELECT 
 percent_complete as percentageComplete
 ,estimated_completion_time/60000 as timeToComplete
 ,status 
FROM
 sys.dm_exec_requests 
WHERE
 command like '%restore%'

```

Simple query to find out SQL Server Database recovery time and percentage of completion.

```

SELECT
 percent_complete as percentageComplete
 ,estimated_completion_time/60000 as timeToComplete
 ,status
FROM
 sys.dm_exec_requests 
WHERE
 command like '%recovery%'

```


Source : {% medium https://medium.com/@gchandra/how-to-find-sql-server-database-restore-and-recovery-time-dffde87d4631 %}
Partial Argument Parse and Passing in Bash
Tags: bash
Published: 2023-01-06 01:15:56

---
title: Partial Argument Parse and Passing in Bash
published: true
date: 2020-09-08 01:33:26 UTC
tags: Bash
canonical_url: https://brandonrozek.com/blog/bashpartialargparse/
---

Let’s say we want to augment an existing terminal command (like for example `wget`). We then want to be able to add or edit command line options. The rest of this post provides an example that hopefully you can use in your bash script.

```
#!/bin/bash

# Custom help function
show_help() {
  echo "Usage: custom_command [arguments]"
  echo " --name <name>"
  echo " --flag_example"
  echo " <additional arguments to be passed along>"
  exit 0
}

# Defaults for our custom flags or parameters.
name=""
flag_example=0

# Loop through and take out our custom parameters
# from the parameter list.
i=0
numargs=$#
while test $i -lt "$numargs"
do
  case "$1" in
    "--help")
      show_help
      ;;
    "--name")
      shift
      name=$1
      ;;
    "--flag_example")
      flag_example=1
      ;;
    *)
      set -- "$@" "$1"
      ;;
  esac
  shift
  i=$((i+1))
done

# Do something here using our custom parameters

# Pass our non-custom parameters to the application
wget "$@"

```
DEPLOY YOUR WEB APPLICATIONS IN A MINUTE - MADE WITH 💖 FOR DOCKERISTS
Tags: devops, docker
Published: 2020-09-08 01:29:40

As a software engineer or a DevOps engineer, you may come up with boring tasks frequently, one of which is setting up a new cloud environment for deployment of your awesome web apps/micro services.

Using the following script, you will lose the dull pain. Just grab the script and run it with bash, then you will get the complete environment with docker/docker-compose and nginx which are all on the latest stable version.

Note: This is just for Ubuntu Bionic/Focal. Buzz me anytime in case you want to get the same one for any other distro, I'd love to help!

{% gist https://gist.github.com/CrazyOptimist/4654624f10da68f62b183c82fa717176 %}

Happy containerizing! 🐋

Originally posted on my blog [here](https://crazyoptimist.net/posts/2020/deploy-your-web-apps-in-just-a-minute-made-with-love-for-dockerists).
My GitHub Profile
Tags: career, github, discuss
Published: 2020-09-08 01:25:34

---
title: My GitHub Profile
published: true
description: GitHub Profile using readme
tags: career, github, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/5n9cgxsj55oxcwmntg9g.png
---

Recently I read a few posts and articles about the new feature of GitHub to customize your profile with a Readme file.

Then I took ideas from those posts and updated my profile, so here's the result:

{% github https://github.com/KenyStev/KenyStev %}

Pretty simple I know but it's better than nothing.

---

### Here the plugins I used to have polished like that:
* [github-profile-trophy](https://github.com/ryo-ma/github-profile-trophy)
* [github-readme-stats](https://github.com/anuraghazra/github-readme-stats)
Xvfb
Tags: x11
Published: 2023-01-06 01:16:08

---
title: Xvfb
published: true
date: 2020-09-08 00:49:54 UTC
tags: X11
canonical_url: https://brandonrozek.com/blog/xvfb/
---

X Virtual Framebuffer (Xvfb) is a great quick application to run applications that expect a `X11` server, but you don’t care to see the visual output.

To install:

```
sudo apt install xvfb

```

To run:

```
xvfb-run application

```

For more customization, I hear that it’s better to use [xpra with Xdummy](https://web.archive.org/web/20200926082251/https://xpra.org/trac/wiki/Xdummy). I haven’t tried this myself yet, but if you experience issues with the application expecting `randr` or `glx` extensions, give it a shot.
Splitting Files to Circumvent Size Limits
Published: 2023-01-06 01:16:23

---
title: Splitting Files to Circumvent Size Limits
published: true
date: 2020-09-08 00:41:25 UTC
tags: 
canonical_url: https://brandonrozek.com/blog/splittingfiles/
---

Let’s say you want to transfer file(s) over to someone and there is a limit the size you can transfer over. Maybe because of the physical medium or the online service you’re using. You can make use of the terminal tool `split` in order to get the chunks over there and then use `cat ` to combine it back to one file.

## Create a Single File

Skip to the next section if you only want to transfer a single file.

Otherwise, let’s say you have a folder of files named `Documents`. First, let’s create a gzipped compressed archive that contains everything.

```
tar -czf documents.tar.gz Documents

```

## Splitting the File

Next let’s split the file into 1 GB parts.

```
split -b 1GB -d documents.tar.gz PART

```

Then transfer the files labeled PARTX where X is the part number over….

## Re-combining

Once the files are transfered, we use `cat` to bring the files back together.

```
cat PART* > documents.tar.gz

```
Day 99 : #100DaysofCode - Participated in CS50 Week 1 - C
Published: 2020-09-08 00:32:40

Today, I participated in the CS50 2020 Week 1 lesson on C. Although C is more difficult because you have to remember little things, like a semi colon after pretty much everything or that you have to compile then run your code in order for it to work. It is always fun to learn new programming languages as they are all similar in some way. Feel free to watch the video below. 

{% youtube iRkKEHybf9M %}

I will be participating in the program every Monday and if you are interested in joining you can by using the following using this <a href="https://cs50.harvard.edu/x/2020/zoom/"> link </a>. I hope others will join because it is very helpful and informative. I plan to keep track my progress on my Github repo. 

{% github SincerelyBrittany/cs50-2020 %}

As always, thanks for reading!

Sincerely, 
Brittany
Day 98 : #100DaysofCode - Worked on completing the FreeCodeCamp Responsive Web Design Certificate
Published: 2020-09-08 00:24:59

Today I focused on completing the Responsive Web Design Certificate. I only have to complete the Landing Documentation and Portfolio. My portfolio is almost completed and I am excited to share with the world. I found a great tutorial on how to complete the portfolio project on Youtube. You should watch if you are trying to complete the project. 

{% youtube CjMQ32Y20RI %}

I can't wait to complete and share my projects with you all. 

As always, thanks for reading!

Sincerely, 
Brittany
Starting Graphical Applications Remotely without X-Forwarding
Tags: linux, ssh
Published: 2023-01-06 01:16:42

---
title: Starting Graphical Applications Remotely without X-Forwarding
published: true
date: 2020-09-08 00:24:49 UTC
tags: Linux,SSH
canonical_url: https://brandonrozek.com/blog/startgraphicalappsnoforwarding/
---

One of my favorite casual gaming setups is to use a slim laptop on my couch while streaming from my desktop using Steam Remote Play. The downside though is that unless I want to get up, Steam needs to be already running on my desktop. This post describes how I start steam remotely from my couch so that I can stream my games without having to get up and set it up on my desktop first.

This requires you to be already logged into a graphical session on the computer you want to stream from.

On Linux, there is a DISPLAY environmental variable which tells X11 where to show the application. By default (at least on Ubuntu), the display starts as `:0` and moves up in count. We can make use of this fact, to start steam on a X11 server instance that is already running so that we don’t have to do any X11 forwarding.

On the client computer,

```
ssh desktop "DISPLAY=:0 nohup steam"

```

The `nohup` allows the application to not terminate when you press `CTRL-C` from your client computer.

Update: In light of [discovering `systemd-run`](/blog/launchappsthroughterminal/), I recommand you do the following instead:

```
ssh desktop "DISPLAY=:0 systemd-run --user steam"

```
GitHub Codespaces - custom container
Tags: github
Published: 2020-09-08 00:21:42

Today's scenario was to build a learning GitHub Codespace which included some dependent files and also some associated VSCode Extensions.  This is for my [`learn-WDL` (workflow definition language for bioinformatics)](https://github.com/openwdl/learn-wdl) lesson repo.

One challenge was that the required [(cromwell) JAR file](https://cromwell.readthedocs.io/en/stable/) was ~200 MB, well over the max file size for Github.  So I couldn't just upload the JAR file to my GitHub repo.  Also I didn't want to use Github Large File Storage (or LFS) because this JAR file would be used in every command run in the Repo.  So I decided to use a custom Docker container image to build this custom Codespace.

----

To start, I located a pre-built container image [(broadinstitute\cromwell)](https://hub.docker.com/r/broadinstitute/cromwell) which contained the needed dependencies (JDK and a JAR file) on DockerHub.  

I tested the custom container locally and then updated the example Java DOCKERFILE in the `.devcontainer` folder in my Codespace to use this docker image (shown below).  Take note of the location of the $HOME variable as well.  I got the example Java Codespace DOCKERFILE from the [Microsoft example Repo](https://github.com/microsoft/vscode-dev-containers/tree/master/containers).

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

Second, I searched for VSCode extensions for this scenario (WDL Language) and found two [WDL extensions](https://marketplace.visualstudio.com/items?itemName=broadinstitute.wdl) available.  I updated the `devcontainer.json` file to include these two extensions in the custom Codespace (shown below).

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

Third, I had to look around the container a bit to find the included required JAR file (`cromwell.jar`) - I finally found the file at the top of the container (`cd /app`).  

I updated the `.bashrc` file to alias the JAR file and tested a `hello.wdl` file (shown below).  I was able to run the test successfully!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3nxquk0fq8ez9qddwv14.png)
Portfolio Review
Tags: angular, portfolio
Published: 2020-09-08 00:20:09

Hello all. I've been creating a new portfolio once a year for the last three years. I'm looking for helpful feedback and thoughts regarding my latest portfolio. It's a work in progress, I've been actively working on it in my spare time over the last couple of weeks. I'm looking forward to hearing your thoughts. [Link is here](https://jasonfritsche.github.io/jasonfritsche.github.io/).
Divide by Zero Equals Infinity?
Tags: javascript, webdev
Published: 2020-09-08 00:08:21

# Introduction
Wrapping up the freeCodeCamp metric-imperial converter project, I discovered a strange bug. A possible user input is a fractional number w/unit such as `3/4mi`. However, there is a possibility a user could input `3/0mi`. Decided to test this out in the console and got the following:

```javascript
3/0
// Infinity
```

I was expecting an error but got the value `Infinity`. Let's explore this to see if we can find out why.

# Explore

First, I went to MDN to see if that was the expected result:
```javascript
2.0 / 0     // Infinity

2.0 / 0.0   // Infinity, because 0.0 === 0

2.0 / -0.0  // -Infinity
```
It looks to be the expected answer, but I noticed something. Dividing by a negative zero results in a negative Infinity. Not sure what that means, I decided to check the ECMAScript.

>*NOTE: ECMAScript is the official specification of JavaScript.*

According to the [ECMAScript](https://tc39.es/ecma262/#sec-numeric-types-number-divide):

>The result is determined by the specification of IEEE 754-2019 arithmetic  
>...  
>Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above

Unfortunately, I do not have access to IEEE documents. So my journey ends here. However, here are some [lecture notes, see pg 10](https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF) I found about the subject. 

# Solution
At first I tried a `try/catch` solution:
```javascript
var [numerator, denominator] = num.split('/');
try {
    // The plus converts a string to a number
    result = +(numerator) / +(denominator);
} catch(e) {
	throw new RangeError('Cannot divide by zero');
}
// Infinity
```
As expected we get `Infinity`. Searching MDN I found a useful method [isFinite]:(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)

>The global isFinite() function determines whether the passed value is a finite number. If  needed, the parameter is first converted to a number.

I used that to come up with my final solution:
```javascript
if (isFinite(result)) {
  return result;	
}
return 'Cannot divide by zero';
```
Of course, a user could input `Infinity/Infinity` but we'll save that for another time.

# Final Thoughts
It was interesting that an error would not result from dividing by zero. According to the IEEE specification, which the ECMAScript implements, it follows the rules. Something to look out for on your coding journey. The results you expect might not be so clear. 

# Resources
[MDN - Division(/)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Division)
[ECMAScript 6.1.6.1.5](https://tc39.es/ecma262/#sec-numeric-types-number-divide)
[MDN - isFinite](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)

*Image is Lina from Dota 2*
How to get list of IP Addresses in Python
Tags: python, networking
Published: 2023-01-06 01:16:54

---
title: How to get list of IP Addresses in Python
published: true
date: 2020-09-08 00:03:24 UTC
tags: Python,Networking
canonical_url: https://brandonrozek.com/blog/ipaddressesinpython/
---

[Elemag](https://stackoverflow.com/users/2436840/elemag) on gave a quick solution on StackOverflow on [how to determine IP addresses with multiple NICS](https://stackoverflow.com/questions/270745/how-do-i-determine-all-of-my-ip-addresses-when-i-have-multiple-nics).

His one-line solution:

```
import netifaces
ip_addresses = [netifaces.ifaddresses(iface)[netifaces.AF_INET][0]['addr'] for iface in netifaces.interfaces() if netifaces.AF_INET in netifaces.ifaddresses(iface)]

```

Expanded out to see what is happening

```
import netifaces
interface_list = netifaces.interfaces()
# Get addresses, netmask, etc. information 
address_entries = (netifaces.ifaddresses(iface) for iface in interface_list)
# Only pay attention to ipv4 address types
ipv4_address_entries = (address[netifaces.AF_INET] for address in address_entries if netifaces.AF_INET in address)
# Since multiple addresses can be associated, only look at the first ip address
ipv4_addresses = [address[0]['addr'] for address in ipv4_address_entries]

```

We can easily adjust this to ask for IPv6 addresses by using `netifaces.AF_INET6` instead.

```
import netifaces
interface_list = netifaces.interfaces()
# Get addresses, netmask, etc. information 
address_entries = (netifaces.ifaddresses(iface) for iface in interface_list)
# Only pay attention to ipv6 address types
ipv6_address_entries = (address[netifaces.AF_INET6] for address in address_entries if netifaces.AF_INET6 in address)
# Since multiple addresses can be associated, only look at the first ip address
ipv6_addresses = [address[0]['addr'] for address in ipv6_address_entries]

```
How to create an image element using JavaScript?
Tags: javascript
Published: 2020-09-08 00:00:00

---
  title: How to create an image element using JavaScript?
  published: true
  tags: JavaScript
  date: Tue Sep 08 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/create-image-element-using-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-872dfe5e4d65f7f84a6b0c8a681bb81b.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/create-image-element-using-javascript)
  
## Using the `Image()` constructor function

To create an image element using JavaScript, you can use the `Image()` constructor function available in the global `window` object.

```javascript
// create an image element
const image = new Image();
```

The constructor function accepts 2 parameters:

- The first parameter is the width of the image
- The second parameter is the height of the image

```javascript
// create an image element
const image = new Image(200, 200);
```

Now we need to specify a source for the image element, you can do that using the `src` property in the `image` object.

```javascript
// create an image element
const image = new Image(200, 200);

// source for the image element
// source means the link to the image
image.src = "https://via.placeholder.com/200";
```

You can add attributes to the image element using the dot `.` followed by the name of the attribute.

For example, to add `alt` attribute, you can use the `alt` property in the `image` object like this,

```javascript
// create an image element
const image = new Image(200, 200);

// source for the image element
// source means the link to the image
image.src = "https://via.placeholder.com/200";

// adding alt attribute
image.alt = "A simple placeholder image";
```

## Using the `document.createElement()` function

You can alternatively create image elements using the `document.createElement()` method like this,

```javascript
// create image element
const image = document.createElement("img");
```

- The method needs a valid tag name as a string.

To add `src` and `alt` tag you need to use the dot `.` operator followed by attribute name like this,

```javascript
// create image element
const image = document.createElement("img");

// add attributes src and alt
image.src = "https://via.placeholder.com/200";
image.alt = "A simple placeholder image";
```

See live example on both ways in [JSBin](https://jsbin.com/pagupicoqo/2/edit?html,js,output)

### Feel free to share if you found this useful 😃.

---
Announcing Keynote Speaker for PyCon India 2020 - Alolita Sharma
Tags: pyconindia, python, conference
Published: 2020-09-08 14:35:35

---
title: Announcing Keynote Speaker for PyCon India 2020 - Alolita Sharma
published: true
date: 08/09/2020 
tags: ["pyconindia", "python", "conference"]
canonical_url: 
---

We are happy to announce **Alolita Sharma** as a Keynote Speaker for PyCon India 2020!

Alolita Sharma is a Principal Technologist at Amazon Web Services. She leads open-source strategy and engineering for projects focused on observability and search including OpenTelemetry, Prometheus, Grafana, Apache Lucene, and Open Distro for Elasticsearch. Two decades of doing open source continue to inspire her. Alolita has built and led engineering teams at Wikipedia, Twitter, PayPal, and IBM. Alolita is passionate about language technologies that enable everyone to participate in the Web's information revolution. She serves on the board of [Unicode Consortium](https://www.unicode.org/consortium/consort.html) and is an invited expert on W3C and ECMA workgroups. She has served on the boards of the [Open Source Initiative (OSI)](https://opensource.org/) and [SFLC.in](https://sflc.in/).

You can find her on Twitter [@alolita](https://twitter.com/alolita).

![Alolita Sharma](https://in.pycon.org/2020/assets/images/alolitasharma.jpg)
The best websites to learn Python in 2020
Tags: coding55, python, developer, programming
Published: 2020-09-07 23:34:38

We all know that Python is one of the best programming languages out there and that it is considered to be a very good language for beginners and senior developers.
We are going to talk about the best websites to take a look if you are considering learning Python in 2020.


1. Hyperskill (JetBrains Academy)
JetBrains is creating an e-learning platform for students to learn how to code. It is called hyperskill.org and it has a very solid map of topics that any Python developer need to learn.
It is of course, one of the best solutions to learn how to code using Python because, all the content is up to date with the newer versions of Python. We all know that it is really horrible to go look for some Python content and see people talking about Python
2, that is finally “dead”. (No more prints without parentheses)
I, myself, loved to do some projects in the platform. JetBrains has a very nice content and the way that they teach Python is very interesting because you get to learn by projects and then you can share your progress at GitHub, or other platforms.


2. Codecademy
I love to code at codecademy.com, they have a beautiful website, with good courses, and they teach with good code style. The Python 3 course is paid, but it is worth it, because you get to learn a lot of concepts (from the basic ones to the more advanced).
By the end of the course, you can even get a certification for the course completion.


3. The good old Python documentation
When talking about any technology, we need to go to the source, and in this case, we are talking about the official Python website.
Go to python.org to read more about Python, download your installers, and do not forget to check the documentation.
Just reading docs.python.org, you can become a Python guru.


4. The Python Package Index (PyPI)
You can of course learn by seeing what others have done. And to find any Python package available you can go to pypi.org.
I am used to checking if there is any code available for my own projects and check to see how good modules or packages are being written.


5. Stepik
If you like very interesting puzzles with good solutions, then you need to check stepik.org.
I go there sometimes and I find very interesting problems to solve, in this way, I can tell you guys that this is one of the best websites for Python in 2020.


Happy coding!