teleren/devto huggingface dataset:
Importance of CEH Exam
Tags: ceh, cehexam, ethicalhacking, cybersecurity
Published: 2020-02-07 11:37:50

With the emergence of security related issues across the world, the multinational organizations are looking for more number of professional and certified ethical hackers. Followed by this demand, CEH Exam is conducted to prepare and train certified ethical hackers, who can serve the MNCs for their security needs.

Importance of CEH Exam

In the digital world, breaching of security is not a much unknown phenomenon, and in order to get past these kinds of issues, one requires some special skills and training. Traditional textbooks cannot enable one with these kinds of skills, as these skills go beyond the traditional boundary of software engineering, network engineering, or mobile technologies.

How to Get Ethical hacking Certification?

The people, who can save the other from these kinds of security breaches, are called ethical hackers, and various multinational organizations recruit a large number of certified ethical hackers. These are the people, who have an in-depth knowledge of network engineering, mobile technology, database system, software engineering, and cyber law. However, anybody and everybody cannot be a specialized ethical hacker, as it requires focused training and guidance. For that reason, examinations, like  CEH certification exam , are conducted for preparing an ethical hacker.

How to Prepare for the Exam?

There are several areas, which are taught and evaluated during the course of this exam. Following are those areas:

Tools and Programs

Under this category, you can learn the basic programming and scripting languages, basic and advanced network technologies, various features and background operations of operating systems, networking hardware design, antivirus technologies, security features of operating systems, and database modules.

Security Features

Under this category, you can learn the various security-related technologies required to protect a system or a network. It includes the technologies like cryptography, firewalls, validation techniques, wireless technologies, and other physical verification technologies.

Analysis

CEH certification exam aspirants should be ready to learn the basics of system analysis, the technical analysis and risk analysis of an existing system.

Regulatory Framework

For successful completion of the ethical hacking certification, it is required to know the regulatory framework regarding the existing cyber laws, cyber compliances, code of conduct, and the boundaries of a hacker.

These are the basic skills required for being an ethical hacker. Once these skills are evaluated successfully, one can earn the title of certified ethical hacker.
AES-GCM Encryption with C#
Tags: csharp, dotnet
Published: 2020-02-07 21:32:52


Here is example how can you use encryption with AES GCM with C#. Its currently supported in .NET Core 3.0, 3.1 and .NET Standard 2.1. For .NET Framework you will need to use CBC. This code and more is awailable in my  nuget package [MayMeow.Cryptography](https://www.nuget.org/packages/MayMeow.Cryptography/).

So How to encrypt data?

```csharp
 public static byte[] Encrypt(byte[] toEncrypt, byte[] key, byte[] associatedData = null)
{
    byte[] tag = new byte[KEY_BYTES];
    byte[] nonce = new byte[NONCE_BYTES];
    byte[] cipherText = new byte[toEncrypt.Length];

    using (var cipher = new AesGcm(key))
    {
        cipher.Encrypt(nonce, toEncrypt, cipherText, tag, associatedData);

        return Concat(tag, Concat(nonce, cipherText));
    }
}
```

This will create byte array which looks like this

|Tag|Nonce|Encrypted Data|
|---|---|---|
|16 Bytes| 12 bytes | ...x bytes |

Everything you have to provide is key. Tag and NONCE is different for each data you vant to encrypt and its a part of array.

Function for decrypt data:

```csharp
public static byte[] Decrypt(byte[] cipherText, byte[] key, byte[] associatedData = null)
{
    byte[] tag = SubArray(cipherText, 0, KEY_BYTES);
    byte[] nonce = SubArray(cipherText, KEY_BYTES, NONCE_BYTES);

    byte[] toDecrypt = SubArray(cipherText, KEY_BYTES + NONCE_BYTES, cipherText.Length - tag.Length - nonce.Length);
    byte[] decryptedData = new byte[toDecrypt.Length];

    using (var cipher = new AesGcm(key))
    {
        cipher.Decrypt(nonce, toDecrypt, tag, decryptedData, associatedData);

        return decryptedData;
    }
}
```

In those functions i using concat and subarray functions. For merging arrays together and splitting them. they are here:

```csharp
public static byte[] Concat(byte[] a, byte[] b)
{
    byte[] output = new byte[a.Length + b.Length];

    for (int i = 0; i < a.Length; i++)
    {
        output[i] = a[i];
    }

    for (int j = 0; j < b.Length; j ++)
    {
        output[a.Length + j] = b[j];
    }

    return output;
}
```

