Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Quick tips

Solving the ‘Retry as Admin’ while saving files in Visual Studio Code on a Mac

TL;DR

If you ever get an error that you can’t save a file in Visual Studio Code, and it prompts you to ‘Retry as Admin’ (where you then have to enter your admin password) then the solution is super easy by using the chown command.

Namely, you just have to run sudo chown -R $USER . in the folder where your file is located and that will ‘fix it’.

Yep, not much else to it really 💪

Why does this happen?

Now, this may have happened if you were using sudo when installing some Node.js packages with npm (or some other package manager), or if you created the folder (not sure why, but still plausible) using the sudo command.

A bit more about the chown command

The chown command in UNIX and Linux-based systems (including MacOS), stands for ‘change owner’ and it’s used to change the ownership of files and directories.

A detailed breakdown of the above command is as follows:

  • sudo: shorthand for ‘superuser do’; it grants administrative privileges for the command that follows. And yes, you’re right, you should use this command with caution
  • chown: the command to change file’s owner
    –R: this option makes the command recursive, which means it will apply to all files and directories within the current directory
  • $USER: This is a variable that represents the current logged-in user (aka you). By using $USER, you’re changing the ownership of the files to yourself, eliminating the need for using sudo later
  • .: the dot represents the current directory. So, the command affects the files and directories where it’s executed

Thread with caution

It’s important to understand why you’re using chown, because incorrect usage can lead to permission issues or security risks. Generally, use it when you need to restore file ownership to the correct user after it’s been changed (often inadvertently). Be very vary of following tutorials (or any other instructions) that tell you to set the file permissions to anything else but you ($USER).

Learn even more about chown

If you want to learn more about the chown command and its options, you can run the man chown command in your terminal and you’ll get way more detailed documentation. Or, of course, just Google.

Hope this quick tip helps 🙌

Quick tips

Cybersecurity Alert: The New Phishing Scam Hitting OpenSea Users

TL;DR

A new phishing scam is targeting OpenSea users through email. Exercise caution and stay vigilant.

!TL;DR

I recently encountered an email that surprisingly bypassed my spam filters. The subject line read: "Your asset has recently received a new deal [C02aaA]".

The email included an image, showcasing what appeared to be a legitimate notification from OpenSea:

The email read:

​New Offer Detected

Your asset has recently received a new deal.

Details:
Offer TxID: C02aaA
Buyer ID: Jamesmatic02

Review The Offer

This email is being sent to you as you have agreed to receive information from us. If you wish to stop receiving this type of information, please opt-out using the available unsubscribe option. Kindly avoid responding directly to this email. For any questions, reach out to our Support Center using the provided contact details.

Best regards.

Update your email preferences or unsubscribe here
© 2024 Sale Team
228 Park Ave S, #29976, New York, New York 10003, United States
beehiiv logoPowered by beehiiv

Clicking the Review The Offer button redirects users to a phishing site, an exact replica of OpenSea, which then prompts for login credentials, effectively stealing them.

How to Protect Yourself

In situations like these, here are some crucial steps to ensure your online safety:

  • Verify the Email Sender
    • Always check the sender’s email address. Phishing attempts often come from email addresses that are misspelled or use different domains.
  • Inspect the Domain Link
    • Be meticulous about the URL. Phishing sites usually have URLs closely resembling the legitimate site, with subtle misspellings or different domain extensions. For instance, instead of https://opensea.io/, it might be https://openseasecure.io/
  • Avoid Clicking Suspicious Links
    • If an email asks you to click a link, hover over it first to preview the URL. If it looks suspicious, do not click it.
  • Use Two-Factor Authentication
    • Always enable two-factor authentication (2FA) on your accounts if possible, as this adds an extra layer of security
  • Regularly Update Your Passwords
    • Change your passwords frequently and avoid using the same password across different platforms.
  • Install Security Software
    • Use reliable anti-virus and anti-malware software. These can often detect and alert you to suspicious websites and emails.
  • Check Official Websites Directly
    • If you receive an unexpected offer or alert, go directly to the official website by typing the URL into your browser, rather than clicking on links in emails.

Conclusion

By staying informed and cautious, you can significantly reduce the risk of falling victim to phishing attacks. Remember, in the digital realm, vigilance is your best defense. Stay safe out there!

Quick tips

Sparkly Wheels are Turning in the Opposite Directions: A Handy Fix for a STEM Toy Enthusiast

⚠️ Disclaimer: This post isn’t sponsored—I’m just a fan of the product. I recently encountered a small hiccup (probably my own doing) with my Sparkly toy and wanted to share a straightforward solution I discovered.

Sparkly is a fantastic STEM toy created by a local team (a quick Google search will tell you more). My journey with Sparkly began with excitement as I assembled it, eager to see it in action. I switched on my phone’s flashlight for the grand test, only to realize something was amiss. It seemed I had inadvertently set up the motor incorrectly.

Here’s what happened: one wheel was rotating correctly, moving forward, but its counterpart was rebelliously spinning in the opposite direction, backward. Now, you may expect that these motors operate on direct current. The solution, in theory, was simple: reverse the polarity by swapping the + and – connections.

However, when I tried to switch the battery input, I hit a snag. The stubborn cable, as shown in the image, refused to budge:

