teleren/devto huggingface dataset:
Some surprising weird and useful commands on the command line. (Windows and macOS)
Published: 2020-06-11 19:08:19

###### #commandline #commands #programming #cool

Have you ever stumbled upon anything weird? Well then get ready for this. Here are some strange commands that actually work.

1. "ntdy[dsf": as weird as it seems, this command is kind of similar to the node and vim command. Try it out for yourself!

2. "command history": this is a very useful command, you can track down your history and previous commands you typed. (Note: this only shows some chunk of it).

3."netsh wlan show profile": ever forgotten your Wifi password now this one will surely help you if you are fascinated by computers or somewhat familiar with them you can always remember your password with no worries!! 

4. "shutdown": just too lazy to shutdown your computer well technology has got your back! With this command you can shutdown your computer anytime by just literally typing it!!

5. "/?": want to find more information about these commands? Well try this one if you are keen onto learning and don't know a particular command well then just type: command/? and it will give you a good explanation!

6. "telnet towel.blinkenlights.nl": now this may not work for all that's quite disappointing but is yet cool if you type this command well it'll show you star wars!! Well maybe in ASCII but still just as good. I'm not a star wars fan myself well then you should try this out!!

7. "tyeuw[fdd": another strange one definitely, again the same functionality as the first one.

8. "help color": still here? Good because this one is exciting! Getting bored of your old command UI well then let's add in some fun! If you type this command it'll give you a list of colors then simply type: color color_you_want ex: color 02  - which is green. Have a splash of fun!!

9. "systeminfo": this one takes a while but is worth waiting for!! It just gives you system info practically the literal name of the command.

10. "nslookup https://www.website.com": last but not least if you know what's a IP address and if you don't see this link: https://medium.com/@sadatnazrul/basics-of-ip-addresses-in-computer-networking-f1a4661ea85c#:~:text=Each%20device%20connected%20to%20the,Addresses%20are%20IPv4%20and%20IPv6. - pretty long but it's a good read. Anyways getting back to the point you can get the IP address of any website. Just type nslookup https://www.website.com and voila!!


There you have it folks top 10 cool commands!!
Love is Love. Celebrate it! 🏳️‍🌈
Tags: devpride
Published: 2020-06-11 18:38:00

_Photo: Celebrating Love_✨

So yeah, It's the month to be proud and celebrate who you are. Celebrate love regardless. I am Diana, Pansexual and proud.

## I'm proud of...
Being who I am. Never have i felt so free before until i started worrying about what society expected and thought about me. I am a person with talents, shortcomings and dreams like everyone else. I learned to embrace myself as I am and continuously work towards improving everyday.

## I’m an expert at...
I don't consider myself an expert, but I have some talents in programming, infrastructure and my passion is music.

## Equality in tech looks like... 
More like equity. I have been working non-stop for the last 10 years of my life with communities to make sure everyone can sit at the table!!

## I find support in...
My friends, my team, myself.

Embrace yourself. Take care of the person you love the most!. Here's a shameless plug to a talk I gave a while ago: Make room, not war: Inclusion means all y'all!

