How to Open URL in Chrome Browser from Python Application?

You can open URL in a browser and also specify to open the URL in Chrome browser specifically.

To open URL in a browser, we will use webbrowser python module.


Follow these steps in your Python Application to open URL in Chrome Browser.

  1. Register the browser type name using webbrowser.register(). Also provide the browser executable file path.
  2. Get the controller object for the browser using webbrowser.get() and Open URL using open()

le 1: Open URL in Google Chrome

In this example, we will open the URL https://pythonexamples.org in Chrome browser.

Python Program

import webbrowser

url = 'https://pythonexamples.org'
webbrowser.register('chrome',
	None,
	webbrowser.BackgroundBrowser("C://Program Files (x86)//Google//Chrome//Application//chrome.exe"))
webbrowser.get('chrome').open(url)


webbrowser.get('chrome').open(url) opens a new window if already not opened, or opens in a new tab if Chrome is already opened in your PC.

Output

Example 2: Open URL in a new Google Chrome Window

At times, there would already be a Chrome browser opened and you would like to open this URL in a new window.

In this example, we will try to open the URL https://pythonexamples.org in a new Chrome browser.

Python Program

import webbrowser

url = 'https://pythonexamples.org'
webbrowser.register('chrome',
	None,
	webbrowser.BackgroundBrowser("C://Program Files (x86)//Google//Chrome//Application//chrome.exe"))
webbrowser.get('chrome').open_new(url)

open_new() tries to open a new Chrome browser window, only if possible.

Summary

In this tutorial of Python Examples, we learned how to open a URL in Chrome browser.

A Simple Script for Adding Users to your AWS EC2 Instance

A Simple Script for Adding Users to your AWS EC2 Instance

As a systems administrator adding users is a multi-command process that can also be very time consuming. Fortunately, the right BASH script can save you time and keystrokes.

In this article, I am going to show you my useradd.sh script and how you can use it to seamlessly add users to your cloud system four simple, easy-to-follow steps:

Special Note: You must have root privileges on your system, in order to effectively run a script like this. If you don’t have root access, you script will not execute properly.

Prerequisites
Basic AWS services knowledge
An active AWS account with a running EC2 instance
Familiarity with the CLI and basic Linux commands
Basic BASH scripting knowledge
Basic understanding of Git and command knowledge
A GitHub.com account with a created personal access token (PAT)

Step 1: Creating Your Script
SSH into your your remote instance. Mine happens to be AWS EC2. Your’s might be different. Once logged in, create your script using the nano command:
nano useradd.sh
A Simple Script for Adding Users to your AWS EC2 Instance
I’ve provided you with a simple script below. When executed, this script will:

Direct the user to create a username
Direct the user to set a password
Checks username against existing usernames to ensure one doesn’t already exist
Uses a perl function that encrypts and writes the password securely to /etc/shadow
Sends a confirmation message or returns an error message
#!/bin/bash
# Automatically add a user to the server

if [ $(id -u) -eq 0 ]; then
        read -p "Select a Username : " username
        read -s -p "Set your Password : " password
        egrep "^$username" /etc/passwd > /dev/null
                if [ $? -eq 0 ]; then
                                echo "$username already exists. Please choose a different username."
                                exit 1
                        else
                                pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
                                useradd -m -p $pass $username
                                [ $? -eq 0 ] && echo "You have been successfully added to the system" || echo "Authentication Error. Failed to Create New User"
                        fi
                else
                        echo "Only a user with administrative privledges may add a user to the system."
                        exit 2
                fi
Hit [CTRL+X] to exit nano. Save the file prior to exiting. Confirm file name (useradd.sh)

Now that your script is written, you need to make it executable:

chmod u+x useradd.sh
Step 2: Running Your Script
Run your script:

sudo ./useradd.sh
When prompted, select a username hit [ENTER] and set a password and hit [ENTER].

If you were successful, your should see something similar in your terminal