Refusing to be defeated, I took a more hands-on approach. I unsoldered the black and red wires on the motor and then switched their positions.

And voilà, it worked! What seemed like a complicated problem turned out to have a pretty simple fix.

So, to all my fellow STEM enthusiasts and tinkerers, remember, sometimes the solution is just a wire swap away 🙂

Happy tinkering and happy holidays! 👋

JavaScript

This is How Your Parents Used CSS and JavaScript

TL;DR

This is the second part of the "This is How Your Parents Used to Build Websites". The first blog post is here.
Now, if you thought our HTML journey was exciting, buckle up! We’re about to dive into the world of CSS and JavaScript. These are the tools that will transform your static HTML pages into vibrant, interactive experiences.

Ready? Let’s go!

Part 1: CSS – Making Your Website Stylish

Basic Concepts of CSS

This is how a simple CSS statement would look like: p { color: blue};.

There are three basic concepts of CSS:

  • Selectors:
    • Think of them as the ‘who’ in styling.
    • For example, p { } targets all <p> elements.
  • Properties and Values:
    • The ‘what’ and ‘how’. They go withing the {} brackets.
    • Like color: blue; – this tells the paragraph text to be blue.

Incorporating CSS into HTML

There are three ways you can add CSS into HTML:

  • Inline Styles: Directly in an HTML tag, like <p style="color: blue;">.
  • Internal Styles: Inside the <style> tag in the HTML head.
  • External Stylesheets: A separate .css file, linked in the HTML head with <link rel="stylesheet" href="style.css">.

Exploring Common CSS Properties

Color and Fonts

body { color: #333; font-family: 'Arial', sans-serif; }

Font Size, Weight, and Style

p {
  font-size: 16px;
  font-weight: bold;
  font-style: italic;
}

Text Alignment and Decoration

h1 {
  text-align: center;
  text-decoration: underline;
}

Margin and Padding

.content {
  margin: 20px;
  padding: 15px;
}

Borders

.box {
  border: 2px solid #000000; /* Solid black border */
  border-radius: 10px; /* Rounded corners */
}

Styling Links

  • Hover Effect

    a:hover {
    color: #ff0000; /* Red color on hover */
    text-decoration: none;
    }
  • Link Visited State

    a:visited {
    color: #800080; /* Purple for visited links */
    }

Layout with Flexbox

  • display: flex; enables a flexible box layout.
  • There are games that explain flexbox, so if you’re curious go check them out.

Responsive Design Basics

In order to adapt the site to various screen sizes and make sure it looks good on an iPhone as well as on your laptop, we can use the so-called media queries:

@media (max-width: 600px) { body { background-color: lightblue; }}

This changes the background color on screens smaller than 600px.

Advanced Selectors

  • Pseudo-classes
    a:hover { color: red; } changes link color on hover

  • CSS Transitions
    transition: background-color 0.5s ease;

  • CSS Animations

    @keyframes example {
    from {background-color: red;}
    to {background-color: yellow;}
    }
    div {
    animation-name: example;
    animation-duration: 4s;
    }

Advanced CSS

If you’re curious enough, please explore SASS (CSS with superpowers) on your own.

Part 2: JavaScript – Bringing Interactivity to Your Website

JavaScript is the scripting language that lets you create dynamic content.

Basic Syntax and Concepts

Variables
let message = 'Hello, world!'; – with this we defined the variable called ‘message’ and saved in it the string ‘Hello, world!’.

You may come across the keyword var, but that was an old keyword that is no longer suggested to be used because of the unintended consequences.

Functions

function greet(name) {
  alert('Hello, ' + name);
}

With this we created a function called greet that takes a parameter called name and outputs Hello name via an alert (OFC, name is replaced with whatever you pass into the function as a parameter).

Events
<button onclick="greet('Alice')">Greet</button>

With onclick we define what function is going to be run when the button is clicked.

DOM Manipulation

  • Change text

    document.getElementById('myText').innerHTML = 'New Text';
  • A button that changes a theme color

    <button onclick="changeColor()">Change Theme</button>
    <script>
    function changeColor() {
    document.body.style.backgroundColor = 'lightblue';
    }
    </script>
  • Changing styles on hover using JavaScript

    document.getElementById('myElement').onmouseover = function() {
    this.style.color = 'red';
    };
  • Interactive portfolio enhancements

    document.getElementById('project1').onmouseover = function() {
    this.style.transform = 'scale(1.1)';
    };
    document.getElementById('project1').onmouseout = function() {
    this.style.transform = 'scale(1)';
    };
  • Handling a click event

    document.getElementById('myButton').addEventListener('click', function() {
    alert('Button clicked!');
    });

Advanced topics

Using fetch to load data

fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data));

I wrote a three series blog post on doing so-called AJAX calls (fetching data from some API), check them out here:

  • Making AJAX calls in pure JavaScript
  • Making AJAX calls using jQuery
  • Making AJAX calls using the Fetch API

JavaScript ES6
There are some awesome things that have been added to the ‘new’ flavor of JavaScript, called ES6. I won’t go into the details here, but use Google (or ChatGPT, or Bard, or …) and look into these topics:

  • Arrow Functions: const add = (a, b) => a + b;
  • Template Literals
    const greeting = `Hello, ${name}!`;

