How to get the Screen Width in Javascript
Javascript gives a few options to determine the screen width.
When we say screen, we mean the browser window’s width itself.
In-depth guides, insights, and best practices for modern software engineering
Javascript gives a few options to determine the screen width.
When we say screen, we mean the browser window’s width itself.
If you need to read a file in Rust, then you can use the fs package from the standard library:
use std::fs;
fn main() {
let contents = …
Read Article →
If you need to convert an array to a string in Java, then you could look at a solution like this:
String stringArray[] = {"Hello ", " …
Read Article →
If you need to join two (2) strings together in Golang, you can do the following, using the + concatenation operator:
package main
import ( …
Read Article →
If you need to recursively delete all files in an AWS S3 bucket, then you can do the following:
aws s3 rm --recursive s3://your-bucket-name/foo/bar/ …
Read Article →
If you want to execute Linux commands in Golang, you can use exec.Command from the os/exec package:
cmd := exec.Command("echo", "hello …If you need to check for Prime Numbers in Golang, then you can use the following method:
const n = 1212121
if big.NewInt(n).ProbablyPrime(0) { …
Read Article →
If you need to raise a number to a power in Golang, then you can use the math.Pow function:
package main
import (
"math"
)
func …
Read Article →
If you need to get the CPU frequency in Linux, you can run the following command:
watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
This …
Read Article →How can python pandas disable warnings?
If you need to disable warnings with Pandas on Python, then you can use the warnings module and ignore the …
If we take the following list:
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', …
Read Article →
When you are trying to create an RDS database and you get the dreaded error message:
IAM role ARN value is invalid or does not include the required …
The following code expects a python file with the contents as follows in a file called python/script1.py:
def …
Read Article →
If you get the Instance Profile already exists error when running your Terraform apply, then it is either because an instance profile with that name …
If you are using aws configure sso to populate your ~/.aws/credentials file and you get the following error when you try and reauthorize, then you can …
If you need to match a string in a file, then grep is your friend.
grepLet’s take a file called somefile.txt
this
is
a
test …
Read Article →
If you want to invoke an AWS Lambda from your CLI, then the best option is to have the AWS CLI installed.
Getting started with the AWS CLI – AWS …
Read Article →Sometimes you might want to exit a command if a variable is not set in Bash.
You can do this as follows:
if [ -z "$VARIABLE_NAME" ]; then echo …
Read Article →
if you have a conditional in your Gitlab pipeline stage that checks if something has succeeded or failed, then you can use this to pass or fail your …
Read Article →If you find yourself having the requirements to support both AWS CLI v1 and v2 simultaneously, then you can use the following conditional in Bash to …
Read Article →If you have tried calling the AWS CLI and got the following error:
Unknown options: --cli-binary-format
Then it is because you are using the AWS CLI …
If you need to generate a random string that looks something like this: VUNBXJ-230411, then you can use the following random generator:
import random, …
Read Article →
If you need to check the version and flavour of the running Linux instance, then you can try the below commands:
cat /etc/os-release
lsb_release -a …
Read Article →
If you are using S3 as the backend for your state management in Terraform, then you can create environment specific configuration files where you …
Read Article →