You will receive a prompt telling you that the user was added successfully
Step 3: Change the EC2 Configuration File to Allow for Password Authentication
In AWS, it’s not enough to create a script that will add a new user. We must also edit the sshd_config file in the /etc directory to allow this. Let’s do this now in your CLI:

Switch to the root user:

sudo su
Open the sshd_config file in your preferred editor:

nano /etc/ssh/sshd_config

Change the PassWordAuthentication from ‘no’ to ‘yes’
You might need to scroll. Find the line “PasswordAuthentication no” change to “Password Authentication yes”. Type [CTRL+X] to exit. Hit “Y” to save the changes to the file, Hit [ENTER] to exit back to your working directory in the CLI.

Now, we need to restart sshd. Do this with the following command:

service sshd restart
If successful, you should recieve a similar message:


Step 4: Verify Results via SSH into our EC2 Instance Using the New User’s Credentials
Finally, to test to see if our script and updating the SSHD file worked. We log out of our instance and try logging in as our newly added user “cjones”:

ssh cjones@<EC2-xx-xxx-xxx-xx.compute-1.amazonaws.com
When prompted, we enter the password that we assigned to “cjones”. Hit [ENTER]. If everything was successful, you should now be logged in as the user you added using your BASH script:


BONUS STEP: Adding our Script to our GitHub Account
Now that we’ve tested our script for adding users. Let’s save it to our GitHub repository. In a previous article, I talked about how to Push Remote Scripts to GitHub for Later Use.

If you are interested in preserving your script for a GitHub repository, I highly encourage you read that as I will not go over specifics here with how to clone, stage, commit, and push a repo.

Now onward to our steps to add our script to our GitHub account:

Login to your EC2 instance with the user with which you constructed your script:


We’re going to move our script into our git repository:

mv useradd.sh scripts/
Move into our git repository:

cd scripts/
Instruct git to stage our script:

git add useradd.sh
Instruct git to stage our commit with a memo:

git commit -m "Automatically adds a user to the system and prompts for a password"
Push our git cloud-ward to our GitHub repository:

git push origin main
Finally, we can double check out GitHub.com repo to verify our push:


Secrets of successful peoples



‘Nepo Babies Have Feelings’: Lily Allen Says the Real Villains Are in Politics, Not Hollywood

 

‘Nepo Babies Have Feelings’: Lily Allen Says the Real Villains Are in Politics, Not Hollywood


And before you come at me for being a nepo baby myself, I will be the first to tell you that I literally deserve nothing," the singer wrote on Twitter

IMAGINE THE SPIDERMEN pointing at each other meme except, instead of Spidermen, it’s different industry subsets of nepotism babies. The discourse around famous people with famous parents, distant relatives, or not-so-distant family friends has become the center of conversation in Hollywood as of late, and now the nepo babies themselves are coming to their own defenses. In a recent series of tweets, Lily Allen made the case that the real nepotism-wielding villains aren’t in Hollywood, they’re in Washington D.C., and on Wall Street.

“The nepo babies y’all should be worrying about are the ones working for legal firms, the ones working for banks, and the ones working in politics, if we’re talking about real world consequences and robbing people of opportunity,” Allen, daughter of actor Keith Allen and film producer Alison Owen, wrote. “BUT that’s none of my business.”

The singer and songwriter went on to clarify that her intent wasn’t to suggest that art forms like film and music are devoid of external influence and consequences, but that access to being able to earn a sustainable living in those fields is almost directly restricted by lawmakers and money handlers.

How to Get Traffic to Your Blog in 2023: A Beginner’s Guide

 As a small business, you’ll often hear that a blog can be a critical success factor in your online growth.

As a result, you may have gone ahead and registered a domain, paid for hosting, and even settled on a preferred content management system. But now comes the really tricky part: attracting visitors to your site.

Fortunately, even if you’re brand new to blogging, or you’re an existing business struggling to see results, there are plenty of things you can do to start getting eyes on your content.