Conclusion

And that’s a wrap! We’ve just scratched the surface of the amazing world of CSS and JavaScript. Remember, practice is key, and the web is your canvas. Go out there and create something awesome!

In the next blog post we’ll cover frameworks for CSS and JavaScript, pick one for each and create a Pokemon search application.

JavaScript

This is How Your Parents Used to Build Websites

TL;DR

Hey future web wizards! Are you ready to embark on your journey into the vast world of web development? This post is your beginner-friendly guide to HTML. We’ll break down the essentials, infuse some humor, and provide plenty of examples for you to experiment with. By the end of this, you’ll be well on your way to crafting your first web page. Let’s dive into the world of tags and elements and make them your new best friends!

The intro you just read might sound like a blast from the past – a time when all aspiring web developers had were books and a computer (if they were lucky). Back then, the web was a simpler place, primarily text and links.

But hold on, we’re not just reminiscing about the old days. Even though web development has evolved tremendously (and yes, it’s a lot cooler now), understanding the basics of HTML is still crucial. So, even if you’re planning to leap into more advanced topics (which we’ll cover in the next blog post), this article is worth your time to grasp the fundamentals of HTML tags.

In this blog post we’ll cover HTML basics. In the next one we’ll touch on CSS and JavaScript.

Setting the Scene

Picture this: It’s your first day as an aspiring web developer, buzzing with ideas and ready to make your mark on the internet. But there’s a key skill you need to master first: HTML. Don’t fret – it’s far from daunting. HTML is the skeleton of all websites, and together, we’re going to unravel its mysteries.

Why HTML, Anyway?

HTML stands for HyperText Markup Language. It’s the skeleton of all web pages. Think of it as the foundation of a house – without it, you can’t build anything stable. HTML is where every web developer begins their journey. It’s simple, powerful, and the stepping stone to more complex web technologies.

OK, but What’s in a Markup Language?

Markup languages are all about annotating text to give it structure and meaning. HTML does this by using tags to turn plain text into a structured, visually appealing web page. It’s like taking a plain old document and adding magic to make it a web page.

⚠️ And, yes, to settle the debate: No, HTML is not programming. Sorry, not sorry.

Your First HTML Tags

Let’s start with the basics. Every HTML document has some key tags:

  • <!DOCTYPE html>: This declaration defines the document type and HTML version
  • <html>: The root element that wraps the entire content
  • <head>: This contains meta-information about the document, like its title
  • <body>: The meat of the page – this is where all your content will go

Creating Your First HTML Page

Open up your favorite text editor (Visual Studio Code, Sublime Text, Vim, … – take your pick) and let’s get coding. Copy the following code into a file and name it index.html:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to my first web page.</p>
</body>
</html>

Now open this index.html file in your favorite browser (Chrome, Safari, Firefox, …). Usually, just doubleclicking the file should make it automatically open in your default browser.

Voila! You’ve just created your first web page that should look like this:

Understanding the HTML Structure

HTML documents are structured as a tree of elements. Each element has an opening tag (<tag>) and a closing tag (</tag>). Some elements are self-closing, like <img /> (for inserting images) and <br /> (for inserting a new line). Think of it as a family tree, but for your web content.

Dive into Elements and Attributes

HTML elements can have attributes that provide additional information about the element. For example, <a href="http://www.nikola-breznjak.com/">My site</a> uses the href attribute to define the link’s destination.

Text Formatting and Layout

HTML offers a range of elements for formatting text:

  • <h1> to <h6>: Headings from most to least important
  • <p>: Paragraphs
  • <strong> and <em>: Bold and italic text for emphasis
  • <ul> and <ol>: Unordered (bullets) and ordered (numbers) lists
  • <li>: List items
  • <div>: A generic container for content, great for layout and styling purposes

Adding Images

To add an image, use <img src="image.jpg" alt="Description">. Change the image.jpg with an URL of an actual image. For example, edit the index.html file to look like this:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to my first web page.</p>
    <img src="https://i.imgur.com/AoX2x7f.png" alt="VIM for Life">
</body>
</html>

And you should get this:

Adding Links

To create a link, use the a tag. Example: <a href="http://www.google.com">Link to Google.com</a>.

Forms and User Input:

Forms are what you should use to get some input from users. Use the <form> element to create an input area. Inside, use <input>, <textarea>, <button>, and other form elements to gather user input.

For example, here’s the usual login form:

<form action="/submit-your-login-form" method="post">
    <label for="username">Username:</label>
    <input type="text" id="username" name="username" required>

    <label for="password">Password:</label>
    <input type="password" id="password" name="password" required>

    <button type="submit">Login</button>
</form>

If you add that to the index.html file, you should see this in your browser (when you refresh the page):

Embedding Media

You can embed videos and audio in HTML5 using <video> and <audio> tags. Here’s an example for video:

<video width="320" height="240" controls>
    <source src="movie.mp4" type="video/mp4">
    <source src="movie.ogg" type="video/ogg">
    Your browser does not support the video tag.
</video>

and here’s the example for audio:

<audio controls>
    <source src="audio.mp3" type="audio/mpeg">
    <source src="audio.ogg" type="audio/ogg">
    Your browser does not support the audio element.
