teleren/devto huggingface dataset:
How to implement TOC in Astro?
Tags: markdown, astro, toc
Published: 2022-11-17 02:01:00

---
title: How to implement TOC in Astro?
published: true
description: A big part of Markdown is that it's great to write articles and not worry about the markup... Tagged with astro, markdown.
tags:
- markdown
- astro
- toc
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2022-11-17 02:01 +0000
---

I am writing (rewriting) my blog from Nextjs to Astro because I feel it's better to manage with Markdown files.

And one of the features I require in some of my posts or notes is to have a table of contents (TOC). Because some posts are quite long.

Looking in google I found a [post](https://dev.to/dailydevtips1/adding-a-toc-in-astro-4keh) where there were some instructions to do it, unfortunately the implementation is deprecated :(.

Here are the steps I followed to implement TOC in my posts (md and mdx):

## Installation

```bash
npm i rehype-slug rehype-toc rehype-autolink-headings rehype-stringify remark-toc
```

## Create markdown.config.ts file
this because it needs to implement for md and mdx files.

```ts
import remarkToc from "remark-toc";
import rehypeToc from "rehype-toc";

export default {
  remarkPlugins: [[remarkToc, { tight: true, ordered: true }]],
  rehypePlugins: [
    [
      rehypeToc,
      {
        headings: ["h1", "h2", "h3"],
        cssClasses: {
          toc: "toc-post", 
          link: "toc-link", 
        },
      },
    ],
  ],
};

```

## Add to astro.config file

```ts
...
import markdownConfig from './markdown.config'

export default defineConfig({
  markdown: markdownConfig,
  integrations: [
    mdx({
      ...markdownConfig,
      extendPlugins: false,
    }),
  ]
});

```

I hope it will be of great help.
Applying reduce to a list with no element. Oops.
Tags: dart, flutter
Published: 2022-11-17 01:55:21



I have the following code. Getting datetimes from a list of a model, removing a datetime if the date is today, and gaining the max value, is simple functional programming. It works fine, but sometimes 'No element' exception occurs.

`
var maxDate = list
//removing today's data.
.where((e) => !Util.isSameDay(e.datetime, DateTime.now()))
.map((e) => e.datetime)
// getting the max value.
.reduce((v, e) => v.isAfter(e) ? v : e);
`

At first, I didn't figure out what the problem is. I spent some time trying to solve it.

The reason is simple. The reduce document says

>The iterable must have at least one element

So, following the above code, we sometimes have a list with no element before we apply the reduce function.

I know how to use the reduce function, but I completely forgot the specification when I coded.

I use Android Studio, which is really awesome, but I hope the code inspector warns of such the code.
Job Search API
Tags: api, job, dataengineering, jobsearch
Published: 2022-11-17 01:49:37

#### The purpose of this project is to get data using api.

#### This is my first project using api to get data

#### I did this project with guidance from [365 Data Science](https://learn.365datascience.com/courses/web-scraping-and-api-fundamentals-in-python)

#### Link to the API Documentation I used [Job Search API](https://jsearch.p.rapidapi.com/search)

#### Importing Necessary Libraries

```
import requests
import json

url = "https://jsearch.p.rapidapi.com/search"

querystring = {"query":"Data Analyst in Lagos, Nigeria","num_pages":"1"}

headers = {
    "X-RapidAPI-Key": "374e7caff4mshbdf0dc9feaf2c44p1807dfjsn55b29ff65a00",
    "X-RapidAPI-Host": "jsearch.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

respond = response.json()
```

```
# View the API result

print(json.dumps(respond, indent = 4))
```

```
# View the api keys

respond.keys()

Output
dict_keys(['status', 'request_id', 'data'])
```

```
# View the data key result

print(json.dumps(respond['data'][0], indent=4))
```

```
# View the request_id key

respond["request_id"]

Output
'3702f9d9-3f27-4d12-9224-6040141d9d83'
```
#### Turning data into tabular form with pandas with the api collection key (data)

```
import pandas
df = pd.DataFrame(respond['data'])
df
```

```
# Optional
# Remove the unecessary columns

data = df.drop(columns = ["job_description", "employer_logo","employer_website", "job_id",
                         "job_posted_at_timestamp", "job_posted_at_datetime_utc", "job_latitude",
                         "job_longitude", "job_google_link","job_offer_expiration_datetime_utc","job_experience_in_place_of_education",
                          "job_min_salary", "job_max_salary","job_salary_currency",
                          "job_salary_period", "job_highlights", "job_benefits"], inplace = True)
```
#### Transforming and saving data into a csv file format

```
df.to_csv (r'data.csv', encoding = 'utf-8', index = None)

job = pd.read_csv('data.csv')

job.head()
```

```
# Check the data info

job.info()
```
#### You should see your saved csv format in the file path you saved it into
Pinia for begginers
Tags: vue, pinia, beginners
Published: 2022-11-17 01:26:27

From a terminal run these commands :

`npm init vue@3 todo-app`

Choose Pinia

`cd todo-app`
`npm install`
`npm run dev`

Click localhost:5173

Now you have a Vuejs 3 App using Pinia as the store library.
Every programming tip I have after over 2 years of writing software:
Tags: programming, beginners, productivity
Published: 2022-11-17 01:18:09

1. Coding is the last step of the process

2. For solving problems:  Whiteboard > Keyboard

3. Coding without planning = Stress

4. You look smarter by being clear not clever.

5. Long term consistency > Short term intensity

6. Solution first. Optimization later.

7. Lot of programming is problem solving

8. Think of multiple solutions, before committing to one.

9. You learn by building projects not taking courses.

10. Always prefer simplicity. Simple solutions are easier to code.

11. Errors are inevitable in coding. They just tell you what not to do.

12. Failure is cheap in programming. Learn by doing.

13. Lot of programming is figuring out.

14. Pair programming will teach you a lot more than coding.

15. Take walks when stuck with debugging.

16. Make asking for feedback on your code a habit.

17. You lose 0 credibility by asking for help.

18. Time spent on understanding the problem is time well spent.

19. When stuck on the problem. Be curious, not frustrated.

20. Think of possible scenarios and edge cases before solving.

21. Don’t stress on programming syntax. Understand concepts.

22. Learn to use a good debugger. It pays off.

23. Know keyboard shortcuts of your text editor early.

24. Your code is as clear as you think.

25. You will spend 2x time on debugging than coding.

26. Good googling skills are valuable.

27. Read other people’s code for inspiration.

28. Join developer communities to learn with other programmers
There are over 27 million software engineers worldwide. These 25 lessons that will get you ahead 97% of them
Tags: programming, productivity, webdev, career
Published: 2022-11-17 01:12:25

1. Start applying for interviews before you think you are ready.

2. The tech world moves quickly. Make learning a habit.
 
3. Consistency and patience will help your career more than any technology.
 
4. Train your mind to see failure as feedback.

5. Building in public is the cheat code to new opportunities.
 
6. Getting a job with your network >>> Sending resumes.
 
7. Doing tutorials hide knowledge gaps. Building projects expose them

8. Working on a project that you are passionate about will 10x your learning.
 
9. Your time estimations will be way off. Underpromise and over-deliver.
 
10. Be comfortable with not knowing everything. Be confident that you will figure it out.

11. Career growth without acquiring soft skills can be hard.
 
12. Learning to ask for help is an underrated skill.
 
13. Learn googling. You don’t need to build what you can search for

14.Don’t fear mistakes. Fear not trying.
 
15. Avoid over-engineering as much. It will distract you from the main task.
 
16. You don’t need more courses. You need to build projects

17. You can only improve what you measure.
 
18. Make time to unwind and recharge.

19. A good portfolio brings contacts, clients and potential employers

20. Knowing how to code is not enough. You need to create something.

21. You learn by *finishing* projects, not by starting them.

22. Working on an exciting project is a form of self-care.

23. You learn a lot by just open sourcing your project.

24. You can’t do everything in a day. Plan and schedule work.

25. It’s ok to not know everything. Learn to take things 1 at a time
What is HELM, why do you need it & what problem does it solve for Kubernetes?
Tags: helm, kubernetes
Published: 2022-11-17 01:08:40

A blog on the use and relevance of Helm

[What is HELM, why do you need it & what problem does it solve for Kubernetes?](https://belowthemalt.com/2022/11/16/what-is-helm-why-do-you-need-it-what-problem-does-it-solve-for-kubernetes/)
Get the Apple Look: How to Implement a Rounded Scrollbar in Your Website
Tags: css, html, webdev, tutorial
Published: 2022-11-17 00:39:13

Are you wondering how you can have a modern, rounded scrollbar for any other website you're designing? Read on to learn about how you can implement a scrollbar similar to one on Stack Overflow, Outlook.com, and DNAnalyzer.live.

`::-webkit-scrollbar` is a pseudo-element in CSS employed to modify the look of a browser’s scrollbar. Chrome, Edge, and Safari support this standard, while Firefox doesn't.

The code:

CSS:
```css

/* width */

/* set the width of the scrollbar */

::-webkit-scrollbar {

 width: 10px;

}

/* Handle */

/* set the color of the scrollbar and the radius of its corners */

::-webkit-scrollbar-thumb {

 background: rgb(150, 150, 150);

 border-bottom-left-radius: 5px;

 border-top-left-radius: 5px;

 border-bottom-right-radius: 5px;

 border-top-right-radius: 5px;

}

/* Handle on hover */

/* set the color of the scrollbar when hovered over */

::-webkit-scrollbar-thumb:hover {

 background: rgb(131, 131, 131);

}

/* Handle on active */

/* set the color of the scrollbar when clicked */

::-webkit-scrollbar-thumb:active {

 background: rgb(104, 104, 104);

}

```
Template HTML:
```html

<!DOCTYPE html>

<html>
 <head>
  <title>Page Title</title>
 </head>
 <body>
  <h1>Rounded Scrollbar Example</h1>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
  <p>Filler text</p>
 </body>
</html>
```

GitHub repository: https://github.com/Verisimilitude11/RoundedScrollbar

Feel free to comment below if you have any questions or want to share your website with a modern scrollbar!
How to Monetize Your Telegram Bot
Tags: telegram, bots, money, programming
Published: 2022-11-18 04:23:11

---
title: How to Monetize Your Telegram Bot
published: true
date: 2022-11-17 00:35:23 UTC
tags: telegram,bots,money,programming
canonical_url: https://grahamzemel.medium.com/how-to-monetize-your-telegram-bot-ead1caa360cb
---

[![](https://cdn-images-1.medium.com/max/2600/0*F0bRHbq7aukb69lG)](https://grahamzemel.medium.com/how-to-monetize-your-telegram-bot-ead1caa360cb?source=rss-79a7fbf51e21------2)

TL;DR- After you’ve made a few Telegram bots for yourself, the next step is creating some for public use. Monetizing these bots can be a…

[Continue reading on Medium »](https://grahamzemel.medium.com/how-to-monetize-your-telegram-bot-ead1caa360cb?source=rss-79a7fbf51e21------2)
Project List
Published: 2022-11-17 00:25:13

**Projects**
1. Deploy my old Docker/Django/Ubuntu container on Linode ([Project #1](https://dev.to/sean_learns_devops/project-1-deploy-a-docker-container-on-linode-2d9d)) -- _In Progress_

**Final Project**
Build photo uploader written with Django/React. This project will:
- Have a basic CI/CD build which automatically deploys changes to `main` after tests pass
- Have a development/production build
- Log exceptions in Sentry
Hi everyone, I'm Sean
Tags: devops
Published: 2022-11-17 00:18:30

I'm starting this blog to outline my journey of learning DevOps.

I've been a professional Software Engineer for 7+ years, mostly building and maintaining full stack web applications written in Django/React. While my skills have been improving writing application logic, actually deploying my apps to the web has always been a huge weakness of mine. I want to change that and write about the learning process here.

I've done a few tutorials in the past (namely [Docker Mastery](https://www.udemy.com/course/docker-mastery/) and [nginx fundamentals](https://www.udemy.com/course/nginx-fundamentals/)) and of course the various build pipelines at my job are a part of the engineering department's every day essentials, however, I know that really learning the ins-and-outs of DevOps requires designing and building a difficult but neat project that will challenge me while keeping my interest.

My ultimate project is a photo uploading application using Django/React but with all the bells and whistles of a production application. On the way, I will be building some intermediate projects. You can find them in the <projects> entry, which I will update.

If you would like to reach me, send me an email at:
**sean AT (github handle) DOT com**
Tools for working with Kubernetes
Tags: tools, kubernetes
Published: 2022-12-27 17:30:02

---
title: Tools for working with Kubernetes
published: true
date: 2022-11-17 00:00:00 UTC
tags: Tools,kubernetes,tools
canonical_url: https://codebytes.github.io/2022/11/17/tools-for-working-with-kubernetes/
---

I’ve been in a number of internal and external calls where tooling to help work with Kubernetes keeps coming up. I thought I would share some of these cool tools in case you weren’t aware of them.

## Tools

- K9S
- kubectx and kubens
- fzf

### K9S

K9S is a terminal based UI for interacting and managing Kubernetes Clusters. You can find k9s at [https://github.com/derailed/k9s](https://github.com/derailed/k9s) or their website [https://k9scli.io/](https://k9scli.io/).

[![k9s pulses](https://codebytes.github.io/assets/2022/11/k9s-pulses.png)](/assets/2022/11/k9s-pulses.png "k9s pulses")[![k9s logs](https://codebytes.github.io/assets/2022/11/k9s-logs.png)](/assets/2022/11/k9s-logs.png "k9s logs")[![k9s pods](https://codebytes.github.io/assets/2022/11/k9s-pods.png)](/assets/2022/11/k9s-pods.png "k9s pods")[![k9s rbac](https://codebytes.github.io/assets/2022/11/k9s-rbac.png)](/assets/2022/11/k9s-rbac.png "k9s rbac")
_k9s Screens_

### Kubectx and Kubens

These tools are amazing at quickly switching context and namespaces while working with kubernetes. You can find k9s at [https://github.com/ahmetb/kubectx](https://github.com/ahmetb/kubectx) or the author’s website [https://ahmet.im/blog/kubectx/](https://ahmet.im/blog/kubectx/).

kubectx can show you the multiple contexts available, switch between them quickly, and create aliases.

![kubectx](https://codebytes.github.io/assets/2022/11/kubectx-demo.gif)
_kubectx_

kubens can show you the multiple namespaces available, switch between them quickly, and create aliases.

![kubens](https://codebytes.github.io/assets/2022/11/kubens-demo.gif)
_kubens_

### fzf

fzf is a different type of tool. This makes your other tools better. It works on a variety of platforms but what is allows you to do is get an interactive filter. kubectx and kubens will show the list and let you pick what you want instead of runnig multiple commands. You can leverage fzf to pick files to edit more quickly.

![fzf](https://codebytes.github.io/assets/2022/11/fzf.gif)
_fzf_

It works with lots of things, like vi.

![fzf-vi](https://codebytes.github.io/assets/2022/11/fzf-vi.gif)
_fzf-vi_

## Conclusion

If you work daily with Kubernetes you might already know about these tools. If you haven’t tried them, give them an install and play around.
Content & Tooling Team Status Update
Tags: puppet, content, updates
Published: 2022-11-28 22:32:50

---
title: Content & Tooling Team Status Update
published: true
date: 2022-11-17 00:00:00 UTC
tags: puppet, content, updates
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2022-11-18-status-update/
---

Happy Friday everyone! Hope you are all keeping well and are beginning to wrap up warm, drink some hot chocolate and stick on some festive movies as we welcome back the darker evenings.


## Codebase Hardening

[Lukas](https://github.com/LukasAud) has been continuing his stellar work on the hardening of our module codebases. This work helps to ensure that our supported modules are protected from malicious command injection by appropriately sanisitising inputted commands.

## Updating gem requirements for ruby 3.0/3.1

With our recent removal of puppet-module-gems from our modules, [David](https://github.com/david22swan) has been working hard behind the scenes to ensure that our modules continue to work as expected for Ruby 3.0 and 3.1.

## Another successful community day

As always we would like to thank each of our community contributors for continuing to produce some really great Pull Requests. This week, we were able to release [puppetlabs-apache](https://github.com/puppetlabs/puppetlabs-apache) 8.4.0, and merge 5 PRs.

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-apache#2342`](https://github.com/puppetlabs/puppetlabs-apache/pull/2342): “Declare minimum Puppet version to be 6.24.0”, thanks to [ekohl](https://github.com/ekohl) and the following people who helped get it over the line ([trefzer](https://github.com/trefzer))
- [`puppetlabs-apache#2331`](https://github.com/puppetlabs/puppetlabs-apache/pull/2331): “add maxrequestworkers parameter for mpm\_worker module”, thanks to [trefzer](https://github.com/trefzer)
- [`puppetlabs-kubernetes#589`](https://github.com/puppetlabs/puppetlabs-kubernetes/pull/589): “Fix Build docker image tooling”, thanks to [BaronMsk](https://github.com/BaronMsk)
- [`facterdb#258`](https://github.com/voxpupuli/facterdb/pull/258): “Windows updates for facter 4.2”, thanks to [davidsandilands](https://github.com/davidsandilands)
- [`rspec-puppet#33`](https://github.com/puppetlabs/rspec-puppet/pull/33): “Update README.md to include sensitive function”, thanks to [davidsandilands](https://github.com/davidsandilands)

## New Module / Gem Releases

The following modules were released this week:

- [`puppetlabs-apache`](https://github.com/puppetlabs/puppetlabs-apache) (`8.4.0`)
Relax, no need to FUD
Published: 2022-11-16 23:54:06

Last week, it was FTX and then BlockFi.. The damage was cascading to entire crypto industry.. Investors lost confidence, sold cryptos, withdrew, which further brought down the coin prices. And this causes many problematic exchanges to pause the withdrawals.

This is a vicious cycle.  Relax, no need to FUD. The bitcoin has been born for 14 years. It is robust. [Steem](https://steemyy.com) has been more than 6 years, and it is still fine.

If you don't trust exchanges, just withdraw to your local wallet e.g. imtoken multi-coin wallet (remember, not your keys not your funds).

I use metamask (chrome extension, and mobile app) for ETH and ERC-20 tokens  e.g. USDT
I use tronlink (chrome extension, and mobile app) for TRON and TRC-20 tokens e.g. USDT
I use imtoken (mobile app) for bitcoins.

These two [crypto.com](https://justyy.com/out/crypto) and [wirex](https://justyy.com/out/wirex) are exchanges and provide crypto-bank-cards so that cryptos can be easily cashed out.

The rumors say that [crypto.com](https://justyy.com/out/crypto) is next but I doubt it. [crypto.com](https://justyy.com/out/crypto) is regulated in many countries, and their CEO said the customer's funds are [1:1 reserve](https://twitter.com/kris/status/1592697087439011841).

![image.png](https://cdn.steemitimages.com/DQmXaDMYN55faY2WkLF7uvJb3tbVN5V9J47oJsj8bY7NXgQ/image.png)

Of course, some people may have some funds staked and can't withdraw immediately e.g. 90 days locking period). But I guess that is one of the reasons that you put the funds in exchange, in the first place.

Also, DYOR (Do your own research) - not blindly following what you heard or are suggested. You need to have your own judgement.


<hr/> 

![](https://justyy.com/png/whale.png)
Flutter: Getting Started.
Tags: flutter, crossplatform, mobile
Published: 2022-11-16 23:32:43

##Introduction: What is Flutter?

Flutter is a mobile app development framework that allows developers to create cross-platform apps. It uses the Dart programming language and provides a set of pre-built UI widgets, which are used to build the user interface of an app. Flutter also offers a set of core libraries for common tasks such as accessing the device camera or local storage, and it provides tools for building custom widgets.

##What are the Benefits of Using Flutter?

Flutter is a mobile app development framework that is used to create native apps for both iOS and Android.

Flutter has many benefits, such as:

- It is open source, which means it can be customized by anyone.

- It has a large community of developers that are constantly contributing to it.

- It is backed by Google, which means that it will always have the latest updates and features.

- It provides a single codebase for both iOS and Android apps.

- Its UI components are built with Material Design in mind, so they look great on any device.

##How to Get Started with Flutter Development?

To get started with flutter, you can start with the resources below.

- [Flutter Documentation](https://docs.flutter.dev/) 
- [Google Colabs](https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1#0)
- [Google Search](https://search.brave.com/search?q=Flutter%3A+Getting+Started.&source=web)

If you will prefer to watch an online video, below are the list of youtube channel I will recommend you start with.

- [Flutter Channel](https://www.youtube.com/c/flutterdev)
- [Flutter Ninja](https://www.youtube.com/watch?v=1ukSR1GRtMU&list=PL4cUxeGkcC9jLYyp2Aoh6hcWuxFDX6PBJ)
- [Destiny Ed](https://www.youtube.com/@Destiny_Ed/playlists)

Also to improve and fast-track your learning process, you can join flutter communities, below are the list (not all) of flutter communities you can join.

- [FlutterBytesConf](https://twitter.com/flutterbyteconf)
- [Codeclan Nigeria](https://twitter.com/codeclannigeria)

Flutter is bae, you should try it, 😊.

Thank you for reading, after trying it out, come give feedback on your experience, also if you have any questions on flutter, you can ask in the comment section below.
How to use JavaScript Gamepad API to Build a Simple Game
Tags: javascript, gamedev, beginners, tutorial
Published: 2022-11-16 23:21:14

In this exciting tutorial we will use the JavaScript Gamepad API to build a simple game to move a player around on the screen using a controller.

We will be programming the direction pad and left analog stick to move the player on the screen. We will also use the face buttons to change the color of the player depending on the button pressed.

The JS Gamepad API allows developers to use a gamepad as an input device. The most common usage would be for game development. The Gamepad API has 2 events. One event for when a controller is connected and another for when it is disconnected. There is no event for when a button is pressed on the controller. However the developer can ask the Gamepad for the state of the buttons at any time. Included in this state is the list of buttons and a list of axes that represent the analog sticks if there are any. Checking for the controller state can be done in a loop or on a timer. For game development this will happen in the game loop. At the start of each game loop you can retrieve the state of the buttons and then use that information to manipulate your game.

Learn more in this tutorial:
{% embed https://youtu.be/GOjMP6WY8CU %}