```csharp
public static byte[] SubArray(byte[] data, int start, int length)
{
    byte[] result = new byte[length];

    Array.Copy(data, start, result, 0, length);

    return result;
}
```

Theese and more are part of **MayMeow.Cryptography** repository which is awailable on my [Github](https://github.com/MayMeow/MayMeow.Cryptography).

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D5DMOTA)
Peppermint OS - A Quick Review
Tags: productivity, ubuntu, opensource, linux
Published: 2020-02-08 06:45:02


![](https://github.com/bobquest33/peppermintos10_blog/raw/master/peppermint10os-1.png)

### Introduction
This is a quick review of Peppermint OS 10, as I am not used to do running linux in a VM for my daily usage, the only thing I could do was to do a whirlwind check of Peppermint OS. My first impression from the initial flash screen and the desktop layout was that it looked right out of early 2000s desktop experience - retro by design.  Running on a 4GB ram 64 bit VM, the response was snappy and reminded of early Linux OS desktops way back from 2009-10 when I mostly used as a desktop. But once you open the start menu and the applications, it was more modern and the dark theme really made me happy. 

![](https://github.com/bobquest33/peppermintos10_blog/raw/master/peppermintos10-7.png)

### Things I Liked


I liked the number of in-built apps and also links to web apps like Google Drive and  Microsoft Word. While initially I thought it as a bloatware. After checking a tool called Ice created by Peppermint, made me like the whole concept of having Web Apps in start menu. This is one feature other light weight OS should have. 

![](https://github.com/bobquest33/peppermintos10_blog/raw/master/peppermintos10-3.png)


This is something I use extensively with chrome on Windows 10 and by organising websites like Gmail, Drive and Google Docs as shortcuts is very handy and I feel no need to install their desktop variants. While in Peppermint these links are opened in dedicated Firefox windows and the experience is not as clean as a Chrome dedicated window but still I feel in a real laptop or desktop this feature will be very handy. 

![](https://github.com/bobquest33/peppermintos10_blog/raw/master/peppermintos10-2.png)


I also liked that it had many applications out of the box that we as users will need from time to time. As a daily driver this OS is very helpful but its usability is enhanced by using ICE and the WebApps for which links are embedded in start menu and would be leveraged well when connected to internet. And the fact that its built on Ubuntu we get all the advantages of all the package managers available in the Ubuntu ecosystem.

![](https://github.com/bobquest33/peppermintos10_blog/raw/master/peppermintos10-5.png)


## Issues

However aesthetically the Peppermint OS is too much retro. I had few issues with the Live ISO where I did not get the full screen mode where I can leverage the bigger real state of the desktop and check it out properly. Even during boot there were few warnings which I did not get in other ubuntu based ISOs that I have tried.  

### Final Thoughts

Since I am just checking out this OS I am sure there are many features that I have not tried and would be awesome.  With XFCE and host of many out of the box apps this is a good light weight OS for your old machine and a good replacement to Windows 7.
How you do code reviews for your side project?
Tags: discuss, sideprojects, webdev
Published: 2020-02-08 10:32:21

Recently, I have been doing some mini projects to learn new things or practice skills. But how can I get to know I am following best practices?  How to improve the quality of code and implement better logic? 



What are your thoughts on this? How you improve your code and how you do code reviews for your side projects?
Rolling, secure hashes for nodes in a tree / How to reduce on-disk space consumption?
Tags: help, discuss, java, kotlin
Published: 2020-02-08 10:57:35

Hi all,

I've implemented the storage of rolling, secure hashes for a temporal document store called [SirixDB](https://sirix.io).

During bulk inserts hashes are built while traversing the built tree in postorder. During updates, that is deletes, inserts or value updates hashes of ancestor nodes are adapted. We have unique node-IDs and hashes are built taking neighbour nodes into account (the 64 Bit node-IDs pointing to the sibling nodes).

For instance during an update the old hash is subtracted and a new hash basically added to parent node and that's bubbling up for all ancestors.

Now I wanted to reduce the collision possibility to a minimum and used Sha256 truncated to 128 Bits.

However, now every node optionally stores this hash, which is an additional 16 Bytes.

My idea would be to store all hashes of the nodes at the beginning of the variable sized page in a delta-encoding, for instance subtracting each consecutive hash from the former and storing some kind of variable size encoding.

Do you have any ideas how to best "compress" the hashes on-disk? Currently at most 512 nodes are stored in a page meaning 512*16 bytes only for the hashes.

Kind regards
Johannes
Android ViewModels: Saving State across Process Death
Tags: kotlin, architecture, viewmodels, android
Published: 2020-02-08 14:09:34

A misconception among some android developers is that the purpose of using ViewModels is state persistence — it’s actually partly true — they do help in saving state across configuration change (e.g. device rotation) but not process death. So if Android kills your app (let’s say because of low memory), then your app state is lost.

So depending on whether you want to persist your state across process death or not — you can either use onSaveInstanceState in your Fragments/Activities or the new SavedStateHandle in your ViewModels.

Ok so why SavedStateHandle and why save/handle states in ViewModels?

Well if you handle your state (for process death) in Activities or Fragments — that’ll add extra verbosity and will cause tight coupling between state-handling & activity/fragment code. Handling your state via ViewModels solves this issue.

# Using SavedStateHandle
### Add lifecycle-viewmodel-savedstate dependency

```kotlin
dependencies {
  def lifecycle_version = "2.2.0" // currently the latest version
  // Saved state module for ViewModel
  implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
}
```

### Add SavedStateHandle property in your ViewModel

```kotlin
class MainViewModel(val state: SavedStateHandle) : ViewModel() {
    
}
```

### Initialize your ViewModel using SavedStateViewModelFactory

```kotlin
class MainFragment : Fragment() {

   private val viewModel: MainViewModel by viewModels {
      SavedStateViewModelFactory(application, activity)
   }

```

### Save and restore state

The SavedStateHandle has methods for setting/getting values.

- get(String key)
- contains(String key)
- remove(String key)
- set(String key, T value)
- keys()

You can save/restore primitives, bundles and parcelables.
Saving is as easy as:

```kotlin
// In your viewmodel
fun saveName(name: String) {
    state.set("Name", name)
}
// In your fragment
viewModel.saveName("Ahmed Rizwan")
```

And restoring:
```kotlin
// In your viewmodel
fun getName(): String? {
    state.get<String>("Name")
}
// In your fragment 
val name = viewModel.getName()
```

### Restore state as a LiveData

If you want to restore your data as LiveData, theres a getter for that as well.
```kotlin
// In your viewmodel 
val nameLiveData = state.getLiveData<String>("Name")
// In your activity/fragment
viewModel.nameLiveData.observe(this) { name ->
   // handle changes
}
```
---
And that’s it — make sure to handle all your states!
Happy coding!
Simple tooltips on hooks
Tags: react, javascript, css, webdev
Published: 2020-02-08 17:16:56

```jsx
<Component ref={useTooltip('tooltip')}>Test content</Component>
```

This method allows you to create tooltips close to pure html

```html
<div title="message">example</div>
```

instead of using complex wrappers like

```jsx
<Tooltip content={'message'}>
    <div>example</div>
</Tooltip>
```

or etc.

{% codepen https://codepen.io/tetragius/pen/abOzEGv %}
What does a basic project look like for me?
Tags: uwp, csharp, xaml, beginners
Published: 2020-02-10 06:03:46

So, what was my basic app starting point look like in February 2020?

Sort of like this:

![pic of Visual Studio Solution manager](https://i.pinimg.com/originals/94/50/7a/94507ac5e544066c22adccbf25cc9dfe.png)

There is some stuff added and removed from standard for me; for example I have stripped out the Settings view I normally have (I'll re-add that later).

But it gives you an idea.  

I have dreams of having base ListViewModels setup, as they tend to work in VERY similar ways 90% of the time, but I have never worked that out how I want it to be.

There is significant room for improvement and reduction of duplicate load/delete/startnew code in those view models.  I've moved on though for now as you can spend a lot of time "collecting underpants", so to speak, while not getting on with solving problems.

Chao,
Rob.
Certificate Generator With PHP Using imagettftext function
Tags: php, html
Published: 2020-02-14 12:53:19

###**Introduction**
> Imagettftext is a function used to write text to an image using TrueType fonts.

{% gist https://gist.github.com/olawanlejoel/2ce0794c595e4afc4529b5f5a7fb9e23.js %}

**Explaining all the parameters involved in this array:**

**Image:**
An image resource is returned by one of the image creation functions, such as imagecreatetruecolor(), imagecreatefrompng(), e.t.c.This image is supposed to be an empty certificate.

![Empty Certificate](https://res.cloudinary.com/tobest-foundation/image/upload/v1581682893/111_vln7un.jpg)

**Size**
The font size of the text you intend to place on image.

**Angle**
The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.

**X and Y**
The x and y axis are use to set the position of the text using the x and y co-ordinates

**Color**
The color index. we make use of the imagecolorallocate() to set color to the text we are displaying on the image in RGB format.

**Fontfile**
The path to the TrueType font you wish to use.It could have an extension of .ttf, .otf, e.t.c.

**Text**
Finally this is the name attributed to the text you intend to display on the image.

>*This is the major function behind Certificate generator. A good understanding of this would be very useful in other approaches like Id care generator, ticket generator and lots more…
This approach could also be integrated to your websites, so people get certified after performing a specific task like taking a course instead of doing everything manually which would take time*.

**Getting Started**

*To get started here are the major stuffs needed*
* Font file
* Empty certificate PNG file
* And finally a PHP file where all my codes would be for simplicity.

>Note: You can tweak anything once you perfectly understand this code and how this function works.

*You can give your file any name, but I would name mine index.php*

**Index.php**

The index file will contain the form where peoples name would be fetched from and also the PHP code.
Below is the form where data for certificate generation is gotten from.

{% gist https://gist.github.com/olawanlejoel/875009286dcf086f252ab18af2cd7ba8.js %}

From the above form we are only getting the name and then the code below is the PHP code

{% gist https://gist.github.com/olawanlejoel/889eeb7c46fff39a35295ee71063d6e1.js %}

This is the basic thing you need to know to place text on image with php.
Here is a link to the complete code - [Certificate Generator](https://github.com/olawanlejoel/certificategen) and you can test it [live Here](http://certificategen.000webhostapp.com/).

If you have any idea on more things that can be done via this function or any function for uploading image on image.Let's talk on [Twitter](https://twitter.com/OlawanleJ).

P.s: I'm looking to make new dev friends, lets connect on [Twitter](https://twitter.com/OlawanleJ).

Thanks for reading 👏
Creating and Using your OCI Free Tier VMs
Tags: cloud, linux
Published: 2020-02-14 20:18:55

One of the great things about the Oracle Cloud Infrasture (OCI) Free Tier as opposed to other 'always free' cloud services is that you can have 2 Compute Virtual Machine Instances (VMs)

* https://www.oracle.com/cloud/free/
* https://docs.cloud.oracle.com/en-us/iaas/Content/FreeTier/resourceref.htm
* https://docs.cloud.oracle.com/en-us/iaas/Content/GSG/Reference/overviewworkflow.htm
* https://www.oracle.com/cloud/sign-in.html?intcmp=OcomFreeTier

The first thing to do after creating your VMs will probably be to SSH in and run `yum update` and then install `lsb` and maybe `nmap`
```
$ ssh opc@MYPUBLICIP
$ sudo -i 
# yum update
# yum install redhat-lsb
# yum install nmap 
# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch: \
cxx-4.1-amd64:cxx-4.1-noarch: \
desktop-4.1-amd64:desktop-4.1-noarch: \
languages-4.1-amd64:languages-4.1-noarch: \
printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	OracleServer
Description:	Oracle Linux Server release 7.7
Release:	7.7
Codename:	n/a
```

In Part 2 we will look at how to network your VMs (10.0.0.2 & 10.0.0.3) together and in Part 3 we will look at how to install node.
CSS Grid 201, let's get technical
Tags: css, grid, youtube, tutorial
Published: 2020-02-15 14:22:36

So last week, [I presented my way of talking about CSS Grid, focused on being simple to understand and visual](https://dev.to/arthurbiensur/learning-css-grid-the-easy-way-2d9h). This week, we are going to go a bit deeper under the hood!

As much as I think that using track numbers is unfriendly, it's still super useful to know how they work, especially before entering the "dynamic" part of the series next week.

You will find below a walk through of how to place items using the track lines, area lines, all the shorthands you will need and as a bonus, how to overlap items!

[link to the full playlist here](https://www.youtube.com/playlist?list=PLBHbfZu_dhOca_FpdUccB2KfjPfW1zklZ)

Under the hood
{% youtube xfPBhTSFjkI %}

Spanning multiple rows/columns
{% youtube reMFQYiPR4o %}

Using our named areas as tracks
{% youtube Ii85GSOK1Tw %}

Hooking to multiple areas and span across them
{% youtube Ftfk8rdA8nM %}

Overlapping items
{% youtube 9Lds75ufST4 %}

Reduce code verbosity with shorthands
{% youtube Dokj7PI0AY0 %}
Document your thoughts
Tags: productivity
Published: 2020-03-05 22:36:26

> Originally posted at [michaelzanggl.com](https://michaelzanggl.com/articles/document-your-thoughts). Subscribe to [my newsletter](https://michaelzanggl.com/) to never miss out on new content.

Here's a nice little habit I've picked up recently.

I was working on a feature for a side project, but I struggled coming up with the right approach. For a couple of days, I was procrastinating on it, working on other parts of the app (you know, coding). I tried taking notes in bulleted lists and doing some brainstorming with mind maps. But it was all still so blurry. There was no clear path.

Then I tried something different. After reading some of the stuff from the people at basecamp, I followed their recommendations and started writing. And I mean actually writing, using proper sentences rather than just bullet points. It was very casual as if I was talking to a person, telling him/her/me(?) about all the problems with the first approach, and how the other one just isn't compelling enough.

It conceptualized my thoughts, put them into order and laid everything out in front of me.

The end result was a mix of multiple approaches and things that I have not even thought of before. And it only took an hour of writing to clear my brain that has been foggy for days now.

One more thing I came to understand:

I can type pretty fast, but I realized that typing fast was paradoxically slowing me down. My thoughts couldn't catch up. I couldn't keep the "conversation" going.  So try slowing down when you feel the same way.
Using Mirage JS to create a fake api with React JS
Tags: miragejs, react
Published: 2020-02-17 14:54:31

---
title: Using Mirage JS to create a fake api with React JS
published: true
description: learn how to use miragejs to fake a api endpoint
tags: miragejs, react
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/q5vkwvkc8j9bvny8mhd9.jpg
---

welcome to my first post, today i'm going to show you how to use Mirage JS to make a fake endpoint, after you learn it, i'm sure you will be amazed by it and will use it in your future projects.

# What is it?
from Mirage website: Mirage JS is an API mocking library that lets you build, test and share a complete working JavaScript application without having to rely on any backend services.

if you want know more, read the [getting started](https://miragejs.com/docs/getting-started/introduction/) guide.

## Before start
install the **create-react-app** to try Mirage.

```ssh
$ npx create-react-app testapp
```
## Install Mirage JS

```ssh
$ npm i --save-dev miragejs
```
## Creating the server

cd to the react folder then create a `server.js` file inside `src/` folder:

```ssh
$ cd testapp/ ; touch src/server.js
```
now open the `server.js` file and type the following code:

```js
import { Server, Model } from "miragejs"

export function makeServer({ environment = "development" } = {}) {
  let server = new Server({
    environment,

    models: {
      user: Model,
    },

    seeds(server) {
      server.create("user", { name: "Bob" })
      server.create("user", { name: "Alice" })
    },

    routes() {
      this.namespace = "api"

      this.get("/users", schema => {
        return schema.users.all()
      })
    },
  })

  return server
}
```

now import this script inside your `src/index.js`:

```js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import {makeServer} from './server';

if (process.env.NODE_ENV === "development") {
  makeServer()
}

ReactDOM.render(<App />, document.getElementById('root'));

serviceWorker.unregister();
```

## Fetch the data
now inside our `app.js`, use the react functions `useState` and `useEffect` to help us with this job:

```js
import { useState, useEffect } from "react"

export default function App() {
  let [users, setUsers] = useState([])

  useEffect(() => {
    fetch("/api/users")
      .then(res => res.json())
      .then(json => {
        setUsers(json.users)
      })
  }, [])

  return (
    <ul data-testid="users">
      {users.map(user => (
        <li key={user.id} data-testid={`user-${user.id}`}>
          {user.name}
        </li>
      ))}
    </ul>
  )
}
```
now go to the terminal and start the react server:

```ssh
$ npm run start
```

now you should be able to see your users being rendered in the view. this is a simple tutorial, feel free to comment if anything is wrong.