</audio>

Of course, you would have to have the video and audio formats to try this out. You can Google, or create some of your own. Or, for the sake of quickly testing this out, here’s a link to an MP3 of a crowbar sound from a cult game Half Life.

Building a Simple Personal Portfolio Site with HTML

Let’s enhance our basic HTML skills by creating a simple personal portfolio page. This website will have four main sections: a header, an about me section, a projects section, and a contact section.

Creating the Basic Structure

Start by defining the structure of your page. Open your text editor and create a new file named portfolio.html. Here’s how you’ll structure it:

<!DOCTYPE html>
<html>
<head>
    <title>My Personal Portfolio</title>
</head>
<body>
    <header>
        <!-- Header content goes here -->
    </header>

    <section id="about">
        <!-- About me content goes here -->
    </section>

    <section id="projects">
        <!-- Projects list goes here -->
    </section>

    <section id="contact">
        <!-- Contact information goes here -->
    </section>
</body>
</html>

Crafting the Header

The header will contain your name and a navigation menu.

<header>
    <h1>John Doe</h1>
    <nav>
        <ul>
            <li><a href="#about">About Me</a></li>
            <li><a href="#projects">Projects</a></li>
            <li><a href="#contact">Contact</a></li>
        </ul>
    </nav>
</header>

The About Me Section

Here, you’ll introduce yourself. Include a brief paragraph and maybe a profile picture.

<section id="about">
    <h2>About Me</h2>
    <img src="profile.jpg" alt="John Doe" />
    <p>Hi, I'm John Doe, a passionate web developer...</p>
</section>

Showcasing Projects

In the projects section, list some of the work you’ve done. Use <ul> for the list and <li> for each project.

<section id="projects">
    <h2>Projects</h2>
    <ul>
        <li><a href="http://example.com/project1">Project 1</a></li>
        <li><a href="http://example.com/project2">Project 2</a></li>
        <!-- Add more projects here -->
    </ul>
</section>

The Contact Section

Include your contact information or a form for visitors to reach out to you.

<section id="contact">
    <h2>Contact Me</h2>
    <p>Email: [email protected]</p>
    <!-- You can add a contact form here in future -->
</section>

Adding Some Styling

While CSS is primarily used for styling, you can add inline styles directly in your HTML to change the look of your page. For example:

<style>
    body {
        font-family: Arial, sans-serif;
    }
    header, section {
        margin-bottom: 20px;
    }
    nav ul {
        list-style-type: none;
    }
    nav ul li {
        display: inline;
        margin-right: 10px;
    }
</style>

Place this <style> tag within the <head> section of your HTML.

Test and Iterate

This is how the full portfolio.html file should look like:

<!DOCTYPE html>
<html>
<head>
    <title>My Personal Portfolio</title>

    <style>
        body {
            font-family: Arial, sans-serif;
        }
        header, section {
            margin-bottom: 20px;
        }
        nav ul {
            list-style-type: none;
        }
        nav ul li {
            display: inline;
            margin-right: 10px;
        }
    </style>
</head>
<body>
    <header>
        <h1>John Doe</h1>
        <nav>
            <ul>
                <li><a href="#about">About Me</a></li>
                <li><a href="#projects">Projects</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </nav>
    </header>

    <section id="about">
        <h2>About Me</h2>
        <img src="profile.jpg" alt="John Doe" />
        <p>Hi, I'm John Doe, a passionate web developer...</p>
    </section>

    <section id="projects">
        <h2>Projects</h2>
        <ul>
            <li><a href="http://example.com/project1">Project 1</a></li>
            <li><a href="http://example.com/project2">Project 2</a></li>
            <!-- Add more projects here -->
        </ul>
    </section>

    <section id="contact">
        <h2>Contact Me</h2>
        <p>Email: [email protected]</p>
        <!-- You can add a contact form here in future -->
    </section>
</body>
</html>

Open it up in a browser to see your work. It won’t look like a polished website yet, but you’ll see all your content structured according to your HTML.

Conclusion

Congratulations! You’ve just built a simple yet functional personal portfolio site using HTML. This is just the beginning of your journey into web development. As you learn more about HTML, CSS, and JavaScript, you’ll be able to enhance your site with better styling and functionality. Keep experimenting, keep learning, and most importantly, have fun with it!

In the next blog post we’ll cover CSS and JavaScript.

Books

59 Seconds by Richard Wiseman

I loved the book 59 seconds by Richard Wiseman that I first came across in Tools of Titans.

Here are the top 10 most interesting studies the autor outlines as scientifically proven:

Cultivating Gratitude

Developing a gratitude attitude can significantly elevate happiness levels. By listing three aspects of life they are grateful for or three positive events from the past week, individuals experience a notable increase in happiness that can last about a month. This boost in mood not only fosters optimism about the future but can also enhance physical health.

The Power of Kindness

Engaging in even minor acts of kindness can lead to a substantial and rapid increase in happiness. Whether it’s donating a few dollars to those in need, surprising a loved one with a gift, donating blood, or helping a friend, these actions profoundly elevate one’s sense of joy.

Mirrors and Healthy Eating

