teleren/devto huggingface dataset:
Backup Your Dotfiles With Version Control
Tags: dotfiles, bash, github
Published: 2020-12-18 22:01:46

I came across a `dotfiles` repository on GitHub the other day and it instantly made me realize I've been backing up mine wrong! Let’s set up our own GitHub repo and start doing it the right way, today.

> Dotfiles are text-based configuration files for Unix tools. By backing them up to GitHub we make sure all our favorite configurations, hacks, and tweaks don’t get lost in case of a system crash. 

## Let’s go!
Create a folder called dotfiles and copy the files we want to back up.
#### Create the folder
```shell
mkdir dotfiles
```

#### Copy the files you want to backup
```shell
cp ~/.<filename> ~/dotfiles/.<filename>
```
For example, I’ve added my `.zshrc` and `.vimrc` files
```shell
cp ~/.zshrc ~/dotfiles/.zshrc
cp ~/.vimrc ~/dotfiles/.vimrc
```

## First commit 
Create a new repository called `dotfiles` on GitHub or use the [GitHub CLI tool](https://cli.github.com).

#### Initialize and add the files
```shell
cd dotfiles
git init
git add .
```
#### Commit and push
```shell
git commit -m “first commit”
git push origin master
```


## Automate it!
Let’s create a simple bash script and add it to `crontabs` to run automatically.

#### create the script
```shell
echo -e "#!/bin/bash/" >> backup_dotfiles.sh
```

#### Open the file in your favorite editor and add the following
```shell
# create a timestamp alias for the commit message
timestamp() {
  date +"%d-%m-%Y @ %T"
}

# files to backup
cp ~/.zshrc ~/dotfiles/.zshrc
cp ~/.vimrc ~/dotfiles/.vimrc

# pull & push
if [[ `git status --porcelain` ]]; then
    git pull origin master
    git add .
    git commit -m "Update: $(timestamp)"
    git push origin master
fi
```
As you can see I’ve added the `.zshrc` and `.vimrc` files again. You can add any (config)files you want here!

#### To add the job to cron, type
```shell
crontab -e
```
You can use [crontab.guru](https://crontab.guru) to generate how frequent you want the backup script to run. Let’s do every Monday at 10:00 by adding the following line to the cron file and save it
```shell
0 10 * * 1 bash backup_dotfiles.sh
```


### That’s it!

We’ve created a [GitHub repo](https://github.com/tgifelix/dotfiles) to back up dotfiles to, and automated the process with a bash script that runs periodically with cron. As always, drop your feedback in the comments! ✌️
DevAnalytics at DOHackathon: nice label name
Tags: dohackathon, angular, typescript, devjournal
Published: 2020-12-18 21:45:46

Today I struggled a bit with TypeScript's JSON handling, and I cannot say so far that I found an optimal solution, but I now have a nice label name for one stats element, so my goal is achieved.

![nice label name](https://dev-to-uploads.s3.amazonaws.com/i/tebq7vu0lzmljv24r8yd.png)

Tomorrow I create these label names for all the elements.
Build & Deploy a webpage with Gatsby and Surge
Tags: gatsby, surge, build, deploy
Published: 2020-12-18 21:36:38

Welcome to the **first part** in this *mini-series* called `Build & Deploy` where I combine tools for building websites and applications plus the tools to deploy them online. Follow my [**blog**](https://www.tgifelix.com) or find me on [**Twitter**](https://twitter/_tgifelix) for updates!

### Gatsby & Surge
`Gatsby` is a React-based open source framework for creating websites and apps. It’s amazingly fast and has a great workflow.

`Surge` is a CLI tool that deploys your static pages for free within seconds. In this article, I will show you how to use both to quickly build and deploy a static webpage. 

### Install
Open a terminal and use [npm](https://www.npmjs.com) to install Gatsby and Surge
```shell
npm i -g gatsby-cli surge
```

Login to surge
```shell
surge login
```

### Build

Create a new project with Gatsby
```shell
gatsby new <project-name>
# or
gatsby new <project-name> <starter-repo>
```
Gatsby offers [a great bunch of free templates](https://www.gatsbyjs.com/starters/) on their website to get started quickly!

Fire it up!
```shell
cd <project-name>
gatsby develop
```
The `develop` command starts a development server where you can interact with your webpage while you're building. You can access it locally at `http://localhost:8000/`. To learn more about the Gatsby file structure check out: [Gatsby Project Structure](https://www.gatsbyjs.com/docs/gatsby-project-structure/).

When you are finished making your webpage **awesome**, run the `build` command to generate an optimized static HTML site in the `public` folder
```
gatsby build
```shell
You can test the production by running the `serve` command
```shell
gatsby serve
```

### Deploy
Surge offers many awesome futures but works as simple as typing `surge` in your public folder.
```shell
cd public
surge
# or
surge public/
# or
surge public/ <your-domain>
```
And **BAM**! Your webpage is live! 

Create a `CNAME` document with the URL to skip the prompt on your next *surge*
```shell
echo <your-url>.surge.sh >> CNAME
```
Or use a custom domain name
```shell
echo your-website.com >> CNAME
```
To use a custom domain name, the `DNS` from the domain provider will need to be changed. More info: [Adding a custom domain](https://surge.sh/help/adding-a-custom-domain).

#### WTH just happened?
We’ve built a `static webpage` with `Gatsby` and deployed it to `Surge` with these commands
```shell
npm i -g gatsby-cli surge
surge login
gatsby new <project-name>
gatsby develop
gatsby build
gatsby serve
surge
```
 ---
#### Resources
- [gatsbyjs.com](https://www.gatsbyjs.com/)
- [surge.sh](https://www.surge.sh)
What Amazon Web Services do you use?
Tags: discuss, aws
Published: 2020-12-18 21:25:55

---
title: What Amazon Web Services do you use?
published: true
description: 
tags: discuss, aws
cover_image: https://pngimage.net/wp-content/uploads/2018/05/aws-logo-png-8.png
---
[AWS](https://aws.amazon.com/) provides an entire ecosystem of services that offer reliable and scalable cloud computing solutions.

Some of the most popular ones include S3, EC2, Lambda, Glacier, SNS, Cloudfront, Kinesis, EBS, VPC, Beanstalk, DynamoDB, RDS, ElastiCache, Redshift, among hundreds of others...

What AWS do you use and which ones are your favorite?
grep makes you grin... ;-)
Tags: bash, shell, cli
Published: 2020-12-18 21:23:13

This week I did only a short post, I have a lot on my plate but wanted to keep the habit of writing These during my weekly train rides. 

Anyway, I had to use grep today and realized that I had forgotten the parameters a bit. So here is a little refresher: 


-v : Flips what the output grep will show you. If you search for lines that contain the word test just write: 
```bash
grep "test"
```
If you want all the lines that don't contain the word test just use the -v Parameter. 

```bash
grep -v "test"
```

-n : shows Line numbers

-r : searches the current directory and all subdirectories recursively

--include : useful if you want Limit your search to a certain file pattern or Type. 

```bash
grep --include="pom.xml" "java.version"
```

Or 

```bash
grep --include="*.txt" "Test"
```
Which searches in all txt files for lines containing the word test. 


To save me some typing when need to search through my files for specific terms i have a function in my bash.rc: 

```bash
function grin() {
 grep -r -n --include="$1" "$2"
}
```
So when i want to search my Java Project for all XML files containing the term java.version i just type:
```bash
grin "*.xml" "java.version"
```
Database Design of the app, p.3
Tags: database, design
Published: 2020-12-18 21:19:52

This is post is part of the DigitalOcean Hackathon Series.

In this post inshallah, I will present the design of the database I will be using for the entities and the relations in AroundTheHood project.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ntvzq4x40fhvdenrppaz.jpg)
Any comments or feedbacks are highly appreciated and valued.
Unity Multiplayer Tutorial - Send User Data to Server
Tags: multiplayer, client, udp, server
Published: 2020-12-18 21:13:31

In this video I'll show you how to setup udp client and udp server for communication and represent the data from the client on the server

{% youtube DlGuKJrzdcg %}

> Like this post? 
> Consider Support me via [Patreon](https://www.patreon.com/eranelbaz)
> Or Subscribe to my [YouTube Channel](https://www.youtube.com/channel/UCVUNeBGM5wZJKcOx0QwAaTA?sub_confirmation=1)
> You can also follow me on [Twitter](https://twitter.com/elbaz_eran)
Hello World...
Tags: beginners, firstpost, programming
Published: 2020-12-18 21:04:58

Hey guys, this is your friendly neighborhood reaper. This is my first time actually writing a post so bear with me. A brief introduction about me: I'm a sophomore in a university majoring in computer science, my passion is ethical hacking, AI and whatever I find interesting. The reason why I'm writing this is because I love computers and I wanted to share whatever I find or make that helps you in your programming journey. So here's to a new adventure! Till then guys happy typing :) reaper out.
bind(), apply() and call() me maybe: Pt. 3
Published: 2020-12-18 21:03:31

This is the third and final post of my three part series on JavaScript's [bind()](https://dev.to/arynnboniface/-12bk), [apply()](https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-2-2jhd) and `call()`. 

Here is the [JavaScript MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) explanation of `call()`:

```
The call() method calls a function with 
a given this value and arguments provided individually.
```

`apply()` and `call()` are relatively similar. Both immediately invoke a function (with a specified context for `this`), where `bind()` does not. The difference lies in the arguments. `apply()` allows for arguments to be passed in as an array and `call()` needs arguments to be passed in one by one. 

As we learned in the previous parts of this series and by brushing up on `this`, using the `this` keyword without context results in `undefined`. 

```
const snowPerson = {
  top: "small snowball",
  middle: "medium snowball",
  bottom: "large snowball",
  accessories: "sticks, coal, scarf, hat and a carrot"
}

function buildSnowPerson() {
  return `Stack ${this.middle} on top of ${this.bottom} 
and stack ${this.top} on ${this.middle}. 
Use ${this. accessories} to finish your snow person!`
}
```

If we invoke `buildSnowPerson()`, it will return:
`Stack undefined on top of undefined and stack undefined on undefined. Use undefined to finish your snow person!`

Yikes. Looks more like a government document than it does instructions to build a snow person! 

But, if we use `call()`, `buildSnowPerson.call(snowPerson)` we'll get some pretty good directions to build a snow person!
`Stack medium snowball on top of big snowball and stack small snowball on medium snowball. Use sticks, coal, scarf, hat and a carrot to finish your snow person!`

When we're using `call()`, the `snowPerson` object used as the argument becomes our `this`.

Here's an example of using additional arguments with `call()`:

```
function snowPersonSeason(hot, cold) {
  return `If it's ${cold}, you can build a snow person like this: 
Stack ${this.middle} on top of ${this.bottom} 
and stack ${this.top} on ${this.middle}. 
Use ${this. accessories} to finish your snow person! 
This won't work if it's ${hot} time! `
}
```

Can you guess what `snowPersonSeason.call('Summer', 'Winter')` will return? 

```
If it's Winter, you can build a snow person like this: 
Stack medium snowball on top of big snowball 
and stack small snowball on medium snowball. 
Use sticks, coal, scarf, hat and a carrot to 
finish your snow person!

This won't work if it's Summer time!
```

Those are the basics of `call()`!
Sceptre monitor review
Tags: computerscience, other
Published: 2020-12-18 20:55:14

The Sceptre monitor is known for its low prices. The latest version of the monitor of Sceptre of size 22 inch, cost only $60 in offer days. Which is very low rates. 
---
title: Sceptre monitor review
tags: other
canonical_url: https://kodlogs.com/blog/11/sceptre-monitor-review
---

Do you wanna change your old monitor with the new one, or throw your laptop and switch on the Desktops. Spectre is the best option for it. On the Amazon, there is a bunch of the sales of the laptops and the pc daily. Spectre also sells its significant number of pc and monitors daily. Due to the competitive rates of them. 

 

The Sceptre x270W worth it for the gaming. The large size and high resolution make it perfect for gaming, and the 2ms response time means there's no smearing when you're playing an FPS. The screen is bright and worth for watching movies as well.

 

##Features:

27-inch screen (1920×1280)

DVI, VGA, and HDMI inputs

2 ms response time and 60,000:1 contrast ratio




##Pros: 
Really big screen

Good viewing angle range

Crisp display




##Cons: 
Base is somewhat limited in movement range

Large monitor requires lots of desk space

Color management can be an issue

###Full review:- 

Staff has a notoriety for being a touch of an additionally ran, deal item. In any case, in case you're searching for a bigger screen for messing around or surfing the web, I'd prescribe their 27-inch screen with definitely no reservations. My concern is that I anticipate more from my showcases, for example, shading exactness and the way to modify it. This isn't to imply that there's anything urgently amiss with the screen, it just feels like it could be better. 

The on-screen controls are as you would expect, and simple to explore, be that as it may, I would have jumped at the chance to see better command over the shading. There are a few pre-set shading decisions, marked "Film", "Gaming", and "Content", however, all they truly do is change the shading temperature. Obviously, most of your shading alteration will happen in your working framework, so this is anything but a significant issue. Know that in the event that you need to utilize this screen for whatever requires shading exactness (like working with advanced photographs) you should adjust this screen.

For gaming, the Scepter x270W works incredible. The huge size and high goals make it ideal for this, and the 2ms reaction time implies there's no spreading when you're playing an FPS. The screen is splendid and fresh, and it's fantastic for watching motion pictures also. 

I likewise found that the base is strong, however, constrained in its scope of movement. This is definitely not a colossal issue, however, it was somewhat irritating when I was setting up the screen at first. In the event that you move or change your screen a ton, it may be a greater amount of an issue.
How to set all values in an array to 0
Tags: java, programming
Published: 2020-12-18 19:39:34

In this article, I am going to explain how to set all values in an array to zero in java. This operation can be performed by using Arrays.fill() method which assigns the given value to each and every element in the array.
---
title: How to set all values in an array to 0
tags: java
canonical_url: https://kodlogs.com/blog/2611/how-to-set-all-values-in-an-array-to-0
---

##Approach
Arrays.fill() method basically belongs to the known arrays package and is written as java.util.Arrays;

Import this package in order to perform the above-said operation. You can even specify the range or the sub-array region to set it to a particular value.

If you do not know about this method, then you may simply assign that particular array to value 0. But if you need only a particular set of regions to be so, then use the Arrays.fill() method.

The below example explains that on the usage of the method Arrays.fill(array, value) changes each and every element to its value.

##Program
```
import java.util.Arrays;
public class Demo

{

public static void main(String[ ] args)

{

int arr [10] = {0}; 

System.out.println(arr);

int array[ ] = { 1,2, 3, 4, 5, 6, 7, 8, 9, 10};

System.out.println(array);

Arrays.fill(array, 0);

System.out.println(Arrays.toStrin(array));

Arrays.fill(array, 1,4,0); 

System.out.println(Arrays.toStrin(array));

}

}
```
##Output
`
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

[1,2, 3, 4, 5, 6, 7, 8, 9, 10]

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

[1, 0, 0, 0, 5, 6, 7, 8, 9, 10]
`
A new Tool for WordPress Developers and Digital Agencies
Tags: wordpress, startup, sideprojects
Published: 2020-12-18 20:36:41

Hello Everyone. I hope you guys are doing great. 

I am working on my side-project which is a simple tool and could be the most powerful tool other there in the market.

but before launch I have to some research 

If you are a WordPress Developer/Designer or a WordPress Agency owner and you have just 2 mins to spare please fill out the survey. 

https://www.surveymonkey.com/r/9BTKPPB

Thank you.
How to find square root in C++ without using sqrt function?
Tags: cpp, oop, programming
Published: 2020-12-18 20:34:46

Several ways can find or calculate square roots in C++ programming without using sqrt function. However, to get the answer, several iterations may be required for some large numbers which might appear inconveniencing. 

#Methods
* Log method
* Power algorithm
##Illustrations
All the methods are explained with illustratoins below.

---
title: How to find square root in C++ without using sqrt function?
tags: cpp
canonical_url: https://kodlogs.com/blog/1920/how-to-find-square-root-in-c-without-using-sqrt-function
---

###Log method

Below is one simple log method that can be used:
```
// C++ program to show finding 

// square root of a number using log2() 

#include<bits/stdc++.h> 

double squareRoot(double n) 

{ 

    return pow(2, 0.5*log2(n)); 

} 

int main(void) 

{ 

    double n = 12; 

    printf("%lf ", squareRoot(n)); 

    return 0; 

} 
``` 

The declarations of all variables must be made which means the programmer has to specify the value of log and the value of n whose square root needs to be found. 

 

##Power algorithm

Below is the power algorithm. The algorithm raises the value of x ^y i.e. x raised to power of y. The power syntax is:
```
#include <math.h>

double pow(double x, double y);
```

##Another one

Example of how to find square root using double/ power function is shown below:
```
x = int(input())

 import math 

print(pow(x, 0.5))

 or

print(x**0.5)
```
**Note: if the value of x above is negative, the return value is NaN**

Hope this helps.
Installing MongoDB on Windows
Tags: webdev, database, mysql, mongodb
Published: 2020-12-18 20:21:41

##What is MongoDB .
MongoDB is an open-source document-oriented database that is designed to store a large scale of data and also allows you to work with that data very efficiently. It is categorized under the NoSQL (Not only SQL) database because the storage and retrieval of data in the MongoDB are not in the form of table. It is a highly scalable, flexible, and distributed NoSQL database.
##Step 1: 
Download the setup from this link https://www.mongodb.com/try/download/community
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w6edi8pypjpftlqf5uvb.png)	
##Step 2: 
Double click the executable file you downloaded to launch the setup wizard. Click on Next to continue

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ubtmjcarw97sp4zkr2xi.png)
##Step 3:
 Tick the check box next to ‘I accept the terms in the License Agreement’ and again click on “Next“.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cgotouttwc08qvjgmpgl.png)
##Step 4:
 Click “Complete” to install all the features of MongoDB. As for “Custom”, this option would be used to install only the specific components of MongoDB and also if a user wants to change the location of where the installation must be done.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zx7n6myruh28akkds1e3.png)
##Step 5:
In the service Configuration window choose “Run service as Network service User and click next
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cw8naq1q2syxuewlnzap.png)
##Step 6
Select the checkbox to install MongoDb and click next.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v6zhx13ntk0dq5p7aybm.png)
##Step 7
Click on install and start. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hpmsz0ic60r5ei2omkng.png)
## Step 8
Please wait for Installation files to finish copying.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g1icyh5w8nn7rwhatf2d.png)
## Step 9
Your installation is Now complete.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g6oyhmttjr05gsq855zg.png).

Click on finish and go to system variables and include it to the path.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ld55z8y0omtx1yi0ilze.png).

Open command line and type Mongo and you are good to Go!
SSH Key issue with Terraform
Published: 2020-12-18 20:17:49

I originally followed GitHub's process to create a new ssh key. This created an ed22519 type of ssh key. after following GitHub's advice and adding my ssh key to my GH account, I was seeing an error when attempted to publish my Clojure project with Terraform: invalid privatekey: [B084fjlnvkiuhvlsdijfwliefj]

A google search let me know that this is due to JSch's inability to read a ed25519 private key. 

So, I went back to GitHub and followed the directions but this time for the older ssh key version. After completing this process, I ran `ls -al ~/.ssh` which showed me my_new_key and my_new_key.pub. However, the public key was 0 bytes. I discovered this when I tried pasting an empty file to my github ssh key. 

From my further searching, I found that you just have to add the -m PEM flag into your ssh-keygen. Follow the rest of the steps and terraform should respect your ssh creds.
The State of Solidus
Tags: solidus, ecommerce, ruby, rails
Published: 2020-12-18 20:16:53

{% youtube lZhF9srB2_0 %}

Alberto Vena of Nebulab gives us an update on our favorite open source eCommerce platform.

We've had a lot of shocks in the Solidus (and Spree) community in the last few years, and we need stability. Alberto will cover what's happened since the previous maintainers left the project, and how a group of people that care about Solidus are trying to make the platform more solid than ever.
ERROR Double Free or Corruption (out).
Tags: cpp, oop, programming
Published: 2020-12-18 20:15:09

In this article, we are going to discuss another error named “Double Free or Corruption Error”. This is an error related to memory operations. All descriptions and solutions to this error are given ahead of time.
---
title: ERROR Double Free or Corruption (out).
tags: cpp
canonical_url: https://kodlogs.com/blog/332/error-double-free-or-corruption-out
---

#Double Free or Corruption Error
The error Double Free or Corruption Error in the program means that our program has a C runtime function free(). The C runtime function, free(), can be called by mistake or somehow with an invalid pointer. All of this fuss can happen due to the use of dynamic memory allocation or by invoking free() directly.

##Cause
This error is commonly caused if your code has overwritten memory due to an out of bounds array index. For further explanation, you can observe this example.
```
!! Generates a "double free or corruption" error.
program free
  integer, dimension(:), allocatable :: data
  integer :: i

  allocate(data(5))
  do i = 1, 5
     data(i-1) = i
  end do
  deallocate(data)
end program free
```
When we compile this piece of code we will get this error. 

`
./free: double free or corruption (out): 0x0000000000607590
`
###Solution
To resolve this problem we have to track the issue as to where it should be. The way to achieve this is: to check invalid array indexing, compile the program with -fbounds-check. Then when we run it again and if there is any array indexing that is out of bounds then we will get an error message like this.
```
% gfortran -fbounds-check -o free free.f90
% ./free 
At line 8 of file free.f90
Fortran runtime error: Array reference out of bounds for array 'data', lower bound of dimension 1 exceeded (0 < 1)```
This redirects us to a line of code. Here we can rewrite it and can change it to solve our issues.