How to Drive Traffic to a Blog

There are actually several sources you can target to attract traffic to your blog. These include:

  • Direct traffic: When a visitor arrives directly on your website (i.e. they typed your URL into their browser).
  • Referral traffic: When a visitor has clicked a link on another website to arrive on your site. This link can be within that site’s content, or as part of a directory, for instance.
  • Paid traffic: When a visitor arrives on your site by clicking on a paid advertisement (such as a search ad or a display ad).
  • Email traffic: When a visitor arrives via a link in one of your emails.
  • Social traffic: When a visitor arrives via a link on your social media feeds.
  • Organic traffic: When a user searches for a particular term or query in a search engine, and your content appears as a result. The user then clicks on that result, taking them to your site.

For a new blog, though, it’s a good idea to target organic traffic. These visitors are actively looking for the information that your content provides, and, as a result, they are more likely to engage with that content (and possibly even become leads).

With this in mind, here are 6 key steps you can follow to start building your organic blog traffic.

Step 1: Get to Know and Understand your Audience

An important starting point for generating blog traffic is understanding the audience you are trying to reach. This includes having a solid grasp of what their needs, concerns, issues, pain points, and interests are, as this will help guide the content you create. A particularly effective way of getting to know your target audience is to go where they go. In an online context, this usually means social media groups, forums, message boards, webinars, and online events.

Identify the most active of these communities, and then take the time to monitor and comprehend the issues and interests that they discuss. For example, what are their most commonly asked questions? What topics seem to dominate the conversation? What problems or challenges are they facing?

As you become more integrated into these communities, you can start to contribute to these discussions, and gauge the reactions and responses you get. The point of this isn’t to try and pitch to them or convince them of anything; it’s simply a way to get to know your audience better. 

Document your findings, too. Write down the pain points, questions, and discussion topics you uncover in a spreadsheet or a word processing document, as you will need them for the next step.

Step 2: Conduct Keyword Research

Keywords are crucial when it comes to generating organic traffic. They are the words, queries, or phrases that users type into search engines, and can often be the starting point of how visitors find your site. A core element of acquiring blog traffic is identifying the most suitable keywords for your business, and then creating content that targets these keywords.

This is why keyword research is important. To conduct this process efficiently and effectively, it’s helpful to have access to a reliable source of keyword data so you can quickly discover which keywords attract the highest monthly volume, as well as how difficult those keywords are to compete for.

For example, let’s say you run a small skateboarding shop. Based on your audience research, you may have learned that the most popular discussion topics among your target audience are based around actually learning how to skateboard.

Using the pain points, questions, and topics that you’ve already documented — as well as any other relevant terms or phrases that are related to your product, business, or industry — you can start to compile a list within your keyword tool. 

lBb3FTEIsf3k6yE6Ot7VKXZWzUS4QKDnI22dQKqEAnIkZxHAENS8zr2UbGlflRkgX8dbMBbQp-MhkgEy91U-AwQA8DpEZ2b6DX2uTMkhkISefoDc_YkaaAOI_aYbqG1tmK-9cLhl=s0

If your blog is brand new and has little or no authority, one of the most important metrics to note here is Keyword Difficulty (KD). 

When starting a blog from scratch, it’s highly recommended to focus on keywords that hit a “sweet spot” between high search volume and low keyword difficulty. Another term for this is “keyword efficiency.” 

Using the example above, the keyword “how to skateboard” gets a high number of monthly searches (12.1K) and it has a keyword difficulty score of 50,  Given that “how to skateboard” is a very broad term, this is unsurprising.

However, consider the keyphrase “how to stand on a skateboard.” In the tool, the keyword difficulty score is “low” (20), yet it still attracts a healthy number of monthly searches (2.4K). 

So, what can we take away from this data? That “how to stand on a skateboard” could be a potentially great keyword to target for a blog that’s geared toward an audience interested in skateboarding. 

