teleren/devto huggingface dataset:
Python For Data Science
Tags: python, datascience, machinelearning
Published: 2021-08-23 01:27:39

Introduction to Python:
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990

Why Python ?
Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.

Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.

Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.

Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.

Where we can use Python?
Data Science, Artificial Intelligence, Machine Learning
Image Processing
Robot-Operating-Systems (ROS)
Web frameworks

1.1 Python variables:
Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable.

Standard Data Types:
The data stored in memory can be of many types. For example, a person's age is stored as a numeric value and his or her address is stored as alphanumeric characters. Python has various standard data types that are used to define the operations possible on them and the storage method for each of them.

Python has five standard data types:
Numbers
String
List
Tuple
Dictionary

Python Identifiers:
A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).

Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus, Manpower and manpower are two different identifiers in Python.
The Little Known CSS Unit
Tags: css, html
Published: 2021-08-23 01:00:20

---
title: The Little Known CSS Unit
published: true
description: the css ch unit and how to use it
tags: css, html
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpqh58w4n6d0uqf6kwx9.jpg
---

As a Frontend Developer, it is sometimes humbling to know just how much you don't know about the basic building blocks of the web.

The amount of tools and techniques available to us is A LOT! So it's no surprise we often just pick whatever solves our immediate problem and call it a day

Let's take a look at one of those rarely used tools, the CH CSS unit.

