Skip to main content

· 2 min read
Viorel PETCU

Blog Banner

Greetings, fellow tech enthusiast! You've landed on the central hub where I, share my explorations, and deep-dives into the world of technology.

This blog is much more than a collection of articles; it's a digital diary chronicling my adventures in the vast expanse of technology. From the nitty-gritty of software development to the latest in tech innovation, and the occasional detour into personal projects – every post is a piece of the puzzle that is my tech journey.

info

I invite you to look out for little jokes that I distribute throughout this BLOG such as the date of this article.

Why I Write

  • To Educate & Inform: Whether breaking down complex topics or sharing what worked for me in a particular situation, I aim to provide value in each post.
  • To Inspire & Engage: I hope to spark curiosity and foster a community of learners and doers.
  • To Document & Reflect: Writing is a way to track progress, reflect on experiences, and cement knowledge.
  • Development Tales: Stories from the trenches of coding and system architecture.
  • Tech Trendspotting: Spotlights on emerging technologies and their potential impacts.
  • Project Spotlights: Deep dives into my personal projects, showcasing successes and learning from failures.

Staying Connected

While the content here is rich with information, the conversation doesn't end at the blog's final period. Engage, comment, and connect:

  • Comments & Discussions: Share your thoughts on each post – let's learn from each other.
  • Social Sharing: Found something enlightening? Share it with your network!
  • DEV.TO Mirror: Each post is also available on DEV.TO for even greater community interaction.

Thank you for being here, and enjoy the read!


Happy Exploring,

Veo.

· 3 min read
Viorel PETCU

If you're an avid YouTube user, you know the struggle of keeping track of the total time you're about to invest in watching a playlist or queue. Whether you're lining up tutorials, your favorite gaming sessions, or a list of must-watch documentaries, understanding how much time you're committing can be crucial. This is where the YouTube Queue Duration Tool comes into play—a simple browser extension that sums up the total duration of videos in your YouTube queue.

info

I always wondered why this is not a feature already. Who cares?

Now we can change it.

Why You Need It

In our fast-paced world, time management is key. Whether you're taking a quick break or settling in for a long study session, knowing the total playtime helps you plan better. The YouTube Queue Duration Tool is perfect for:

  • Educational Content: Plan your learning sessions by knowing how long it will take to go through tutorial videos.
  • Entertainment: Balance your leisure time and breaks by watching queued videos.
  • Workouts: Queue up your exercise or yoga videos and get the total workout time.

How It Works

The tool is a piece of JavaScript that runs in the background of your browser. Once you've added videos to your YouTube queue, the tool:

  1. Accesses the queue container element in the DOM.
  2. Iterates over the listed videos, scraping the duration of each one.
  3. Parses the durations and converts them into seconds.
  4. Sums up the seconds and converts the total back into hours, minutes, and seconds.
  5. Displays the total duration neatly at the top of your queue.

Under the Hood

The core of the extension is a simple, yet efficient, interval-based checking system that waits until all video items are loaded on the page. Here's the logic:

function parseTimeToSeconds(timeString) {
const parts = timeString.split(':');
let seconds = 0;
let multiplier = 1;

while (parts.length > 0) {
seconds += multiplier * parseInt(parts.pop(), 10);
multiplier *= 60;
}

return seconds;
}