[![Inclusion Means All Y'All](http://img.youtube.com/vi/jINg1PuaRs8/0.jpg)](https://youtu.be/jINg1PuaRs8)
How Two4Tea scaled its Game Application to 55 Million users with Back4App.
Tags: ios, android, devops, aws
Published: 2020-06-11 19:02:55


⠀
https://blog.back4app.com/scaling-a-game-app/
⠀
#xamarinforms #angular8 #reactjs #javascript #MobileAppDevelopment #appdevelopment #AppDev #Javascript
#Swift #iOSDev #AndroidDev #Kotlin #NodeJS #Flutter #flutterdev #php
Conditionally spread into Object/Array - Javascript
Tags: javascript, todayilearned
Published: 2020-06-11 19:01:32

There comes a time when we want to add more fields/elements into an array or object when it satisfies a certain condition. This blog is an exploration of how and why. 

## Spreading into an Array

`isWinter` is a boolean variable and you need to add `winterEssentials` if it's true and nothing otherwise. 

```javascript
const essentials = ['phones', 'book', 'cap'];
const winterEssentials = ['sweater', 'thermals'];
 
const isWinter = true;
 
const tripEssentials = [
  ...essentials,
  ...(isWinter ? winterEssentials : [])
];
```

We need an empty array at end because we cannot spread `undefined` or `null` into an array (they are not iterables). Spreading an empty array into another just keeps the array intact.

```javascript
const initialArray = ['a', 'b', 'c'];
const resultingArray = [...initialArray, ...[]];
console.log(initialArray, resultingArray); // Have the same elements.
```

## Spreading into an Object

Rest spread into object is a [Stage 4 ECMA proposal](https://tc39.es/proposal-object-rest-spread) and is [implemented in most browsers](https://caniuse.com/#feat=mdn-javascript_operators_spread_spread_in_object_literals).

It mimics the behavior of existing [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) operator.

```
const hacker = {
  hoodie: true,
}
 
const isHacker = true;
 
const person = {
  firstName: '',
  lastName: '',
  ...(isHacker && hacker)
};
 
console.log(person);
```

You will notice here that resorting to a conditional operator isn't necessary. This is because rest spread for objects tries to wrap any primitive it finds to an object.

```javascript
console.log(null); // {}
console.log(undefined); // {}
console.log(0); // {}
console.log('abc') // {0: "a", 1: "b", 2: "c"}, well an array is also an object
```

> Guide to [Type Coercion in JavaScript](http://blog.agney.dev/type-coercion/)

So the expression `(isHacker && hacker)` returns `undefined` which our spread operator converts to `{}` and spreading an empty array into an object results in nothing. 

That's conditional spread.
Same Repo On Both Bitbucket And Github
Tags: git, github, bitbucket
Published: 2020-06-11 18:58:40

---
title:  Same Repo On Both Bitbucket And Github
published : true
description : 
tags: #git #github #bitbucket
---


I used bitbucket as my main remote hub for some years now. The main reason was that we use bitbucket at work, so I was more familiar with it. The other reason of course was that I could host my private repositories there. Now Github also allows hosting of private repositories, so I wanted to add Github as another remote to my existing git repositories. Here is what I did.

First I checked what is the remote by using the below command.

```bash
# Shows remote
git remote -v show

### output
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (fetch)
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (push)

```

Then I looked at the git config in a text editor.

The config is in the file  `.git/config`. It has an entry as below

```bash
[remote "origin"]
	url = https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git
	fetch = +refs/heads/*:refs/remotes/origin/*
```

To set Github as another remote, I ran the below command.

```bash
git remote set-url origin --add git@github.com:vikrampawar/javaprojects.git

### output
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (fetch)
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (push)
origin  git@github.com:vikrampawar/javaprojects.git (push)

```

This added the remote to the config

```bash
[remote "origin"]
	url = https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:vikrampawar/javaprojects.git	
```

I had issues. So, I first created an empty project called 'javaprojects' on Github, and then I also changed the protocol to https instead of git.

```bash
git remote -v show
### output
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (fetch)
origin  https://Vikrampawar@bitbucket.org/Vikrampawar/javaprojects.git (push)
origin  https://github.com/vikrampawar/javaprojects.git (push)
```

When I did a push, it worked. I have the repo on Github as well now.

This only works one way now. I can push changes to Github, but I can't pull from it. I'll do that setup later.
4.1 Swift Discussion
Tags: swift
Published: 2020-06-11 18:55:07

•	<h1>When will you use breakpoints?</h1> – To check values or perform debugging operations.

•	<h1>Why would you change the iOS simulator?</h1> – If referring to changing from older generation to newer generation iOS devices, you would see how it behaves on an older device if used, and have a smaller impact on your computer when running the simulator.
Termux commands
Tags: android, git, hacking
Published: 2020-06-11 18:50:03

Termux is an Android application that provides a Linux command-line experience on your Android device. It allows you to install and run various Linux command-line tools, including programming languages like Python, Ruby, and Node.js. With Termux, you can access your device's file system, install and manage packages, and use your Android device as a development environment.

## Here are some features of Termux:

- Access to a Linux shell on your Android device
- Ability to install and run various Linux command-line utilities and programming languages
- Support for apt package manager to install and manage packages
- Access to the Android file system and ability to edit files
- Ability to create and edit shell scripts

## Termux allows you to perform various tasks from the command line on your Android device, such as:

- Web development using Node.js, Ruby on Rails, or Python frameworks
- Mobile app development using React Native, Cordova, or Ionic
- Penetration testing using tools like Nmap and Metasploit
- Network analysis using tools like Wireshark and tcpdump
- Text editing using vi, Emacs, or Nano

To get started with Termux, you can simply download the app from the Google Play Store or F-Droid. Once installed, you can open the app and start using the command-line interface.

## Here are some useful commands to get started:

- `pkg update` - updates the package repository
- `pkg install <package name>` - installs a package
- `apt list` - lists all available packages
- `cd` - changes the current directory
- `ls` - lists the files and directories in the current directory
- `vi <filename>` - opens the Vi editor to edit the specified file
- `nano <filename>` - opens the Nano editor to edit the specified file
- `chmod` - changes the permissions on a file or directory
- `cp` - copies a file or directory
- `mv` - moves a file or directory
- `mkdir` - creates a new directory

Overall, Termux is a very powerful tool for developers who want to use their Android device as a development environment. With support for various command-line tools and programming languages, Termux provides a Linux-like environment on your Android device.
🤓 What is your favourite channel/type of developer content on YouTube?
Tags: discuss
Published: 2020-06-11 18:44:27

---
title: 🤓 What is your favourite channel/type of developer content on YouTube? 
published: true
description: 
tags: #discuss
//cover_image: https://direct_url_to_image.jpg
---

What are your favorite developer channels? 
Why do you subscribe to them? 
Do you have a favourite type of content? eg career advice, tutorials, rants. 

I'm building my channel and want to make sure I'm creating content people will enjoy. 

I would love to hear your thoughts? 🤔
Angular Libraries in 10 minutes
Tags: angular, typescript
Published: 2020-06-11 18:38:56

An Angular Library allows us to package components as a NPM Package.  We install Node Packages via 
```
npm i packagename 
```
We then import those packages in the app.module.ts. We use NPM packages all the time.
 
**Create a Library Project**

```
// Create a new folder named cmp with a projects folder.
ng new cmp --createApplication=false
cd cmp

// Generate a test component as an application
ng generate application test

// Generate our new library
ng generate library cmp2
```
This folder structure is created.

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

Notice the projects folder? When Angular libraries are created, it allows multiple projects to be created in the projects folder. 

```typescript
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'lib-cmp2',
  template: `
    <p>
      cmp2 works!
    </p>
  `,
  styles: []
})
export class Cmp2Component implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }
```

**Import the Library Module**

In the test application, open the app.module.ts and import the CM2Module from the new libarary.

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

**Reusable Component**

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

From this folder:
```
// Serve the application that consumes the libarary
..\cmp\projects> ng serve test
```
✔️[Github Repo](https://github.com/Javaman2/ReusableComponents)
 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eisoilh0b6y3pzch843l.png)

**Notes**

- It might be worth it to ditch the traditional old way of creating Angular Projects. By doing it this way we have an immediate place to refactor anything needing to be reused.

- Our test application was just one example of another project within this "workspace". Theoretically, there's no limit.

Up Next: Adding Components. 
JWP 2020  Angular Libraries
What is a Callback in Javascript?
Tags: javascript, tutorial, webdev
Published: 2020-06-11 18:37:14

Callbacks are usually an interview question and a must to understand if you want to be a web developer.

## What is a callback?

In Javascript, functions are **objects** and that's the reason **functions** can take **other functions** as **arguments** and can also **be returned** by **other functions**.

The functions that take or return functions are called **Higher-Order functions** and the passed or returned ones are called **Callback functions**.

_As an analogy we can say:_ A callback function is telling some other code to do some work, which will take some time. We don't get an answer immediately, so we say "when you've finished doing X, call function Y with the result".

## How do we use callbacks?

```javascript
function callback(message) { 
    alert(message); 
}

function higherOrderFunction(message, callback) {
    callback(message);		
}

higherOrderFunction('This is a callback test', callback);
```

Here, the **callback function** takes in an argument and shows an alert with the **message** as it's argument while **higherOrderFunction** takes in an argument and a **callback function** which will be executed with **message** as it argument.

Let's see some examples with different kind of functions.

### Anonymous function:

This code will do exactly the same as our example above.

```javascript

function higherOrderFunction(message, callbackFn) {
    callbackFn(message);		
}

higherOrderFunction("This is a message", function() {
    alert("message");
});
```

In this case the argument **callbackFn** that we pass can have any name you want since it's an anonymous function (has no name) that we are passing as argument to **higherOrderFunction**.

### Arrow function:

```javascript
function higherOrderFunction(message, callbackFn) {
    callbackFn(message);		
}

higherOrderFunction("This is a message", () => {
    alert("message");
});
```

### What about DOM events?

Let's say we want to add an event listener to this button so when we click it, it shows an alert with a message:

```html
<button id="show-message">Click here</button>
```

In our JS script we will use the **addEventListener** method passing to it 2 parameters, the _type_ ("click") and the **callback function** will which show the alert message:

```javascript
document.querySelector('#show-message')
    .addEventListener('click', function() {
        alert('This is a test message');
});
```

### Why use Callback functions?

We mostly create apps that are synchronous. Basically, some of our operations will only start after the preceding one is completed.
In the real world we often request data from different sources as and external API and we don't know when the data will be delivered. We want to wait for the response, but we do not want our application stuck meanwhile.
In these situations is when **callback functions** are extremely handy.


You can find more info about callbacks [in here](https://developer.mozilla.org/en-US/docs/Glossary/Callback_function)
Basics of TypeScript
Tags: 100daysofcode, javascript, typescript, learning
Published: 2020-06-11 18:21:57

---
title: Basics of TypeScript
published: true
description: Getting started with TypeScript
tags: #100daysofCode,#javascript,#typescript,#learning
cover_image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
---

So, Today I get started with the basics of TypeScript. 

I was always aginst typescript because it increases the size of the codebase. Whenever you write more code the chance for the error is high.  But recently I faced some difficulties maintaining the type of the object and making sure it doesn't contain any invalid values while developing. 

So I decided to give it a shot and started with basics today. Very soon will build a node and react project with typescript.

You can find my Repo Link here
https://github.com/ganeshraja10/Latest-Tech-Learnings

```typescript
const a: number = 22;

interface Point {
  x: number;
  y: number;
  z?: number;
  w?: any;
}

const point2D: Point = {
  x: 22,
  y: 22,
};

const point3D: Point = {
  x: 22,
  y: 22,
  z: 33,
};

type AddValueType = (x: number, y: number) => number;

const addValue: AddValueType = (x: number, y: number) => x + y;

let multiple: number | string = 22;

multiple = 'string';

interface PointX {
  x: number;
}

interface PointY {
  y: number;
}

type Point2Dim = (PointX & PointY) | string;

const Point2D2: Point2Dim = {
  x: 22,
  y: 33,
};

```
VimTrick: Using Jumps
Tags: devops
Published: 2020-06-11 18:19:44

Here's a super useful Vim trick that requires no plugins and which will certainly power-up your Vim proficiency.

In Vim, jumps are cursor movements stored in a list called the jumplist. When making certain movements, such as jumping to line 42 with `42G`, Vim will save it as a “jump” in the jumplist. You can list jumps using the `:jumps` command. To move backwards through the jump list to an older jump use `ctrl-o`. To move to a newer jump use `ctrl-i`.

Many shorter movements, like regular hjkl and those based on motions do not modify the jumplist. So their movements will not be navigable with `ctrl-o` and `ctrl-i`. Similarly, the colon line number (`:42`) movement does not modify the jump list. Examples movements which modify the jump list are:

* `/pattern` searches and `?pattern` searches (forward and backward pattern matching)
* `*` and `#` (forward and backward search for the word under the cursor.
* `%` (jump to a matching enclosing character like paren, brace, bracket, etc)
* Any inter-file navigation like `gf`

Over on [VimTricks](https://vimtricks.com), we have a screencast and more details. [Read the full tutorial](https://vimtricks.substack.com/p/vimtrick-using-jumps).
Turns a Web Browser into a Web Server with WebRTC
Tags: css, javascript, showdev, devops
Published: 2020-06-11 18:18:30

About 3 years ago, Almost a smilar project I was thinking to do. However, today I found 'Smoke'. Also, Smoke is open source :)

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

Smoke Document read :

Smoke is an experimental peer to peer networking framework that allows Web Browsers to run as lightweight Web Servers that operate over WebRTC. It offers a set of APIs to run both HTTP and Web Socket server like functionality in the browser as well as a set of Web like APIs to consume content hosted in remote browsers.

Communication between browsers operates entirely peer to peer with each network Node able to support hundreds of concurrent connections. New server nodes may be deployed when users load web pages, with some potential to scale node infrastructure proportional to the number of users loading pages.

Additionally, this library provides two storage mechanisms for persisting object and file data by leveraging IndexedDB. Nodes can host file and data in much the same way as one would with a traditional file or api server, with IndexedDB offering gigabytes of storage at each node.

***Github Respository :***
{% github https://github.com/sinclairzx81/smoke %}

I hope you people like the above article and learned something.
######***IMP REQUEST:***
###### You are most welcome to join my team [ form for joining ](https://forms.gle/pSCALuEWHus3pg9F6).
###### *Also you are most welcome to join OPEN SOURCE INTELLIGENT SYSTEM (OSINT) if you can help in open source project regarding safeguarding humans from various diseases like CORONA outbreak*
######https://github.com/Manishfoodtechs/OSINTHRH/wiki


Contact email: Manishfoodtechs@gmail.com. 

If you have any problem, our team is also engaged in professional consultancy and delivery.

![](https://media2.giphy.com/media/oNrPzIy3OhHm7zrvA3/source.gif)

###### image credit: uncraw.co, github/smoke
DeleteNonio - Extension for Portuguese news websites
Tags: javascript, showdev, github, programming
Published: 2020-06-11 18:10:34

I'm sharing with you another open source project of mine 

{% github dippas/DeleteNonio no-readme %}


Today it turns 1 year old, so happy b-day :)


It is targeted for Portuguese news websites that runs the Nonio Platform.


A platform which doesn't comply with GDPR  - you can see more details about that here - nonio.pt (not the official URL as everyone would think, the people behind the platform registered nonio.net instead)


Right now, the project does its job perfectly, but any feedback is always welcome.
Fast Forms With UpdateView - Building SaaS #44
Tags: python, django, saas, forms
Published: 2020-06-11 18:06:24

{% youtube aSE7vQKAFs8 %}

In this episode, we worked on an edit view.  We used Django's generic UpdateView to aid the process and test drove the creation of the view to verify things every step of the way.

We worked on a view to make it possible to edit the `CourseTask` model that are the actions that a student must complete for a course.

To complete the form quickly, I took advantage of Django's `ModelForm` views.  These views are designed to make forms rapidly from existing models.

The first thing I did was create a test that would try to edit a course task from the URL where the task can be edited.  The first test was a `GET` request to make sure that we can render a form for the given task.

We took a break to chat about other frameworks and philosophies around those choices.

On the new view, I used `get_queryset` to filter to the tasks associated with the user's school.  To connect the view to the view's URL `uuid` parameter, we had to set `slug_field` and `slug_url_kwarg` to `uuid`.  Finally, I set the `fields` that we want to edit on the model record.

After that was done, the view required the creation of a `courses/coursetask_form.html` template.  We created an empty file and the initial test passed!

With the happy test done, I added more tests to check the other constraints that the view needs to have.

Before jumping into the template of the form, I modified the daily view that is supposed to link to this view to do the proper linking.

To finish the stream, I spent a bit of time adding initial styles and structure to the form view templates.

This article first appeared on [mattlayman.com](https://www.mattlayman.com/building-saas/fast-forms-updateview/).