## CH Unit Definition
According to the [spec](https://drafts.csswg.org/css-values-3/#ch)
> A CH unit is the advance measure of the “0” (ZERO, U+0030) glyph found in the font used to render it. (The advance measure of a glyph is its advance width or height, whichever is in the inline axis of the element.)

Translation: One CH is equal to the space one zero character occupies for a given font. So if we write 00, that's 2ch.

*All Characters Are Not Equal*

Notice how the definition specifically mentions "0" (zero)? That's important because not all characters in a font are equal (except for [monospaced fonts](https://en.wikipedia.org/wiki/Monospaced_font) e.g. Courier)

Now that we know what the ch unit is, let's consider where it might be appropriate to use it

## Usage
I asked this question on Twitter before writing this blog post

{% twitter 1429512658336763907 %}

It's no surprise people suggested using some sort of line break approach, even the source of the image, [the nextjs site](https://nextjs.org/), uses `<br>` tags to create the markup

This approach works for static content but cannot be used for dynamic content, at least not without JavaScript

I've created a simple example to show how we can use `max-width` to achieve this by setting the value to the maximum number of characters we want to appear on one line.

{% codepen https://codepen.io/tonerolima/pen/XWgrOed %}

**Pros**
* Suitable for dynamic content
* Better than using `px` or other units for paragraph width
* The appearance doesn't change when the font size changes

**Cons**
* It can be a pain counting the number of characters
* Size can be off for Proportional fonts (non-monospaced), which is the vast majority of fonts

Another scenario where the `ch` unit might make sense to define width is a fixed-width text input (e.g. year input - 4ch)

## Conclusion
The `ch` unit is certainly not what you want to use in most cases, but it really shines where it makes the most sense, character measurement
Hola mundo
Tags: javascript, linux, spanish
Published: 2021-08-23 00:55:33

Buenas !

Soy Osama (aka blueC4P) y soy desarrollador web junior y un curioso de la seguridad informática.

Las publicaciones que iré subiendo serán a modo de portafolio/tutorial de lo que vaya aprendiendo por mi cuenta o en cursos.

Saludos a todos :D !
How to Connect to Github Repository from Cpanel Terminal (without password authentication)
Tags: git, github, ssh, cpanel
Published: 2021-08-23 00:54:58


Normally, you could simply log on to your website’s cpanel, open the terminal, cd to your project folder, type `git pull`, enter your github username and password on prompt and have the latest changes to your project pulled. Similar process if you’re cloning a repository to your hosting account for the first time. However, since 13th August 2021, github has stopped allowing username/password authentication via ssh. You’re likely to see a message similar to the one below:

![a1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m2ix06jlmcsae9hoydn0.png)
 

Well, this article intends to simply show how to do that.

- On your cpanel dashboard, find “SSH Access” on the “Security Pane”, click on it
- Click on the “Manage SSH Keys” Button

![a2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7wxa5utnuzuldbf5yuf.png)
 

- Next, it should take you to a page where you’d see a list of ssh keys for your hosting account. One table lists the public key(s) and the second one lists the “Private Keys”. 

![a3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nu005jbsoalqqttkn4ov.png)
 


If there are existing keys on your account, you should see them listed as above. If not, click on the “Generate a new key” button at the top of the page. The id_rsa named key is one you’d probably find existing already. 

- On the Public Keys Table, click “Manage” for any of the listed public keys, the “id_rsa” for example

![a4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8cnou1ucc8dy80s9api5.png)
 


If the next page is similar to the one above, there’s nothing else to do here, simply click on “Go back”. If the page however shows that the key is not authorized, click on “Authorize” to authorize the public key.


Next, you have to add this key to your github account. The steps are highlighted below:

- On the SSH Keys page, click “View/Download” for the desired and authorised public key


![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwop8fplmkku2c6rdbv9.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q91iw5e478bivd3tlje3.png)
 
  

Copy the content of the box
- Go to github
- Click on your profile picture at the top right corner of the page, on the nave bar and click on “Settings”

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0kykvqcd6dfrjnuix8b.png)
 

- Go to “SSH and GPG Keys” on the left pane
- Click on “New ssh key”
- Enter a descriptive title in the “Title” field
- Paste content of the public key you copied earlier in to the “Key” text box
- Click on “Add SSH Keys”
- Next, open your cpanel terminal
 
To test it worked, type `ssh -T git@github.com`
If you got a message similar to `Hi <github username>! You’ve successfully authenticated..`, congratulations
Now, you can cd into the desired folder, type `git pull git@github.com:your_username/your_repo.git`

This summarises the steps needed. I do hope it helps
Sorting Algorithms: Bubble Sort
Published: 2021-08-23 00:21:51

Bubble sort. A fairly familiar sorting algorithm I hope. A couple important things you should know abut bubble sort is that it is not fairly popular, not commonly used, and is not that efficient. It is still nice to know just for knowledge sake. 

<em>Let's get into it.</em>

What is the goal of this algorithm?
Let's say that we have an array that we want to sort from smallest to largest, so ascending order. We can use bubble sort. The idea is simple, we iterate through the array and for each instance in that array, we will compare it to the instance directly next to it. Let's pretend the first instance is x and the second instance is y. If x = 1 and y = 3, we compared it and we know that the first instance is not greater than the second instance so we move on to the next set of pairs, the second instance we just talked about (y = 3) and the 3rd instance in the array, let's call it z. So now we have y = 3 and z = 2. Since y is greater than z and y comes before z, let's switch out the two so that 2 comes before the 3 which is what we want for an ascending sorted array. 
That's the basic idea of bubble sort. That sequence is repeated through out the whole array until everything is right and an iteration with no switches is reached. 
Here is a visual representation of that.
!['bubble sort in a gif'](https://upload.wikimedia.org/wikipedia/commons/0/06/Bubble-sort.gif)
Now let's talk time complexity!
To get right to the answer, worst case scenario, bubble sorts time complexity is O(n^2). When actually implementing this algorithm, you began to realize that a nested for-loop is actually required to pull it off.
File Transfer Commands in Linux
Tags: linux
Published: 2021-08-23 00:08:01

Here is an overview of commands you can use when handling file transfers in Linux 

Due to the fact that is a beginners article, it will just be the most basic information.

I do plan to release future articles adding more details about these commands and how to actually use them.

Since I already made this article into a tweet, you can also check that out here.


{% twitter 1427867248564211716 %}



### ftp

'ftp' stands for 'file transfer protocol'.  You can use this, but this is an insecure way of transferring files to and from a host because when you enter your username and password it will travel over the network in plain text


### sftp


'sftp' stands for 'secure file transfer protocol'. This is the secure way of transferring. Using stfp will provide a higher level of transfer protection



### scp

'scp'  copies files to and from a host in a secure way. 

This command is considered outdated by some people and companies. It works, but use at your own discretion!


### rsync

'rsync' is used to synchronize files and directories between two machines over a remote shell.


annddd

### ssh

'ssh' is used to securely log onto a remote host. You can 'ssh' into a remote system using SSH keys or password authentication.

This one technically is not a file transfer command but I believe it is important when it comes to it.

### Wooo!!!

annddd that is all! I do plan to post more longer tutorials and informational articles in the future!

If you enjoyed this article, feel free to give me a follow! :)
Privacy and Free Speech (Edward Snowden)
Published: 2021-09-03 13:25:12

---
title: Privacy and Free Speech (Edward Snowden)
published: true
date: 2021-08-23 00:05:00 UTC
tags: 
canonical_url: https://robbinespu.gitlab.io/posts/edward-snowden-privacy-and-free-speech/
---

Arguing that you don’t care about the right to privacy because you have nothing to hide is no different than saying you don’t care about free speech because you have nothing to say

<footer>
<cite title="— Edward Snowden">— Edward Snowden</cite>
</footer>
Quick look at useState()
Published: 2021-08-23 00:00:43



Another powerful function that is becoming very popular with functional components is the useState hook. The useState hook allows you to share state with functional components. With this hook, you can quickly add state to a function component without having to convert it to a class component. 

The way you would normally declare state in a class component would look like this:

```
class Example extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            count: 0;
        };
    };
};
```

A constructor class is required to create the initial state in a class component. This leads a lot of boiler plate code and what could be written in just a couple lines is now almost 10 lines. To do the same thing with a functional component and the useState hook, you must first import the hook into you file and then declare the state as a new variable:

```
import React, { useState } from ‘react’;

const example = () => {
    const [count, setCount] = useState(0);
};
```

In this example we declared the new variable as count and set it to 0. We then created a setter variable called setCount so we can reference the state and manipulate it later. Normally in a class component, state is changed like this:
```
this.setState({ count: this.state.count + 2 });
```
But since we created a setter variable, you change the state like this:
```
setCount(count+2)
```

Since useState is used inside of a functional component, you also access the saved state slightly differently. Within a class component, you would call it with ‘this.state.count’ but within the functional component, you only have to reference ‘count’.

Just like with class components, you can set many different state variables using useState, you just have to follow the same pattern as the first state variable declared. 

```
const [car, setCar] = useState('chevy');
const [snack, setSnack] = useState('cookies');
const [todo, setTodo] = useState({text: 'Take out trash'})
```

You can set the value of the state to any normal variable type in react. Strings, booleans, numbers, even objects. So as you can see the useState hook allows you to quickly switch to functional components and avoid using Redux. This can cut down the amount of code you have to write as well.
The craziest interview ever
Tags: technicalinterview, jobsearch
Published: 2021-08-25 07:46:24

---
title: The craziest interview ever
published: true
date: 2021-08-23 00:00:00 UTC
tags: technicalinterview,jobsearch
canonical_url: https://jhall.io/archive/2021/08/23/the-craziest-interview-ever/
---

Today some more light-hearted content. This is a list of actual questions I was asked by an actual technical CEO during an an actual interview for a SRE role several months ago. Needless to say, I was so put off by this interview that I withdrew from consideration.

- Do you use an iPhone, or Android?
- When you take a photo with your mobile, and upload the image, what format is the image in?
- Why not PNG or TIFF or BMP?
- That image contains metadata, such as the camera model, and date. How is that stored?
- How does your phone know your location?
- How does a cell phone tower know its location?
- Imagine you were to dig a hole from your house, straight through the earth, where would you come out?
- Now imagine a fiber optic cable that ran from your house to this point. How long would it take to ping that point?
- You know the speed of light, right?
- What is the circumference of the earth?
- If you were to write a ping program in Go, how would you do it?
- Only programs with root access can send ICMP packets. How would you allow your Go program to do this?
- Do you use Emacs or vim?
- What is the difference between XML, XHTML, and HTML5?
- You know what a GIF is, right?
- An alternative for GIF if you want animation, is Flash. Why isn’t Flash still popular?
- How do you change the color of some text on a web page to yellow?
- What is the RGB color code for yellow?
- How do you add colored elements to a shell command prompt?
- What is the difference between Unicode and UTF-8?

What are your worst interview stories? I’d love to hear!

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Renovando git: bye bye, checkout

Tags: git, spanish
Published: 2021-08-03 23:09:58

# Renovando git: bye bye, checkout

Hay una serie de comandos de git que nos sabemos de memoria, pero existe uno en particular que tiene múltiples usos: `git checkout`.

Ah pero que tenga múltiples uso significa que es más practico. Si, y más probable que te equivoques

`git checkout` es un comando que podemos usar para crear y borrar branches, navegar entre ellas y eliminar cambios que no están en estado de stage.

Ahora, la gente de git se despabiló y se dio cuenta de que sería mejor tener comandos más verbosos para las distintas acciones que hacemos con nuestro controlador de versiones.

Cada uno de los siguientes comandos que te voy a mostrar realizan la misma acción que hacíamos antes con `git checkout` pero escrito de una forma más amigable

## Creando ramas: git branch

Cuando queremos crear una rama, es normal que nos encontremos usando el comando `git checkout mi-rama`. Para hacerlo más entendible, lo vamos a cambiar por `git branch mi-rama`

## Navegando entre ramas: git switch

Es normal cambiar a una rama de un colega para revisar sus cambios o querer volver a `develop` para tener los últimos cambios. Yo siempre usé para esto `git checkout rama-de-mi-colega`. hasta que descubrí que existe un comando que es mucho más claro: `git switch rama-de-mi-colega`

## Borrando cambios: git restore

Cuando ya separé cuales son los cambios que van en el commit, lo demás se descarta, y para descartar recurrimos al `git checkout -- .`. Hoy en día git te recomienda utilizar `git restore .`

## Conclusión

Utilizar el mismo comando para todo puede ser super practico, pero si recién estas empezando, puede que te provoque un par de USB (USB? ABC? ACV!). Nuestros comandos y nuestros procesos deben dejar claras nuestras intenciones, de esta manera podemos compartir un paso a paso y ser lo más claros posibles en nuestra comunicación técnica.

Fuentes:

[git branch](https://git-scm.com/docs/git-branch)
[git switch](https://git-scm.com/docs/git-switch)
[git retore](https://git-scm.com/docs/git-restore)
How to create a constant or non-reassignable variable in JavaScript?
Tags: javascript
Published: 2021-08-23 00:00:00

---
  title: How to create a constant or non-reassignable variable in JavaScript?
  published: true
  tags: JavaScript
  date: Mon Aug 23 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/create-constant-variable-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-d52b7f686739e773f878a79c21cba143.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/create-constant-variable-javascript)
  
To create a constant or non-reassignable variable in JavaScript, we can use the `const` keyword followed by the name we need to call the variable then the `assignment` operator (or equal sign), and finally the value to store in that variable.

### TL;DR

```js
// Create a constant variable
const name = "John Doe";

console.log("Here the value is: ", name); // Here the value is: John Doe

// reassigning the name variable value
// to the value of `Lily Roy` results in an Error
name = "Lily Roy"; // 🔴 TypeError: Assignment to constant variable.
```

For example, let's say we have a value called `John Doe` and we want to create a constant variable called `name` to store this.

To do that we can use the `const` keyword followed by the name we need to call the variable, then the `assignment operator` (or equal sign), and finally the value to be assigned to that variable in our case it is `John Doe`.

It can be done like this,

```js
// Create a constant variable
const name = "John Doe";
```

Now if we try to change the value of the variable `name` from `John Doe` to `Lily Roy` it will result in a `TypeError: Assignment to constant variable.`

```js
// Create a constant variable
const name = "John Doe";

console.log("Here the value is: ", name); // Here the value is: John Doe

// reassigning the name variable value
// to the value of `Lily Roy` results in an Error
name = "Lily Roy"; // 🔴 TypeError: Assignment to constant variable.
```

See the above code live in [JSBin](https://jsbin.com/fodajikafi/2/edit?js,console).

That's all 😃!

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

---
Flatiron Rails Project
Published: 2021-08-22 23:31:01

Finally, Rails has been a section I've really been looking forward to since the start of the program and I can't believe I'm finally here. Sinatra was a great intro to CRUD but now I feel like I'm prepping to compete with the real deal web developers out there.

First day of learning Rails was filled with a lot of familiar concepts that were presented with Sinatra but simplified. Lots of things in Rails were generated with all of their required directories such as Controllers generating with views and even the database files became very simple to work with. Instant fan.

After learning how to generate a Rails project and my files I started working on my models and giving them the appropriate associations I would need for my project. The project I chose to work on was a simple data management project that I could relate to a past job. In this past job there was a lot of miscommunication or sometimes a lack of communication in general so I figured that a job board listing jobs and their details would be a great way for employees to get an idea of what their given task would entail.

For this app I would need a model for users, jobs, and tools. Users would need the ability to make a profile, post a job, and list tools needed for that particular job. To even start doing that I would have to make the User table within the database take in an email and a password. After that I would need to go to the model and require each user to has those specific attributes via validations before they could make a profile. Once everything was set for the user model I was able to move on to the job model and require each job to have a title and the option of a description. The way to do this would be to go into the job model and list the description as "optional: true" or simply put no limitation on adding a description. Lastly I had the tool model that simply needed a title since only the names were going to be listed under job as an index.

Next came the process of working on my controllers where all of my apps logic will be stored. It didn't take too long to adjust to writing the controllers simply because previous lessons had prepared me for any sort of ruby conundrum that I may encounter. It was all just a matter of learning rails conventions.

The last and least stressful part of the project had to be the views. The views were a majority html with embedded ruby. Very simple with lots of room to play around with different designs and make things a bit more organized with the frontend.
I made a package manager!
Tags: showdev, ruby
Published: 2021-08-22 23:16:09

# I made a Package manager!
___
I made a package manager. It can download a package. It depends on simple ini files in a repository instead of package.json or anything else. Its entire production zip is less than **5kb**s of space including docs and other things. It is written in ruby and depends on curl  and Inifile to download and read the package files , respectively. feedback and pull requests (for packages) welcome!
REPO:{% github Pandademic/Latte %}
Please leave your feedback!
KODECAMP
Published: 2021-08-22 23:04:40

![KODECAMP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iiirnohvpraqa7uyxndz.jpg)
Learning they say, never ends...

Just started an internship with #KODECAMP which I enrolled for android development and I'm really excited to take this step.

For this internship, I plan to improve in my mobile development skills, growing my connections and building my career. I will try to engage in all activities in this internship in order not to miss out in any way.

Thanks!