It’s a niche angle, with a high search volume and low competition level, so it may be easier to rank for on a search engine results page (SERP). This can then allow you to start gaining traction in terms of organic traffic to your blog.

QJ5ghrZ0Rvq6SzzGgTC89DnawYUhzLlUGFR72aqX4cYfJl3ebCpT8-GC9Whz9qC293zTaJA-MwJ3OcKdehwW1nabVUo3M_7NbIXmnjrol7r6_-1ImtbNLD1SUcYA7bgwUhrKaLfL=s0

Analyzing what your competitors are doing (or not doing) is another effective way to find suitable keywords that help drive traffic to your blog.

Step 3: Create Your Content Plan

At this stage, you should now have a sizable list of relevant and efficient keywords to craft your blog around. The next step is to build on this by figuring out how to create content that capitalizes on these keywords.

A relatively simple way of doing this is to input the keyword into a search engine and then manually review the top 10 results. In particular, you should consider the titles, angles, and structures of these results, as they will give you a good idea of the kind of content that searchers are looking for.

PTafzaJdUSE_GaLSFT-zdWFCaxi0A45-w8tMtoO1Duw98fifEBg2oy_EX7BngggkewH0rGQgFKEWiRu32S7m9Ntkjz6bMWeJeq5X762BzsLnks2InaONil90m_tdBiYUyM7SUttV=s0 

You can even see which topics are trending, allowing you to develop content that could potentially capture the attention of your audience before competitors do. 

ndpjFDjIDJtwrPzDC-hDGiqH_-VB8O8aVsGlc2GaQAgtiOy-FAw67Qq4kNEGtdAtQOE9U7FJGp_y2ZQ5K-BP9jIS43NhqjfUjI-mF5g-jGHI41910YuGGm_bIniBUdmz9384UKXJ=s0

In addition, you can get a closer look at some of the blog posts that are already ranking for this topic. Having this insight can help you to spot gaps in their content that you could fill in yours, providing better value to your reader. Blog posts that are more comprehensive and informative than your competitors’ can help you to rank higher and increase your traffic.

PIPQPqEKYQ3ZrFsosFUXTLlAuJbHnGH0BNYM6-KMrNf6FQtwVReaEY38ROI-l98Jq9f_342lU81Obee31RqO3CmLOitKg81v-eWRc_wkULLM0TLmI8KGgvdbQYHPACVmqISNDDXO=s0

Step 4: Structure Your Subtopics

As mentioned in the last step, it’s a good idea to break overarching subjects into smaller subtopics, especially when your blog is new. As well as helping you to target keywords more efficiently, it also allows you to build up an ongoing stream of topics to write about.

For instance, if your subject is learning how to skateboard, you could create a whole sequence of blog posts under that umbrella, such as:

  • how to do an ollie
  • best skateboards for beginners
  • what equipment do you need for skateboarding

As you grow, you may want to focus on other subjects within your niche, and then build out those subtopics too.

Another benefit of doing this is that it allows you to repurpose your content further down the line. You can take all of those subtopic blog posts and merge them together into an eBook, or even combine the key elements of each post to create a comprehensive “master” article targeting that broader keyword.

This allows you to cover topics in a lot more depth, helping you to establish your blog as an authority on that subject. In turn, this makes your content more conducive to attracting external backlinks. Both of these things help to boost your SEO profile, which, again, can help you to rank higher and attract more traffic.

Step 5: Write!

Once you’ve finalized your keywords and your topics, the next step is to sit down and actually write your blog posts. For a lot of people, this is where things can start to really get uncomfortable.

Indeed, the writing aspect of content creation can seem daunting, overwhelming, and time-consuming, especially for a busy business owner. But there are plenty of ways to make this step of the process less painful, all of which are covered in our comprehensive blog writing guide.

 These can help to ensure that your content is optimized and structured in both a reader- and SEO-friendly way.