The placement of a mirror in the kitchen can lead to healthier eating choices. When people see their reflection while choosing foods, there’s a 32% decrease in the consumption of unhealthy options. This self-awareness encourages better eating habits beneficial for their health.

Plants in the Workplace

Introducing plants into an office setting can have a positive impact on creativity and problem-solving. In men, it leads to a 15% increase in creative ideas, while women tend to generate more original solutions to problems. The presence of plants reduces stress and enhances mood, fostering a more creative environment.

The Influence of Light Touch

A light touch on the upper arm can significantly increase the likelihood of someone agreeing to a request. This subtle contact is subconsciously perceived as a sign of high status. For instance, in social settings, such as nightclubs, a light touch increased acceptance for a dance by 20% and a 10% increase in sharing telephone numbers with a stranger.

Writing About Relationships

Couples who dedicate time each week to write down their deepest thoughts and feelings about their relationship can improve their chances of staying together by over 20%. This form of expressive writing leads to the use of more positive language in communication, fostering healthier and happier relationships.

Detecting Lies through Written Communication

When dealing with potential liars, asking for written responses can be more revealing than verbal ones. Liars often use fewer details, more hesitations like "um" and "ah," and avoid self-references. People are also 20% less likely to lie in emails than in phone calls, as written words are permanent and can have lasting consequences.

Praising Children’s Effort

Focusing praise on a child’s effort rather than their inherent ability encourages a growth mindset. By applauding their hard work, children are more likely to embrace challenges, enjoy problem-solving, and independently seek solutions, effectively overcoming the fear of failure.

Visualizing Practical Steps

People who envision the practical steps required to achieve their goals are more likely to succeed than those who merely fantasize about success. Adopting a third-person perspective in these visualizations further increases the likelihood of success by about 20%.

Reflecting on One’s Legacy

Encouraging individuals to imagine a close friend speaking at their funeral about their personal and professional legacy helps in identifying long-term goals. This exercise provides clarity on their progress towards achieving these goals, offering a powerful motivation for personal and professional growth.

Books

Amp It Up by Frank Slootman

Here are my highlights from a book Amp It Up by Frank Slootman broken down to a few key takeaways.

Raise Expectations and Intensity

  • "Raise your standards. The late Steve Jobs was inspired only by insanely great things. Anything that didn’t meet his standards was rejected. Applying ‘insanely great’ as a standard daily pushes you further. Fight the impulse to lower standards for convenience; it takes little extra mental energy to aim higher."
  • Actionable Tip: regularly set and review higher performance benchmarks within your team or organization
  • Benefit: This drives a culture of continuous improvement and high achievement

Focus on Execution Over Strategy

  • "Strategy can’t be mastered until you know how to execute well. Execution is hard; great execution is scarce, hence a source of competitive advantage. Worrying about strategy before your team is good at executing is pointless."
  • “If you can only do one thing for the rest of the year, what would it be and why?”
  • Actionable Tip: Conduct training sessions to improve execution skills at all levels of your organization
  • Benefit: Enhances the ability to effectively implement strategies, adapting to real-world challenges and opportunities

This is Sparta!!!

  • Declare war on your competitors and on incrementalism. Have a “visceral sense of contest” and resist erring on the side of caution.

Build a Passionate Team

  • “Alignment becomes more important as the business grows. Lack of commitment and trust within a team undermines its effectiveness. Leaders must be trustworthy and earn trust, not demand it."
  • He mentions the book The Five Dysfunctions of a Team (which we’ve read as a team)
  • "The key to driving a consistent culture is not about high-minded principles or values alone. People learn from consequences. Drive consistent behaviors, norms, and values through clearly defined consequences."
  • "Seek low maintenance, low drama personalities. Value traits like strong task ownership, a sense of urgency, and a no-excuses mentality. Hire drivers, not passengers, focusing on attitude and behavior, which are choices, not skill sets."
  • Five questions to evaluate culture
    • When you talk to frontline employees, do they seem energized, or does it feel like everyone is swimming in glue?
    • Do people have clarity of purpose and a sense of mission and ownership?
    • Do they share the same big dreams of where the organization might be in a few years?
    • Do most people execute with urgency and pep in their step?
    • Do they consistently pursue high standards in projects, products, talent, everything?
  • Actionable Tip: During hiring, prioritize candidates’ drive and passion as much as their skills and experience
  • Benefit: Creates a dynamic, motivated workforce that can drive and sustain growth

Implement a Customer-Centric Approach

  • "If you have a customer success department, that shouldn’t give others an excuse to stop worrying about how well customers are thriving with your products. Responsibility for customer’s well-being should remain with those directly interacting with them."
  • Actionable Tip: Regularly gather and analyze customer feedback to inform business decisions
  • Benefit: Ensures that your products and services remain relevant and valuable to your target market

Maintain Startup Agility While Scaling

  • Rely on data-centric growth models (which you have to have!)
  • Actionable Tip: Encourage innovation and risk-taking, especially as your business grows
  • Benefit: Helps in sustaining the entrepreneurial spirit and agility necessary for continuous growth

