teleren/devto huggingface dataset:
My toolchain changes in 2020
Tags: 2020, toolchain
Published: 2020-12-20 03:08:11

---
title: My toolchain changes in 2020
published: true
description: Describe what toolchain changes I made this year.
tags: 2020,toolchain
//cover_image: https://direct_url_to_image.jpg
---
This page describes the changes I made to my toolchain in the last year. True to my writing style, this will be short and (hopefully) sweet.

The changes in (roughly) decreasing significance:

1. Switched to using [Zsh](https://www.zsh.org) along with the [Oh My Zsh framework](https://ohmyz.sh/). I have used Bash for about 30 years, so this was not done lightly. The killer plugin is [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions), which provides Fish-like suggestions. Very addictive.

1. Moved away from Firefox to the [Vivaldi Browser](https://vivaldi.com/). It took a bit of getting used to, but it seems to come with almost all the plugins/extensions that I require built in. The [Quick Commands](https://help.vivaldi.com/tutorials/quick-commands-for-beginners/) capability is excellent. I feel a bit sad as I realise that this is just Google Chrome re-skinned.

3. For my personal machine, I switched to running [Fedora Linux](https://getfedora.org/), as I have a love/hate relationship with Ubuntu. So far I am coping just fine, and it feels more developer friendly.

4. I learnt to use the Org Capture extension for [Vivaldi/Chrome](https://chrome.google.com/webstore/detail/org-capture/kkkjlfejijcjgjllecmnejhogpbcigdc) and Firefox. This was a game changer for me at work, as I can use it to track what web pages I need to review. I use [Org Mode](https://orgmode.org/) to run my work life.

5. I switched to [Counsel](https://github.com/abo-abo/swiper#counsel) from [Helm](https://emacs-helm.github.io/helm/). I was motivated when Helm was discontinued for a short period of time, and I found that Counsel _felt faster_ and worked for my use-cases. Note, I have not found a replacement for [helm-org-rifle](https://github.com/alphapapa/org-rifle#helm-org-rifle) to search my Org files.

6. I learn to use the [Hydra](https://github.com/abo-abo/hydra) package to create my own contextual menus in Emacs.

7. I use [Ledger](https://github.com/ledger/ledger) for tracking my finances. This year I embraced using the reporting capabilities in [ledger-mode](https://github.com/ledger/ledger-mode#ledger-mode), which dramatically improved my work-flow.

That's it.
Swapping two variables with XOR
Tags: python, programming, beginners
Published: 2020-12-20 01:57:16

I once got asked in an interview question what the following code does in Python:
```
a = a^b
b = b^a
a = a^b
```
I found it weird… It was a multiple choice question and my intuition said that this thing swapped the values of the variables (at least I was not mistaken). So I investigated further and now I explain it in my YouTube channel:

https://youtu.be/F27bOXIW-9M
Active Contours with OpenCV
Tags: rust, python, cpp, opencv
Published: 2020-12-20 01:17:21

During my last year of my undergraduate studies in Computer Science I did some work with automated drone control using something called [Active Contours](https://en.wikipedia.org/wiki/Active_contour_model). The contour algorithm used was [the research of my advisor](https://www.researchgate.net/publication/281864258_Anisotropic_Fractal_Snakes) and it was primarily my task to simply take information from said contour and translate it into drone controls. I didn't have to implement the algorithm, but it got me interested in Active Contours (snakes). 
A while back while waiting to hear back on a job opportunity I decided to play with C++ and OpenCV in an attempt to get under the hood of these snake algorithms. I knew that the variant we used for the project would be a little bit beyond me until I could nail down the fundamental aspects. During that time I implemented a C++/QT snake algorithm, [and it went pretty well](https://github.com/bosley/Active-Contours). 

The algorithm here is kind of lame. Its a simple energy minimization algorithm sourced from [this paper](https://www.cse.unr.edu/~bebis/CS791E/Notes/DeformableContours.pdf). 

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

```
    Energy = ∫(α(s)Econt + β(s)Ecurv + γ(s)Eimage)ds
```

Long story short, you take iterate over set of points and select a "neighborhood" of points around each looking for a spot that reduces the overall energy of the contour model. 

Having an itch to play with snakes again (a couple years later) I decided I might want to revisit the fundamentals and maybe see if I could make the snake a bit better. I couldn't decided if I wanted to use Rust (which I'm currently in love with) or Python (which would be slower, but a lot easier to get started). 

In order to figure out which I would want to do I obviously had to implement both and see which would be my target.

### Python

As you can imagine, Python was pretty simple. I used pip to install opencv and away I went. I got [the implementation] (https://github.com/bosley/PySnek) completed in about 45 minutes. It went well, but something about using Python for this task just rubs me wrong. 

### Rust

Getting started in Rust was a little bit harder. I had to use [opencv-rust](https://github.com/twistedfall/opencv-rust) and fight my Mac a little bit to get things building. Once I got it building I then had to sift through the documentation to see how everything works with the generated rust code for OpenCV. It took a couple of hours but [I got it working too](https://github.com/bosley/rcv-dev). 

### Next Steps

Now that I've implemented the simple algorithm in C++/Python/Rust I think I can say for certain that I understand well how it works. I'll definitely be continuing with Rust.. I just love it too much. I'm hoping that in the coming months I'll be on my way to making some improvements and maybe even tackle [Anisotropic Fractal Snakes](https://www.researchgate.net/publication/281864258_Anisotropic_Fractal_Snakes).
Quick Bash: Validate IP Address
Tags: bash, networking
Published: 2023-01-06 01:11:40

---
title: Quick Bash: Validate IP Address
published: true
date: 2020-12-20 01:15:24 UTC
tags: Bash,Networking
canonical_url: https://brandonrozek.com/blog/bashvalidateip/
---

`ipcalc` is a terminal tool that lets you validate an IP address. This proves useful to me as I have scripts that automate certain remote tasks given an IP address. Instead of trusting that an argument passed is a valid IP, why not check it?

First the script would need to check if `ipcalc` exists.

```
if ! command -v ipcalc > /dev/null ; then
    echo "ipcalc not found. Exiting..."
    exit 1
fi

```

Now for this example, we’ll validate an IP address stored in the variable `$IP`.

```
if ! ipcalc -cs "$IP" ; then
    echo "Invalid IP Address"
    exit 1
fi

```
Subtle Passions, Superb Career
Tags: codenewbie, programming
Published: 2020-12-20 01:13:37

Since a young age technology has always astonished me, I began to surround myself within its environment and it gave me an escape. I became an avid gamer at a young age and always wondered what went behind even the simplest aspects of games and apps and how they were made. I never imagined myself pursuing a career within technology however just like a return value all the items in my array contained technology. I went in to a career that was oriented more towards, hardware, servers and networking. While I was and am happy with such a career, I wanted to pursue the side of technology that gave me freedom and put me in an environment that racked my brain to find solutions like one of those impossible jigsaw puzzles. I viewed software engineering as art, and learning it would make me an artist and allow me to put my signature on the work I did. I sought out many ways to achieve this goal of mine and after much research and months of contemplating I ended up at Flatiron school. I wanted to turn my passion in to a career and I needed to learn the fundamentals which I now have the opportunity taking this course. Becoming a software engineer will give me all the tools I need in order to create and it will allow for me to be expressive and part of at team, This is something I have always sought for and I can never be sad at a job that was always a hobby and passion of mine.
The Sylar Project V 0.0.2
Tags: dohackathon, webdev, mentalhealth
Published: 2020-12-20 00:58:26

Day 2 of working on my project for this hackathon. Today I was able to get quite a lot done:

- There is now at least one resource for every state in the US as well as Washington DC
- I had my first outside pull request after open sourcing this! I merged it in - it was to add a file for data for mental health resources in India. Once there is at least 5 resources in there I will create a page to choose a country and build out the India Page
- I added a changelog, mit licence, updated the readme, and added a code of conduct.
- Fixed up some styling issues 
- Added a digital ocean deploy button 


My hope is that others might fork this and deploy their own versions of The Sylar Project for their local communities or their countries. 

I've opened up some issues on the github repository so if you would like to contribute the issues can be found below:

https://github.com/Rahat-ch/The_Sylar_Project/issues

If it's your first time doing anything with open source feel free to reach out and I'll be happy to pair with you on your first pull request!

https://the-sylar-project-6avzk.ondigitalocean.app/

https://github.com/Rahat-ch/The_Sylar_Project
kill processes with fzf
Published: 2020-12-20 00:55:28

![fkill](https://chunk.io/cirrus/7531d150830140e9999c7cf17eee5563.png)


we can use a shell function, in this case im using zsh
# fkill - kill process
``` 
fkill() {
  pid=$(ps -ef | sed 1d | fzf -m --ansi --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 40%  --border=sharp --prompt="➤  " --pointer="➤ " --marker="➤ " | awk '{print $2}')

  if [ "x$pid" != "x" ]
  then
    kill -${1:-9} $pid
  fi
}
select_file() {
	given_file="$1"
	#fd --type file --follow --hidden --exclude .git | fzf --query="$given_file"
	fzf --query="$given_file"
}
```
or call a script directly

```
#!/usr/bin/bash

## uncomment lines 4-11 then add to zsh keybinds (default is ctrl+k)
#use fzf to kill proccesses
## fkill_widget() {
## sh $HOME/scripts/fkill     # call fkill script locus
##  zle reset-prompt      
## }
## zle -N fzf-redraw-prompt    # give me my $PS1 back
## zle -N fkill_widget
## bindkey '^k'  fkill_widget    #ctrl+k

################ fkill script start ###########


	if [ "$UID" != "0" ]
	then
		pid=$(ps -f -u $UID | sed 1d | fzf -m --ansi --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 30%  --border=sharp --prompt="➤  " --pointer="➤ " --marker="➤ " | awk '{print $2}') 
	else
		pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') 
	fi
	if [ "x$pid" != "x" ]
	then
		echo $pid | xargs kill -${1:-9}
	fi

############## fkill script end  #############

```

Download [script](https://paste.xinu.at/9euA/ "fkill") inline link.
Head start with CSS Pseudo Elements
Tags: html, css, beginners
Published: 2020-12-20 00:28:08

Sometimes style a specific part of an HTML element like the first letter of h1 or append at begin or after, style the first line, my default solution is use JavaScript but not is the best approach if CSS provide a way to solve with Pseudo elements.

The pseudo elements help us style a specific part of HTML element, you can read all about it in [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements) or just continue reading.

## Using pseudo elements

The pseudo elements start with ::  if you are using vscode it shows all pseudo elements, I will implement some of them in.

```html
<main>
	<h1>Pseudo elements</h1>
	<p>I use javascript for some DOM Changes.</p>
	<p>I use Javascript to add some effects.</p>
</main>
```

- Add some text at begin of paragraph using ::before 
- Add ... at end of paragraph ::after 
- Change the color and size for the first letter using ::first-letter
- Change the color of selection text and letter color using ::selection
- Take first line and add some style.
Let'ts go!

### ::before 
The `::before` helps to do some change at the beginning of some selector, for example selector `p::before` we can add some text using content property.

```css
p::before {
	content: "At begin.. "
}
``` 
{% jsfiddle https://jsfiddle.net/danywalls4/bpjm1vs6/18/ result,html,css %}

## ::after

The `::after` is a bit similar to `::before`, it helps to do some change at the end of some selector. For example the `p::after` selector add extra dots using `content` property.

{% jsfiddle https://jsfiddle.net/danywalls4/bpjm1vs6/19/ result,html,css %}

## ::first-letter

The `::first-letter` takes the first letter of the selector. 

{% jsfiddle https://jsfiddle.net/danywalls4/bpjm1vs6/20/ result,html,css %}

## ::selection

The `::selection`helps to change the style of the selection of text, for example we change the color of the selected text and also the selection background.

{% jsfiddle https://jsfiddle.net/danywalls4/bpjm1vs6/21/
result,html,css %}

## ::first-line
The pseudo elements can be mixed with pseudo class, using pseudo class we skip first p and the first line change the color and size.

{% jsfiddle https://jsfiddle.net/danywalls4/bpjm1vs6/30/
result,html,css %}

## That's it!
Hopefully, that will give you a bit of help css and pseudo elements. 

If you enjoyed this post, share it!

> Photo by Pooja Chaudhary on Unsplash
MVP
Tags: testing, dohackathon, webperf, performance
Published: 2020-12-20 00:21:09

As you aware, I am developing [Explain JMeter](https://explain-jmeter-krxsh.ondigitalocean.app/) app. Yesterday I deployed another commit with some fixes and cleaned up few stuffs.

I have got couple ideas which will be implemented over weekend.

Happy Weekend :)
How to remove a file asynchronously using Node.js?
Tags: node
Published: 2020-12-20 00:00:00

---
  title: How to remove a file asynchronously using Node.js?
  published: true
  tags: Nodejs
  date: Sun Dec 20 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/remove-file-asynchronously-using-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-1c079dc77dc9298fa7d3d2c9620ab44c.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/remove-file-asynchronously-using-nodejs)
  
To remove a file, we can use the `unlink()` function from the `fs` (filesystem) module Node.js. This will asynchronously remove the file.

```js
// Remove file asynchronously
fs.unlink("file.txt", () => {
  console.log("Successfully deleted file!");
});
```

For exampe let's consider a file called `file.txt` like this,

```js
// require fs module
const fs = require("fs");

// path
const path = "file.txt";
```

Now let's use the `fs.unlink()` function and

- pass the path as the first argument
- and an error first callback function as the second argument

to the function like this,

```js
// require fs module
const fs = require("fs");

// path
const path = "file.txt";

// remove file by passing path
// as the first argument to the function
fs.unlink(path, (error) => {
  // if any error
  if (error) {
    console.error(error);
    return;
  }

  console.log("Successfully deleted file!");
});
```

See this example live in [repl.it](https://repl.it/@melvin2016/remove-file-async-nodejs#index.js).

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

---
An Incredibly Serious Discussion about Next.js at Reactathon
Tags: nextjs, blogvent, react, reactathon
Published: 2020-12-21 06:24:37

---
title: An Incredibly Serious Discussion about Next.js at Reactathon
published: true
date: 2020-12-20 00:00:00 UTC
tags: nextjs, blogvent, react, reactathon
canonical_url: https://www.netlify.com/blog/2020/12/20/an-incredibly-serious-discussion-about-next.js-at-reactathon/
---

Welcome to Blogvent, day 20!

Last week, Netlify sponsored [Reactathon](https://www.reactathon.com/), and we had a blast getting to know other developers in the community in our topic tables and around the event.

One of the talks was given by yours truly, and it was a very, very serious discussion about Next.js, its capabilities, and… maybe a _little_ bit of fun things too.

{% youtube -rQnm-B370U %}

## Wow! Can I see more?

Of course you can! [Here is the repo from the talk](https://github.com/cassidoo/next-prankz).
If you’d like to learn how to write Next.js, we have a Mission just for you on [Jamstack Explorers](https://explorers.netlify.com/learn/nextjs?utm_source=blog&utm_medium=nextjsmission-cs&utm_campaign=devex)!

And [here’s a starter project for Next.js](https://github.com/cassidoo/next-netlify-starter) if you’d like to get coding:

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/cassidoo/next-netlify-starter&utm_source=blog&utm_medium=nextstarterreactathon-cs&utm_campaign=devex)

(Clicking this button will deploy a Next.js starter project to Netlify, and clone it to your chosen Git provider)
Azure Functions University - Deployment Lesson (.NET Core)
Tags: azure, serverless, programming, dotnet
Published: 2022-03-16 20:04:01

---
title: Azure Functions University - Deployment Lesson (.NET Core)
published: true
date: 2020-12-20 00:00:00 UTC
tags: azure, serverless, programming, dotnet
canonical_url: https://blog.marcduiker.nl/2020/12/20/azfuncuni-deployment-lesson-dotnet.html
series: Azure Functions University
---

![Deployment Lesson .NET Core](https://blog.marcduiker.nl/assets/2020/12/20/AzureFunctionsUniversity_Deployment_Lesson_dotnetcore.png)

Hi serverless friends, we have a new Azure Functions University lesson for you! In this lesson we will learn how to deploy Azure Functions written in .NET Core 3.1.

<!--more-->
## Lesson

You can find the lesson on GitHub: [Deployment to Azure (.NET Core)](https://github.com/marcduiker/azure-functions-university/blob/main/lessons/dotnetcore31/deployment/README.md).

And you can watch the video on YouTube:
{% youtube -B8dE4GTWsk %}

The lesson consists of the following exercises:

| Nr | Exercise |
| --- | --- |
| 0 | Prerequisites |
| 1 | Understanding the Azure Resources |
| 2 | Deployment using VSCode |
| 3 | Creating Azure Resources using Azure CLI |
| 4 | Deployment using Azure Functions CLI |
| 5 | Deployment using GitHub Actions |
| 6 | Homework |
How to Remove Last Character from a String in JavaScript
Tags: function, javascript, howto
Published: 2022-12-20 20:59:26

---
title: How to Remove Last Character from a String in JavaScript
published: true
date: 2020-12-20 00:00:00 UTC
tags: Function,JavaScript,HowTo
canonical_url: https://ahonerd.com/js-remove-last-character
---

Cara untuk menghilangkan karakter terakhir dari sebuah string dalam JavaScript.


## `slice()` Method

Berikut ini adalah contoh penggunaan `slice()`:

```js
const string1 = 'Aho dakara'
const string2 = string1.slice(0, -7)
const string3 = string1.slice(5, -1)
const string4 = string1.slice(5, 9)
const string5 = string1.slice(4)
const string6 = string1.slice(99)

console.log(string1.length) // 10
console.log(string2) // "Aho"
console.log(string3) // "akar"
console.log(string4) // "akar"
console.log(string5) // "dakara"
console.log(string6) // ""
```

Berikut ini adalah contoh penggunaan `slice()` untuk menghilangkan karakter terakhir dari sebuah string:

```js
const url = 'https://ahonerd.com/'
const path = '/about'

console.log(url + path) // https://ahonerd.com//about

const url1 = url.slice(0, -1)

console.log(url1 + path) // https://ahonerd.com/about
```

## Syntax

```js
string.slice(start)
string.slice(start, end)
```

## Parameters

- `start`

  Index posisi karakter pertama yang akan diikutsertakan pada hasil (*returned substring*)

- `end`

  Index posisi karakter pertama yang tidak diikutsertakan pada hasil (*returned substring*).

  Parameter ke-2 ini sifatnya optional.

## Return value

Bagian string yang diekstrak `type: string`

## Reference

[developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice)

[w3schools.com](https://www.w3schools.com/jsref/jsref_slice_string.asp)
Preparing for Technical Interviews
Published: 2020-12-19 23:36:03

After a few less than ideal interviews, I've learned a little about what to expect, and how to prepare.

# Code Challenges

Code challenges typically involve improving/altering a project provided by the employer in advance of a technical interview.

While it's important to pay careful attention to the requirements, and complete each task, be sure to take additional time to look over areas of the codebase which you may otherwise not need to bother with.

During the interview, the interviewer will usually, in addition to asking for a thorough explanation of your solution, ask you to explain how previously implemented components of the system work.

# Interviewing

During the interview, you will be asked to create solutions to multiple problems, and often they will ask you to solve these problems with a specific feature of the language you are leveraging.

Have you not used map, filter or reduce in a while? Go back and jog your memory because, although most interviewers will allow you to search for the solution, it is far better to avoid stumbling around.

If the position you're applying for requires working with a specific framework, be sure that you understand a little about how the framework works under the hood. For example, what is the virtual DOM concerning React?

# Conclusion

Much of this seems like common sense, but it's easy to forget about certain programming strategies if you don't need to use them consistently. If you have an interview coming up, it pays to revisit the basics.
Nuxt.js + Tailwind 2.0
Tags: nuxt, vue, tailwindcss
Published: 2020-12-19 23:31:57

In the post, i'm going to explain how to use the new Tailwind 2.0 with Nuxt.js.

By default, when you create a new Nuxt project, it comes with tailwind 1.X. To utilize the new Tailwind 2.0 and it's new classes you'll need to make some changes.

As of writing this post. There is a PR out for Nuxt and Tailwind 2.0, there's currently an issue because Nuxt 2.14 still uses PostCSS 7. Tailwind 2.0 requires PostCSS 8. You can checkout the PR [here](https://github.com/nuxt-community/tailwindcss-module/pull/203).

The good people over at Tailwind have made a compatibility build, allowing us to use PostCSS 7 with Tailwind 2. Nuxt 2.15 should be using PostCSS 8 but again, as of writing this, Nuxt 2.14 is using PostCSS 7.

What I did to get Tailwind 2.0 working on a fresh project is the following:

Run `create-nuxt-app tailwind-v2` to create a project.

I answered the following:

```
> Project name: tailwind-v2
> Programming language: JavaScript
> Package manager: Yarn
> UI framework: Tailwind CSS
> Testing framework: None
> Rendering mode: Universal (SSR / SSG)
> Deployment target: Server (Node.js hosting)
```

This will create a new project, but using Tailwind 1.X, I then went on to do the following:

```
yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
```

This will add the compatibility build to your project.

I then ran `npx tailwind init` to generate a tailwind.config.js and added the new `tailwind/forms` package required in tailwind 2.0 for the form styling to test it out.

My `tailwind.config.js` just looks like this for the demo project.

```javascript
module.exports = {
  purge: [],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [
    require('@tailwindcss/forms'),
  ],
}

```

And that's basically it.

Run `yarn dev` in your terminal and then head-over to [https://tailwindui.com](https://tailwindui.com) to test out the new pre-built Tailwind 2.0 components.