function formatSecondsAsTime(seconds) {
const hours = Math.floor(seconds / 3600);
seconds %= 3600;
const minutes = Math.floor(seconds / 60);
seconds %= 60;
return `${hours}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
}

function checkPlaylistTimes() {
let totalSeconds = 0;
let queueTitle = null
try {
const sideBar = document.querySelector("#secondary");
const playList = sideBar.querySelector("#playlist");
const items = playList.querySelector("#items");
const times = items.querySelectorAll("#time-status");
const queueH3 = playList.querySelector("h3");
queueTitle = queueH3.querySelector("yt-formatted-string");
for (let i = 0; i < times.length; i++) {
totalSeconds += parseTimeToSeconds(times[i].innerText);
}
} catch (e) {
console.warn('An exception occurred:', e);
return;
}
const formattedTotalTime = formatSecondsAsTime(totalSeconds);
//console.log(`Total Playlist Time: ${formattedTotalTime}`);
const prefix = queueTitle.innerText.split(" ")[0];
queueTitle.innerText = `Queue (${formattedTotalTime})`;
}

// Set an interval to sum up the times every second
setInterval(checkPlaylistTimes, 1000);

By adding it to your User Javascript and CSS extension.

suggested configuration

info

I shown how to do this in a previous DEV.TO post

As seen in the screenshots, the total duration of the queued videos is displayed in a clear format (HH:MM:SS), giving you a quick glimpse of the time required for your current queue.

BeforeAfter
beforeafter

Wrapping Up

The YouTube Queue Duration Tool is a testament to how a little convenience can go a long way. For developers, the source code is a concise example of manipulating the DOM with pure JavaScript and can serve as a template for similar projects.

Stay tuned for updates, and happy queueing!


Keep on changing things.

Viorel PETCU

· One min read
Viorel PETCU

Efficient monitoring doesn't have to break the bank. In the world of DevOps, where every resource is precious, I've tackled the challenge of implementing a robust monitoring solution that aligns with the most stringent of budgets: free.

I've shared my journey to this discovery on DEV.TO, where I detail a zero-cost monitoring solution that provides real value without the price tag.

In the article, you'll find an in-depth look at how you can set up a monitoring system that not only works effectively but also maintains your budget's integrity. It's perfect for small projects, startups, or anyone looking to get the most out of their operational tools without additional investment.

Dive into the setup, the tools, and the configurations that make up this cost-free solution. It's monitoring made accessible for everyone.


Monitor smart, not hard,

Veo

· One min read
Viorel PETCU

Open-source software is all about community and collaboration. But what if it could also be about contributing positively to the environment? That's the idea behind the Climate Positive Public License.

I've detailed this innovative concept on DEV.TO, where I introduce the principles and potential of a license that goes beyond the code.

The license aims to address climate change by requiring projects to not only be open source but also to actively contribute to a healthier planet. It's a small step for code, but potentially a giant leap for the open-source community in terms of environmental responsibility.

Explore the possibilities and join the discussion on how we, as developers and technologists, can be part of the climate solution.


Code for a cause,

Veo

· One min read
Viorel PETCU

"Der innere Schweinehund" – or the "inner pig dog" – is a quirky German term that refers to the inner voice that tempts us into procrastination. How do we combat this sly creature? Good design might just be the sword we need.

I've penned down some thoughts on DEV.TO about the surprising role that thoughtful design plays in overcoming procrastination.

The article takes you through the ways in which a well-designed workspace and toolset can create an environment that's less conducive to the lures of the "pigdog." It's not just about aesthetics; it's about functionality and creating a space that prompts action and creativity.

Discover how the principles of good design can be applied to your daily routine to enhance productivity and keep procrastination at bay.


Design your space, design your pace,

Veo

· One min read
Viorel PETCU

Dyslexia presents a unique set of challenges, especially in the world of software development where every character counts. But it doesn't have to be a roadblock.

On DEV.TO, I've opened up about my own experiences as a developer with dyslexia and how I've turned this challenge into a strength.

In the article, I share personal strategies and tools that have helped me excel in coding despite the hurdles dyslexia might throw my way. It's a message of empowerment and encouragement for anyone in the tech field who might see dyslexia as a barrier.

Join me in breaking down misconceptions and exploring the ways in which we can all create a more inclusive and supportive environment for dyslexic developers.


Embrace your unique perspective,

Veo

· One min read
Viorel PETCU

Owning Bitcoin or any cryptocurrency can be an exhilarating ride, with market values fluctuating wildly from one moment to the next. But can this financial rollercoaster affect your ability to focus on work?

I've shared my thoughts and experiences on DEV.TO about the intersection of cryptocurrency ownership and workplace productivity.

In the article, I explore the challenges of staying focused on professional responsibilities amid the distractions posed by the volatile nature of cryptocurrencies. Whether you're a seasoned crypto investor or just crypto-curious, this piece sheds light on the importance of maintaining a balance between work and the watchful eye on investment fluctuations.

Delve into the discussion and discover strategies for keeping your work productivity on track, even as you participate in the ever-changing world of digital currencies.


Stay productive, stay balanced,

Veo

· One min read
Viorel PETCU

When you find a feature or function online that truly enhances your browsing experience, it's almost second nature to wish for a way to keep it close at hand. That's where browser extensions come into play – the little helpers that make our digital lives more efficient.

In a recent piece on DEV.TO, I dive into the world of browser extensions and the impact they have on our daily internet interactions.

From personalization to productivity, extensions can significantly modify and improve our browsing experience.

Join me in exploring how these miniature programs can make a big difference and why it's crucial to show appreciation for the creative minds that develop them.


Extend your capabilities,

Veo