Exploit Market Opportunities

  • "Growth trumps everything else as a driver and predictor of long-term success. Super-grower companies (60% or more annual growth) have significantly higher returns and likelihood of reaching substantial revenues than medium growth companies."
  • Actionable Tip: Train teams in market analysis and trend spotting to identify and capitalize on new opportunities
  • Benefit: Keeps your business ahead of competitors by swiftly responding to changing market dynamics

Develop Resilient Leadership

  • Actionable Tip: Invest in leadership development programs that emphasize adaptability and resilience
  • Benefit: Prepares leaders to effectively navigate challenges and lead the organization through periods of change

Promote Continuous Learning and Adaptation

  • Actionable Tip: Establish a culture of learning where feedback is actively sought and acted upon
  • Benefit: Fosters an environment where continuous improvement is the norm, leading to sustained growth and innovation

It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat. ~ Theodore Roosevelt

Linux

50+ commands ChatGPT thinks you should know about Terminal aka Command Line

TL;DR

Hey there and happy Wednesday* 👋

*a day on which, historically, most people wed on; thus: Wed nes day
Not really, but it would be a fun fact actually 🙂

OK, back on point; in this post, I’m going to take you through the basics of using the Terminal aka (as the cool kids using Windows call it) the Command Line. We’ll cover some basic commands, why it’s super useful, and how you can start flexing your command line muscles in no time!

Reality Check

Nowadays, on your first day at a new tech job, you probably aren’t going to be asked to ‘just SSH into the server and deploy the latest build.’. However, that doesn’t mean that knowing the basics of moving around the Linux system is something you shouldn’t learn. If nothing else, it’ll give you additional knowledge; and that’s why you came into this industry, right?

Great, then let’s go 💪

Why Terminal, You Ask?

Yes, the command line can seem intimidating with its blinking cursor and lack of buttons, but it’s really not that scary. Think of it as a conversation with your computer – you just need to know the right words.

Installing the Terminal 😏

Usually, you don’t need to install it; it comes with your operating system. But if you’re on Windows, you might want to look into installing something like Git Bash or PowerShell for a better experience. Or, better yet (if you don’t have a Linux server handy), try it out in a sandbox…

Experimenting in the Sandbox

The best way to learn is by doing. Don’t be afraid to experiment with commands.

The worst that can happen? You might delete your whole system 🙂. So, I suggest using something like https://cocalc.com/ (there are many more options like this, Google them) to test it out in a so-called sandbox environment.

Essentials

1. Opening the Terminal

