teleren/devto huggingface dataset:
⚙️ ❮ Zsh-Startify ❯
Tags: zsh, tooling, vim, shell
Published: 2022-02-11 02:22:56

<div align="center">
  <a href="https://github.com/z-shell/zi">
  <img src="https://raw.githubusercontent.com/z-shell/zi/main/docs/images/logo.png" alt="Logo" width="60" height="60"><img/></a>

[https://z.digitalclouds.dev](https://z.digitalclouds.dev) | [GitHub](https://github.com/z-shell) | [Twitter](https://twitter.com/zshell_zi)

</div>

---

A plugin that aims at providing what [vim-startify](https://github.com/mhinz/vim-startify) plugin does, but in Zsh. The analogy isn't fully easy to make. `vim-startify` states - it provides dynamically created headers or footers and uses configurable lists to show recently used or bookmarked files and persistent sessions.



## Zsh Startify overview



- Shows recently used files if used by a shell-util command, with name of the command(s) on other right
- Shows recently used vim files
- Show active tmux sessions
- Show statistics of most popular aliases in use
- Show recently visited projects e.g: `git` repositories, and directories with:
  - `Makefile`,
  - `CMakeLists.txt`,
  - `configure` script.
- Very advanced feature, inherited from `zsh-startify`'s predecessor: `z-shell/zaccumulator` plugin
- Show recently ran `git` commands, with analysis of e.g. recently checked-out branches
- Can cooperate with any bookmarking plugins to show their bookmarks



## Quick Start



`zsh-startify` accumulates data in its own history file. To pre-fill it quickly with a few of entries (basing on the regular history) you can run the `__from-zhistory-accumulate` command.



## Zstyles for Startify



The zstyles used to configure the plugin (add such commands anywhere in the `zshrc`):


```shell
zstyle ":plugin:zsh-startify:shellutils" size 5  # The size of the recently used file list (default: 5)
zstyle ":plugin:zsh-startify:vim" size 5         # The size of the recently opened in Vim list (default: 5)
```


## Startify installation with ZI


Option A – normal load without turbo mode.


```shell
zi ice atload'zsh-startify'
zi load z-shell/zsh-startify
```


Option B – a load with turbo mode.



```shell
zi ice wait'0' lucid atload'zsh-startify'
zi load z-shell/zsh-startify
```


The first option (A) loads the plugin synchronously, at the time of execution of the `zi load ...` command. The second option (B) loads in an asynchronous manner, 0 seconds after the prompt being first displayed.


## Other Startify installations


Issue the regular loading command of your plugin manager, pointing it to `z-shell/zsh-startify`. Then, add invocation of `zsh-startify` to the end of `~/.zshrc`.
⚙️ ❮ ZTrace ❯
Tags: zsh, tooling
Published: 2022-02-11 02:00:00

<div align="center">
  <a href="https://github.com/z-shell/zi">
  <img src="https://raw.githubusercontent.com/z-shell/zi/main/docs/images/logo.png" alt="Logo" width="60" height="60"><img/></a>

[https://z.digitalclouds.dev](https://z.digitalclouds.dev) | [GitHub](https://github.com/z-shell) | [Twitter](https://twitter.com/zshell_zi)

</div>

---

`Ztrace` plugin allows to catch output of commands in background.
By issuing:

```zsh
ztstart 3
```

We inform `Ztrace` to catch output of `3` commands.

Video: https://asciinema.org/a/45530

[![asciicast](https://asciinema.org/a/45530.png)](https://asciinema.org/a/45530)

## Installation

### ❮ [ZI](https://z-shell.pages.dev/) ❯

Add `zi load z-shell/ztrace` to your `.zshrc` file. zi will handle
cloning the plugin for you automatically the next time you start zsh.

### [Antigen](https://github.com/zsh-users/antigen)

Adding `antigen bundle z-shell/ztrace` to your .zshrc file. Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running zsh with `antigen bundle z-shell/ztrace` for testing before adding it to your `.zshrc`.

### [Oh-My-Zsh](http://ohmyz.sh/)

1. `cd ~/.oh-my-zsh/custom/plugins`
2. `git clone git@github.com:z-shell/ztrace.git`
3. Add zsnapshot to your plugin list

### [Zgenom](https://github.com/jandamm/zgenom)

Add `zgenom load z-shell/ztrace` to your .zshrc file in the same function you're doing your other `zgen load` calls in.

## More information

Below are keyboard shortcuts used by `ztrace` command:

- `Ctrl-T` - start Zsh Command Architect (Zshell binding)
- `Ctrl-E` - switch between Ztrace and History views
- `Enter` - delete selected segment (when in command window) or add selected segment (when in history window)
- `[` or `]` - move active segment (when in command window)
- `Shift-left` or `Shift-right` - move active segment (when in command window)
- `Tab` - switch between the two available windows
- `g, G` - beginning and end of the list
- `/` - start incremental search
- `Esc` - exit incremental search, clearing filter
- `<`,`>`, `{`,`}` - horizontal scroll
- `Ctrl-L` - redraw of whole display
- `Ctrl-O`, `o` - enter uniq mode (no duplicate lines)
- `Ctrl-W` (in incremental search) - delete whole word
- `Ctrl-K` (in incremental search) - delete whole line
- `Ctrl-D`, `Ctrl-U` - half page up or down
- `Ctrl-P`, `Ctrl-N` - previous and next (also done with vim's j,k)
Freelancing - 10 Ways Developers Make Money Coding Course - E07
Tags: career, javascript, beginners, programming
Published: 2022-02-11 00:00:40

You can work for different types of clients from different countries while working from home.

You may know that the websites like freelancer, Fiverr & Upwork provide you with such opportunities.

If you can make yourself a brand, then there are many more opportunities for you like contacting direct clients, getting clients from Linked In and Twitter.

In this video series, I share the best ways and how to increase your money income as a web developer while working from home.

📽️ Video here - https://youtu.be/JjGTrdJkiJs

👉 Subscribe to Dan Later - https://bit.ly/31SdiZv

💻 Personal website post - https://danfleser.com/posts/20220204024943-freelancing-10-ways-developers-make-money-coding-course-e07
How to convert the first letter of a string literal type into a lowercase format or uncapitalize in TypeScript?
Tags: typescript
Published: 2022-02-11 00:00:00

---
  title: How to convert the first letter of a string literal type into a lowercase format or uncapitalize in TypeScript?
  published: true
  tags: TypeScript
  date: Fri Feb 11 2022 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/convert-first-letter-string-literal-type-lowercase-format-or-uncapitalize-typescript
  cover_image: https://melvingeorge.me/_next/static/images/main-4e96fadeabe3d5dc6aa6fd9554327874.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/convert-first-letter-string-literal-type-lowercase-format-or-uncapitalize-typescript)
  
To convert the first letter of string literal type into a lowercase format or uncapitalize, you can use the built-in `Uncapitalize` type that comes with TypeScript.

### TL;DR

```ts
// string literal type
type Greeting = "HELLO WORLD";

// convert first letter of
// string literal type
// into lowercase format or uncapitalize
type GreetingUncapitalized = Uncapitalize<Greeting>; // hELLO WORLD
```

For example, let's say we have a string literal type like this,

```ts
// string literal type
type Greeting = "HELLO WORLD";
```

Now to uncapitalize the string literal type let's use the `Uncapitalize` built-in type and pass the `Greeting` type into it using the angled bracket (`<>`) syntax.

It can be done like this,

```ts
// string literal type
type Greeting = "HELLO WORLD";

// convert first letter of
// string literal type
// into lowercase format or uncapitalize
type GreetingUncapitalized = Uncapitalize<Greeting>; // hELLO WORLD
```

Now if you hover over the `GreetingUncapitalized` type you can see that the `HELLO WORLD` string literal type is now uncapitalized. Yay 🥳.

See the above code live in [codesandbox](https://codesandbox.io/s/convert-first-letter-string-literal-type-lowercase-format-or-uncapitalize-typescript-ifif9r?file=/src/index.ts).

That's all 😃!

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

---
OpenTelemetry tracing with nodejs and express
Tags: opentelemetry, node, express, javascript
Published: 2022-02-11 20:49:04

---
title: OpenTelemetry tracing with nodejs and express
published: true
date: 2022-02-11 00:00:00 UTC
tags: OpenTelemetry,nodejs,express,javascript
canonical_url: https://www.mourtada.se/opentelemetry-tracing-with-nodejs-and-express/
---

In this post I’ll go through a simple example on how to setup OpenTelemetry tracing in a nodejs express application.

## Hello world express

```
// index.js
const express = require("express");

const app = express();
const port = 3000;

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});

```

## Needed packages

First we need to add the OpenTelemetry api and sdk package

```
yarn add @opentelemetry/api @opentelemetry/sdk-node

```

To instrument express, incoming and outgoing http requests we use the express and http instrumentation libraries.

```
yarn add @opentelemetry/instrumentation-http @opentelemetry/instrumentation-express

```

And lastly we add the otlp grpc tracing exporter.

```
yarn add @opentelemetry/exporter-trace-otlp-grpc

```

## Setup tracing

```
// tracing.js
const OpenTelemetry = require("@opentelemetry/sdk-node");
const Resources = require("@opentelemetry/resources");
const SemanticConventions = require("@opentelemetry/semantic-conventions");
const InstrumentationHttp = require("@opentelemetry/instrumentation-http");
const InstrumentationExpress = require("@opentelemetry/instrumentation-express");
const ExporterTraceOtlpGrpc = require("@opentelemetry/exporter-trace-otlp-grpc");

const sdk = new OpenTelemetry.NodeSDK({
  resource: new Resources.Resource({
    [SemanticConventions.SemanticResourceAttributes.SERVICE_NAME]: "my-service",
  }),
  traceExporter: new ExporterTraceOtlpGrpc.OTLPTraceExporter({
    // url is optional and can be omitted - default is localhost:4317
    url: process.env["OTEL_EXPORTER_OTLP_ENDPOINT"] || undefined,
  }),
  instrumentations: [
    new InstrumentationHttp.HttpInstrumentation(),
    new InstrumentationExpress.ExpressInstrumentation(),
  ],
});

sdk.start();

```

# Run the express server

To configure and start the tracing sdk we can use nodes `-r/--require` flag to preload our tracing module.

```
node -r ./tracing.js index.js

```

Now every request will be traced and exported to the configured otlp receiver.
Work from the bottom up
Tags: tdd, unittests
Published: 2022-02-21 16:13:54

---
title: Work from the bottom up
published: true
date: 2022-02-11 00:00:00 UTC
tags: tdd,unittests
canonical_url: https://jhall.io/archive/2022/02/11/work-from-the-bottom-up/
---

Last week I talked about a snafu I made while [copy-and-pasting some tests](https://jhall.io/archive/2022/02/05/the-importance-of-seeing-red/). When I mentioned this same story [on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:6894757550479216640/), I was pointed to a nifty trick which comes from [Woody Zuill](https://woodyzuill.com/):

## Work from the bottom up

That is to say, when you copy a test for use against a new function, start at the bottom of the copied function, and work your way up making changes. Then change the name of the copied function last.

If I had followed this simple advice, I would not have encountered my problem.

Thanks Woody, for the simple hacking hack!

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Day 528 : Matrix
Tags: hiphop, code, coding, lifelongdev
Published: 2022-02-10 23:06:12

_liner notes_:
- Professional : Not a bad day. Had a few back to back meetings. Then I followed with a question from the community. That led me to update a repo with some updated instructions and some code. I guess some changed with a recent update. Then I started a content review of a blog post someone wrote. Day went by super quick. Oh and I also submitted the promo video for the workshop I'm doing next week. Hope it helps with promotions.

- Personal : So I bought a thing last night, haha. I saw the release event for the Samsung Galaxy S22 Ultra. Looked cool, but I already have my Galaxy Z Fold 3. Then I got an email from Google Fi (I have another phone line for when I travel abroad) and they are running a pretty good deal that includes a discount on the phone and a lot of bill credits. It effectively bought down the phone to a pretty good price. I got a 0% payment plan and it's basically what I pay each month for Google Fi, and the bill credits should last me a while. A couple of other factors is that my current Google Fi phone is a few years old and the Samsung Galaxy S22 Ultra reminds me of the Note, which I'm a fan of, especially the S Pen. These phones are getting more and more powerful. Can't wait to get trapped in the matrix. haha Plus they were really touting the quality of photos and videos that it can take. Could be really handy for when I start travelling. Now, I just hope I can get it in time for when I'm supposed to head overseas. The delivery date is super close to when I'm supposed to leave. I paid for express shipping and have over a month, so hopefully I can get it in time. The other phones announced said they will be available Feb. 25th. Fingers crossed. Other than that, I went through some tracks for the radio show, worked on my side project and watched a couple of episodes of "Demon Slayer".

![A path through a forest in Barajul Tarnita, Romania with a branch in the foreground and everything else blurred.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ad3vr7inwi05qqwsqgl.jpg)

Looking to do the same as last night. Go through tracks, work on radio show and watch anime. The side project's dashboard can add, list and edit data. Now I need to display that data and do stuff with it. So it's time to start on the front end. Did some quick layouts last night and will start making that happen.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 6Bz1h2Id7MA %}
Tauri 1.0 Release Candidate
Tags: tauri, programming, opensource, rust
Published: 2022-02-10 22:56:14


**tl;dr;**
We present the first release candidate of Tauri 1.0, and invite you to look at, comment upon, and try out the new features and security fixes that we are bringing to the table. After several RC iterations, we will release the stable version of 1.0.

https://github.com/tauri-apps/tauri/releases

---

## Our Working Method
Over the past 8 months, we have been working together with the community (in public), and third party Security Auditors and Pentesters [Radically Open Security](https://www.radicallyopensecurity.com/) (in private) to apply needed finish to Tauri Core. This includes not only usability features and fixing incomplete APIs, but also enhancing the overall security of the ecosystem and producing a number of official Tauri plugins.

## Progress
Our current top priority for 1.0 is delivering a smooth process for not only setting up Tauri requirements on all development platforms, but also the creation of new Tauri projects. To acheive this we need to test it on as many platforms as possible, squash any bugs during a few RC versions, and enhance all of the documentation.

## Usability
As developers ourselves, we want our tools to be ergonomic and easy to use without sacrificing on performance and security. One of the qualifying features that will enable us to release the stable 1.0 is a perfect tooling setup on all platforms without resorting to hacks or unsafe practices. We will be working on this over several iterations of the release candidates.

## Documentation
We know that building on Tauri has been a hit or miss experience for many of you, and much of this has to do with outdated documentation. At the same time, the matrix of possible installation platforms for developers makes a system that is in flux makes it really challenging to get right. 

## Security Features
The auditors made a number of findings, which we have resolved and which were accepted in the post-audit review of our fixes. We are now confident that Tauri core is safe, and that we have provided fixes and features that enable the production of industrial-grade secure applications. You may read the full audit report here:
https://github.com/tauri-apps/tauri/blob/next/audits/Radically_Open_Security-v1-report.pdf

## Next Steps
Please remember, that a release candidate seeks to qualify the codebase for a stable release. We are certain that we have missed things and probably have bugs. The complications of our CI mean that we will probably fight with the release process a few times. You may discover problems with the installation process, and even have minor issues with consuming the JS libraries. We are counting on you to help us solve (or at least discover) these concerns so they can be resolved and move Tauri as quickly as feasible to a full release.


---
<small>Image by [Alve](https://alve.io)</small>
A Nicer if-then-else Syntax in Prolog
Tags: prolog, dsl
Published: 2022-02-10 22:50:57

---
title: A Nicer if-then-else Syntax in Prolog
published: true
description: Build your own if-then-else syntax in Prolog
tags: prolog, dsl
//cover_image: https://direct_url_to_image.jpg
---

Prolog has an amazing syntax, thanks to it *both* being [homoiconic](https://en.wikipedia.org/wiki/Homoiconicity) *and* supporting custom operators. However, writing conditionals in Prolog is often a drag.

Fortunately, we don't have to convince or wait for Prolog implementations to implement a nicer syntax. Instead, we can create **our own** if-else syntax today!

## Example Usage

```prolog
%%
%% Before
%%
foo(X) :-
  (
    X > 50 ->
    Y is X * 2,
    bar(X, blah)
  ; baz(10, 20)
  ),
  last(X).

%%
%% After
%%
foo(X) :-
  if (X > 50) then (
    Y is X * 2,
    bar(X, blah)
  )
  else (
    baz(10, 20)
  ),
  last(X).

%%
%% Before
%%
shorter_foo(X) :- (X > 10 -> bar(X); baz(X)).

%%
%% After
%%
shorter_foo(X) :- if X > 10 then bar(X) else baz(X).
```

## Example Usage (`or` operator)

I also threw in a bonus `or` operator so you can do "or" logic without introducing additional [choice points](https://www.swi-prolog.org/pldoc/man?section=glossary#gloss:choice-point), *and* not have to worry about catching multiple terms (due to it having a stronger precedence than the comma `,` operator):

```prolog
%%
%% Before
%%
multi_foo(X, Y) :- (foo(X), !; bar(Y)).

%%
%% After
%%
multi_foo(X) :- foo(X) or bar(Y).

%%
%% Before
%%
multi_foo(X, Y) :-
  ((foo(X), !; bar(X)) ->
    Y = true
  ; Y = false
  ).

%%
%% After
%%
multi_foo(X) :-
  if (foo(X) or bar(X)) then (
    Y = true
  )
  else (
    Y = false
  ).
```

## The Code

Here's the code you can copy/paste into your own project to make use of this sweet, sweet syntax.

There may even be a better way using [`term_expansion`](https://www.swi-prolog.org/pldoc/man?section=progtransform). If you find one, leave it in the comments!

```
:- op(990, fx, if).
:- op(985, yfx, then).
:- op(985, yfx, else).
:- op(985, yfx, elseif).
:- op(800, xfx, or).

if(X) :- (if_then(X, Then) -> call(Then); true).

if_then(then(elseif(Try, Cond), MaybeThen), Then) :-
  !,
  (if_then(Try, Then) -> true; call(Cond), Then = MaybeThen).

if_then(then(Cond, Then), Then)  :-
  !,
  call(Cond).

if_then(else(Try, MaybeThen), Then) :-
  !,
  (if_then(Try, Then) -> true; Then = MaybeThen).

or(X,Y) :- call(X) -> true; call(Y).
```
A Cryptocurrency That Can Be Mined With a Arduino?
Tags: arduino, blockchain, beginners, tutorial
Published: 2022-02-10 21:42:19

Yes you read the title right. There is a cryptocurrency that can be mined with the arduino. This cryptocurrency is called Duino Coin or DUCO. Its a somewhat new cryptocurrency that operates on the ERC-20 chain. Its very easy to mine and I will tell you how to do that. 

## A Little Info

The cryptocurrency duino coin was designed so that there would be low electricity costs and be eco friendly. Its very simple and easy to use. All you have to do is go to the website [https://duinocoin.com](https://duinocoin.com) and click web wallet or get started make a wallet and then follow the next steps. 

## Mining Duino Coin

If you want to mine duino coin you should not mine it with high end hardware. You want to mine it with low end hardware such as the arduino uno or raspberry pi pico. The reason for this is duino coin aims to be a eco-friendly cryptocurrency so they reward you with less crypto than you would get mining with a 5 dollar computer so that you dont use as much energy mining with a expensive pc. This is truly a great thing to do and you should give duino coin a look. The steps to mining duino coin are fairly simple. Download their repo which [you can do right here](https://github.com/revoxhere/duino-coin/archive/refs/heads/master.zip). Then install arduino which I will have a article on my site for and setup your arduino with the program. Once your arduino has the mining program installed launch the avr miner program and watch yourself mine duino coin on a small board that uses pretty much no electricity. And if you want to take this even further you can setup a standalone mining rig which can be found in their getting started page.
Mining on a raspberry pi? The setup is simple. Use the following command and it will install everything for you. 

`cd
wget https://raw.githubusercontent.com/Grantrocks/duino-coin/master/Tools/duco-install-rpi.sh
sudo chmod a+x duco-install-rpi.sh`

Let me know how this script worked for you because I am trying to add it to the official duino coin repository for everyone to use too.

Please follow and go check [out my website](https://cryptoandpi.cf).
Group Points
Tags: 100daysofcode, cpp, algorithms, programming
Published: 2022-02-10 21:30:07

https://binarysearch.com/problems/Group-Points

# Description

You are given a two-dimensional list of integers `points` and an integer `k`. Each list in `points` is of the form `(x, y)` representing Cartesian coordinates. Assuming you can group any point `a` and `b` if the Euclidean distance between them is `≤ k`, return the total number of disjoint groups.

Note that if points `a` and `b` are grouped and `b` and `c` are grouped, then `a` and `c` are in the same group.

**Constraints:** 

- `n ≤ 1,000` where `n` is length of `points`.

## Example 1

### Input

```
points = [
    [1, 1],
    [2, 2],
    [3, 3],
    [10, 10],
    [11, 11]
]
k = 2
```

### Output

```
2
```

### **Explanation**

```
There are two groups:

[1,1],[2,2],[3,3]
[10,10],[11,11]
```

---

# Intuition

Union Find

# Implementation

```java
int p[10003];
int find(int x) {
    if (p[x] != x) {
        p[x] = find(p[x]);
    }
    return p[x];
}

double distance(vector<int> a, vector<int> b) {
    return sqrt(pow(a[0] - b[0], 2) + pow(a[1] - b[1], 2));
}
int solve(vector<vector<int>>& points, int k) {
    int n = points.size();

    for (int i = 0; i < n; i++) {
        p[i] = i;
    }

    int groups = n;
    for (int i = 0; i < n; i++) {
        vector<int> a = points[i];
        for (int j = i + 1; j < n; j++) {
            vector<int> b = points[j];
            if (distance(a, b) <= k && find(i) != find(j)) {
                p[find(i)] = find(j);
                groups--;
            }
        }
    }
    return groups;
}
```

## Time Complexity

- Time: O(n^2)
- Space: O(n)
Remove elements from list in for loop
Tags: python, loop, list
Published: 2022-02-10 21:12:24

We have list like,
```
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
```

We want to delete elements from the list while iterating over it,based on some conditions , for example you want to delete only even numbers. For this, we need first to create a copy of the list, and then we will iterate over that copied list. Then for each element, we will check if we want to delete this element or not. If yes, then delete that element from the original list using the remove() function. For example,

```
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for elem in list(nums):
    if elem % 2 == 0:
        nums.remove(elem)
print(nums)
```

output:

```
[1, 3, 5, 7, 9, 11, 13]
```