Of course, if you simply don’t have the time or resources to write your own content, then you can outsource it to a trusted third party too. With our Marketplace service, for instance, you simply indicate the topic and the specific requirements for your article, and the Marketplace team will match you to a suitable, industry-specific writer.

This ensures that your published content is always of the highest quality, giving it the best possible chance to rank and attract traffic.

Step 6: Publish and Promote your Posts

Finally, your post is published and live on your blog. Now the traffic starts rolling in, right?

Well, not quite. Content — of any kind — doesn’t rank on search engines overnight. It takes time for their algorithms to judge the relevance and quality of a piece of content, and also for the content itself to acquire backlinks and satisfy other ranking factors.

Even though the steps above (and even other SEO writing tips and tactics) can help you rank on a SERP and increase the chances of people finding their way to your blog, getting your content in front of the right audience, at the right time, and in the right way, requires more than just hitting the “publish” button.

Given that your blog is new, it might not yet be feasible for you to distribute your content to your audience via other traffic sources, either. You may not have an email list or a sizable social media following, and you might have little to no budget to leverage paid search.

But that’s OK. It just means that, at first, you will need to do a bit more leg work yourself to distribute and promote your content. Start by: 

  • Engaging directly with communities. Remember those people you engaged with in Step 1 via online forums, social media, and other online communities? Share your content with them. For instance, going back to the skateboarding example, you might come across a discussion about various skateboard types. If you happen to have a blog post reviewing different types of boards, you could share it in the forum as a helpful resource to the community having that discussion. The takeaway for this tip, however, is to use discretion. Share your content because it has value to offer, not because you have an ulterior motive to try and sell someone something. If you build trust and respect with your audience, they’ll eventually come to value your perspectives and know that you’re sharing information with them because it’s interesting, or it can help them solve an issue. Always respect the rules of the online community, too, as many, such as Reddit, frown upon self-promotion. However, if you’re not spamming and the links you post are genuinely relevant to what is being discussed, this can be an effective tactic for both brand awareness and cost-effective traffic acquisition.
  • Building relationships with respected players. If your content is useful, trustworthy, and valuable to your audience, then other respected voices in your niche — such as influencers, bloggers, affiliates, and even public figures — may be more open to sharing and promoting it.

Although time-consuming, it can be a smart, cost-effective strategy to build relationships with these people and collaborate with them. That might be through guest posts, newsletters, mentions, or webinars. Not only can these connections help you build credibility and authority in your space, it can also make it easier to get relevant backlinks to your blog posts, boosting your SEO profile, attracting additional referral traffic, and strengthening your organic presence.

  • Advancing your authority. At this stage, you may not yet have a strong online presence, but this doesn’t necessarily mean that you’re not an authority in your niche. Although your blog — even your business — might be a new kid on the block, you may have years of experience in your given industry.

It’s to your advantage to elevate that. Consider making yourself available as a guest speaker for webinars, podcasts, digital conferences, and other online events. This can give your blog wider exposure and attract relevant traffic to your blog.

img-semblog

Final Thoughts

Attracting high-value traffic to a new blog is not easy, but it is achievable if you approach it in a considered way.

As noted above, the writing aspect of getting high-quality, relevant traffic to your blog is only one step in the process. You might discover that you’re quite skilled at all the pre- and post-work that goes into creating and promoting a great blog, but that the writing portion just isn’t the best use of your time. Not only is that OK, it’s actually quite common. It’s part of the reason we created the Content Marketplace. We understand how complex and time-consuming it is to create great content, so we created a service that can help people focus on what they know and do best, leaving the writing to the wordsmiths.

Microgrids - What is a Microgrid?

 

At-a-glance

  • Microgrids provide less than 0.2 percent of U.S. electricity, but their capacity is expected to more than double in the next three years.
  • Of the 160 microgrids in the United States, most are concentrated in seven states: Alaska, California, Georgia, Maryland, New York, Oklahoma, and Texas.
  • Interest in microgrids is growing because of their ability to incorporate renewable energy sources and sustain electricity service during natural disasters.
  • To increase deployment, a clear legal framework is needed to define a microgrid and set forth the rights and obligations of the microgrid owner with respect to customers and the larger utility grid operator.

What is a Microgrid?

Microgrids are relatively small, controllable power systems composed of one or more generation units connected to nearby users that can be operated with, or independently from, the local bulk (i.e. high-voltage) transmission system, sometimes referred to as the “macrogrid.” Since the energy (power and heat) are created close to where they are used, microgrids are a form of distributed generation.

Historically, microgrids generated power using fossil fuel-fired combined heat and power (CHP) and reciprocating engine generators. Today, however, projects are increasingly leveraging more sustainable resources like solar power and energy storage. Microgrids can run on renewables, natural gas-fueled combustion turbines, or emerging sources such as fuel cells or even small modular nuclear reactors, when they become commercially available.

They can power critical facilities after a weather- or security-related outage affects the broader grid. Microgrids can also be the main electricity source for a hospital, university, or neighborhood. While single-user and campus microgrids, such as those that serve an industrial site or military base, have existed for decades, many cities are now interested in systems that can better integrate generation resources and load, serve multiple users, and/or meet environmental or emergency response objectives.

Several variations (and combinations) of microgrids are possible:

  • Number of customers: Microgrids can serve a single building, multiple customers in a limited geographic area, or customers across an entire community. Microgrids commonly range in size from 100 kilowatts (kW) to multiple megawatts (MW).
  • Load types and functions: A general purpose microgrid provides or supplements the services customers might otherwise receive from the macrogrid. A “community microgrid” serves a public purpose, such as powering police and fire stations, cell towers, and pumping city water and wastewater during emergencies. Community microgrids can also serve general purpose needs by providing power to displace or supplement service from the macrogrid on a day-to-day basis.
  • Connection type: An off-grid system does not connect to the macrogrid and thus must be a sufficient power source for its customer. A microgrid connected to a macrogrid has greater flexibility since the macrogrid functions as an additional resource.

Microgrids provide a tiny fraction of U.S. electricity. In 2016, the United States had about 1.6 gigawatts (GW) of installed microgrid capacity out of 1,066 GW total capacity. That is expected to increase to 4.3 GW by 2020. Most microgrid projects are in Alaska, California, Georgia, Maryland, New York, Oklahoma, and Texas.

Microgrids are attractive to many large U.S. companies committed to working on their own and in partnership with governments to transition to a sustainable low-carbon economy. For example, NRG Energy, one of the country’s largest independent power producers, has turned its Princeton, New Jersey, headquarters into a fully-islandable microgrid demonstration project laboratory from which the company can test ideas for real-world applications. NRG is also collaborating with grid operator PJM to explore ways that microgrids can help enhance macrogrid operations.

Example of a Microgrid

Mbappe Story: From getting lift from Zidane as teen to being France’s driving force

 

France superstar Kylian Mbappe on the left and Argentina superstar Lionel Messi on the right. (Reuters)

The ball looped towards Kylian Mbappe, 97 seconds after he had kicked in a penalty goal. He had barely touched the ball in live play until that 81st minute. He hadn’t shown any special feel for the ball, as if he were a mere pawn in Messi’s destiny. Now the ball was dipping towards him. It would have been understandable had he taken a touch, steadied himself, and taken aim. But nope. Instead, he goes for a remarkable volley, as if he has been in a hot streak all through the night. A true mike-drop moment. How does he do it? How did he bring the Kylian of Bondy, a tough neighbourhood in the north-eastern suburbs of Paris where he grew up, to the world cup stage on what seemed a nightmarish night?

Featured post

A23 Rummy - Safe Secure Gaming Platform

A23 Rummy is a popular online rummy platform in India. It is owned and operated by Head Digital Works Private Limited. The platform offers...