First things first. To start using the Terminal, you need to open it. On macOS, you’ll find it in Applications > Utilities. Windows folks, look for Command Prompt or PowerShell`. Linux users, you probably already know what you’re doing 🙂

2. The Basic Commands

  • pwd (Print Working Directory)
    • This command tells you where you are. It’s like asking, "Hey Terminal, where the heck am I in this file system maze?"
    • You’ll get an output something like: /home/nikola
  • ls (List)
    • Want to know what files are lurking in the current directory? Just type ls. It’s like peeking into a room to see what’s inside.
  • cd (Change Directory)
    • Need to move around? Use cd followed by the directory’s path. It’s your ‘teleport’ command.
    • If you press ENTER after just the cd command, it will place you in your home directory (/home/nikola in my case)
  • mkdir (Make Directory)
    • To create a new folder, use mkdir followed by the name you want to give it. It’s like conjuring a box out of thin air.
    • For example: mkdir newFolder

3. Editing and Viewing Files

  • touch
    • Create an empty file; for example: touch file.md
  • nano, vim, or emacs
    • These are text editors available right in the Terminal. It might not be as fancy as your VS Code, but it gets the job done. For example, to open the file file.md type nano file.md
    • If you’re really just starting out, go with nano, or be lost in vim forever
    • Jokes aside, there’s a certain level of satisfaction and productivity among folks that master vim
  • cat (Concatenate)
    • Want to quickly view the contents of a file? cat followed by the file name will display it for you. No need to open it in an editor.
    • Example: cat file.md

4. File Manipulation

  • cp (Copy)
    • Use this to copy files or directories.
    • Example: cp file.md file-copy.md
  • mv (Move)
    • Use this to move or rename files or directories.
    • Example: cp file.md file2.md
  • rm (Remove)
    • ⚠️ Be careful with this one as it deletes files or directories. There’s no going back, so use it wisely!

5. Getting Help

  • man (Manual)
    • Stuck with what a command does? Type man followed by the command, and you’ll get a detailed manual. It’s like asking for directions.
    • Example: man ls will give you all the info about the ls command

6. The Power Moves

  • echo
    • output to the console whatever you put in quotes
    • Example: echo "testing" will output ‘testing’ to the console output
  • >
    • redirect the output of a command to another file or program
    • Example: echo "testing" > file.md will overwrite the file.md with the word ‘testing’
    • If you want to append, instead of overwrite, use >>
  • grep
    • This command lets you search through files for specific text. It’s like having a searchlight.
    • Example: grep 'testing' file.md
  • | (Pipe)
    • This symbol is used to take the output of one command and use it as the input for another. It’s like connecting Lego blocks to build something cool.
    • Example: ls | grep "myFile"
    • this command sequence will list all files and directories, but only display those whose names include "myFile".

7. SSH and Remote Servers

  • ssh (Secure Shell)
    • This is how you remotely log into another machine. It’s like teleporting to a different computer.
    • Example: ssh -p port_number username@remote_host

8. Understanding File Paths

File paths can be tricky for beginners. Remember, there are absolute paths (which start from the root directory aka /) and relative paths (which start from your current directory). For example, /Users/nikola/Documents is an absolute path, while Documents from your home directory is a relative path.

If you’re currently positioned in /var/www, then doing cd Documents will probably give you an error that the Documents folder doesn’t exist. However, if you use the full path (cd /Users/nikola/Documents), it will work.

9. Advanced File Operations

  • find
    • A powerful tool for searching files and directories. It’s like having a GPS for your files.
    • Examples:
    • find . -name "filename.txt" – find files by name
    • find /path/to/search -name "*.txt" – find files with a specific parttern
    • find /path/to/search -size +100M – find files based on size
    • find /path/to/search -perm 644 – find files with a certain permission
  • locate
    • Used for finding the location of files and directories
    • Example: locate filename.md

10. Networking Commands

  • ping
    • Check if you can reach another computer or server.
    • Example: ping example.com
  • curl
    • Fetch data from or send data to a server, especially useful for testing APIs.
    • Examples:
    • curl http://example.com – fetch a web page
    • curl -O http://example.com/somefile.zip – download a file
    • curl -d "param1=value1&param2=value2" -X POST http://example.com/form – send POST data
    • curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://example.com/api/login – pass headers
    • curl -b "name=value" http://example.com – use cookies

Additional things that could be useful to you

11. Exploring Environment Variables

  • Environment variables are key-value pairs used by your operating system to manage various system properties. They come in handy for storing data like file paths and configurations.
  • Example: use echo $VARIABLE_NAME to view the value of an environment variable, and export VARIABLE_NAME=value to set one.

12. File Compression and Archiving

  • tar, gzip, zip
    • These commands are used for compressing and decompressing files. They are crucial for managing file sizes and preparing data for transfer.

13. Remote File Transfer

  • scp (Secure Copy)
    • A command for securely transferring files between your local machine and a remote server. It’s like FedEx for your files.
    • Example: scp username@remote_host:/path/to/remote/file.txt /path/to/local/directory
  • rsync
    • A utility for efficiently transferring and synchronizing files across computer systems.
    • Example: rsync -av /path/to/local/dir username@remote_host:/path/to/remote/dir

14. Monitoring Disk Usage

  • df
    • Displays the amount of disk space used and available on your file systems.
  • du
    • Estimates the space used by files and directories.

15. Managing Processes

  • ps
    • Reports a snapshot of the current processes.
  • kill
    • Send a signal to a process, typically used to stop a process.

16. Networking and Port Management

  • netstat
    • Displays network connections, routing tables, and interface statistics.
  • ifconfig
    • Used to configure, or view the configuration of, a network interface.

17. Exploring System Logs

  • Logs are a goldmine of information. Use cat or less to view log files typically stored in /var/log and understand what’s happening under the hood.

18. Crontab for Scheduling Tasks

  • crontab is used for scheduling tasks to run at specific times. It’s like setting a smart alarm for your scripts.
    • Examples
    • with crontab -e command, you’ll be able to edit the crontab file
    • if you want to run a script /path/to/script.sh every day at 5:30 PM, you would add the following line: 30 17 * * * /path/to/script.sh

19. Command History

  • Your Terminal remembers your past commands. Use the history command to recall previous commands or Ctrl + R to search through your command history interactively.

20. Linking Directories with Symbolic Links:

  • ln -s
    • create symbolic links to files and directories. It’s like creating shortcuts.
    • Example: ln -s /path/to/original.txt /path/to/link.txt

21. Managing Users and Groups

  • useradd, usermod, groupadd
    • These commands are used for creating and modifying users and groups. They’re important for managing access on multi-user systems.

22. Disk Partitioning and Mounting

  • fdisk, mount
    • These commands are for managing disk partitions and mounting filesystems. They’re essential for organizing and accessing different storage devices.

23. Networking with nc and telnet

  • nc and telnet
    • These tools can be used for various network operations like port scanning, sending raw data to ports, etc.

24. Advanced Text Processing

  • cut, sort, uniq, tr
    • These text-processing commands are powerful tools for data analysis and manipulation in the command line. Check them out

25. System Information Commands

  • uname, lscpu, lshw
    • These commands provide detailed information about your system’s hardware and software configuration.

26. Learn/Customize Terminal Shortcuts

  • Learn keyboard shortcuts for your Terminal for efficiency.
  • Examples:
    • Ctrl + A to go to the beginning of the line
    • Ctrl + E for the end
    • Ctrl + K to delete from cursor to the end

27. Checking System Health and Resources

  • vmstat, iostat
    • Use these commands to monitor system performance and resource utilization.

28. Exploring System Services and Daemons

  • systemctl, service
    • These commands help you manage system services and daemons in Linux.

29. Filesystem Check and Repair

  • fsck
    • Check and repair Linux filesystems. It’s an essential tool for system maintenance.

30. Securely Deleting Files

  • shred
    • Securely delete files from your filesystem so that they are nearly impossible to recover.

13 additional things you could look into

  • Customizing Your Terminal
    • You can customize the look and feel of your Terminal. Play around with .bashrc or .zshrc (depending on your so-called shell) to change your prompt, add aliases for commands, or even add some fun colors.
    • Or, just install Oh My ZSH!
  • Scripting and Automation
    • Once you’re comfortable, start exploring shell scripting. You can automate repetitive tasks with simple scripts, making your life a whole lot easier.
  • Version Control with Git
    • The Terminal is a friend of Git, a popular version control system. Here’s one tutorial I wrote: Learn Git fast as if your job depends on it
  • Understanding Permissions
    • Files and directories have permissions that determine who can read, write, or execute them. Commands like chmod and chown help you manage these permissions.
  • System Information and Monitoring
    • top or htop
    • These commands give you a real-time overview of what your system is up to. It’s like a dashboard for your computer’s engine.
  • Working with Text
    • awk, sed
    • These are text-processing utilities. They’re complex but incredibly powerful for manipulating text files.
  • The Power of Wildcards
    • Learn how to use wildcards (*** and ?**) for matching file patterns. It’s like casting a net to catch specific files.
  • The Almighty Root User
    • Be cautious with the sudo command – it gives you root (administrator) privileges. With great power comes great responsibility.
  • Package Management
    • Get familiar with package managers like apt for Ubuntu or brew for macOS. They are like app stores for your Terminal.
  • Understanding Filesystem Hierarchy
    • Explore the standard filesystem hierarchy in Linux/Unix systems (/etc for configurations, /var for variable files, /home for user directories). It’s like learning the layout of a new city.
  • Understanding the Root Directory Structure
    • Each directory under / (root) in Unix-like systems has a specific purpose (/bin for binaries, /lib for libraries). Knowing this structure helps you navigate the filesystem more efficiently.
  • Exploring Regular Expressions
    • Regular expressions are patterns used to match character combinations in text. They are a powerful tool in command-line text processing.
  • Exploring Different Filesystems
    • Learn about different filesystems (ext4, NTFS, FAT32) and their characteristics.

Conclusion

There you have it – an extensive beginner’s guide to the Terminal, pushing well past the basics.

Remember, it’s all about practice and exploration. The command line is a powerful tool in your developer toolkit, so embrace it, play with it, and watch as your computer skills reach new heights.

Welcome to the club of command line aficionados, and as always, happy coding! 💪

Books

Tools of Titans by Tim Ferriss

Here are my highlights from a highly recommended book Tools of Titans by Tim Ferriss, broken down into few sections.

Just as a note for myself; of all the people (excluding the world-known like Schwarzeneger), I’d say that Derek Sivers peaked the most interest for me.

Personal Growth and Ambition

  • Routine in an intelligent man is a sign of ambition
  • The quality of your questions determines the quality of your life
  • You realize that you will never be the best looking, smartest, or most educated person in the room, but you can always compete on hard work
  • Never go to sleep without a request to your subconscious

Success and Life Balance

  • Success is about being the best dad who is always approachable and an expert in your field
  • Being busy is a form of laziness
  • Life shrinks or expands in proportion to one’s courage (to have the unpleasant conversations)
  • Most people will choose unhappiness over uncertainty (don’t be like most people)

Health and Well-being

  • Magnesium is one of the best anti-aging minerals
  • Depression may be the body’s way of saying you need to deal with something that’s making you sad
  • Full hip and ankle range of motion is crucial; fix it if you can’t squat all the way down
  • Give meditation an honest shot

Innovation and Creativity:

  • The goal isn’t to get good ideas, but to get enough bad ones so the good ones start showing up (divide your paper into columns for ideas and their first steps)
  • Perfectionism is the enemy of the idea muscle
  • Have fun with your creative process, or it won’t stick

Business and Entrepreneurship

  • In negotiation, he who cares the least wins
  • It’s not what you know, it’s what you do consistently
  • Money can always be regenerated. Time and reputation cannot.
  • What you choose to work on and who you work with are more important than how hard you work

Overcoming Challenges:

  • The dirty little secret is that every success was almost a failure
  • Perfectionism leads to procrastination, which leads to paralysis
  • Ask yourself: what am I continuing to do myself that I’m not good at?
  • Desire is a contract you make with yourself to be unhappy until you get what you want

(Unique) Concepts

  • The jar of awesome
  • Daily journaling (by adding a gratitude section)
  • Sauna (followed by a cold shower or a tub) FTW
  • Physchodelics (not something I’m keen on trying any time soon 🙂)
Leadership

8Questions™

TL;DR

In this post, I’ll share the infamous 8Questions™ that we use when onboarding a new team member. Each person sends the answers to these questions in a written form prior to the first 1on1 with their manager.

8Questions™

  • What is the last awesome thing you learned and what do you want to learn next?
  • Tell me about three (or more) things you’ve accomplished in the last year that you are proud of
  • What are a few things that you wanted to achieve in the previous year but didn’t get to yet?
  • What do you enjoy most about your job?
  • What is your current biggest frustration (if any)?
  • What are your aspirations for yourself and/or the company in the next 1-2 years?
  • In what ways do you think I can help you the most?
  • Is there anything else you want me to know/any concerns you have?
Page 2 of 51«1234»102030...Last »

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak