How to minify files using nodejs

 Minification can help your website load several times faster

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here’s one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don’t skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

npx terser -c -m -o like_button.min.js -- like_button.js

This will produce a file called like_button.min.js with the minified code in the same directory. If you’re typing this often, you can create an npm script to give this command a name.

What is DevOps?

DevOps Model Defined

DevOps is the combination of cultural philosophies, practices, and tools that increases an organization’s ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes. This speed enables organizations to better serve their customers and compete more effectively in the market.

What is DevOps?

How DevOps Works

Under a DevOps model, development and operations teams are no longer “siloed.” Sometimes, these two teams are merged into a single team where the engineers work across the entire application lifecycle, from development and test to deployment to operations, and develop a range of skills not limited to a single function.

In some DevOps models, quality assurance and security teams may also become more tightly integrated with development and operations and throughout the application lifecycle. When security is the focus of everyone on a DevOps team, this is sometimes referred to as DevSecOps.

These teams use practices to automate processes that historically have been manual and slow. They use a technology stack and tooling which help them operate and evolve applications quickly and reliably. These tools also help engineers independently accomplish tasks (for example, deploying code or provisioning infrastructure) that normally would have required help from other teams, and this further increases a team’s velocity.

Learn about AWS DevOps tooling and services »

Benefits of DevOps

DevOps-What-is_scale

Speed

Move at high velocity so you can innovate for customers faster, adapt to changing markets better, and grow more efficient at driving business results. The DevOps model enables your developers and operations teams to achieve these results. For example, microservices and continuous delivery let teams take ownership of services and then release updates to them quicker.

DevOps-What-is_delivery

Rapid Delivery

Increase the frequency and pace of releases so you can innovate and improve your product faster. The quicker you can release new features and fix bugs, the faster you can respond to your customers’ needs and build competitive advantage. Continuous integration and continuous delivery are practices that automate the software release process, from build to deploy.

DevOps-What-is_reliability

Reliability

Ensure the quality of application updates and infrastructure changes so you can reliably deliver at a more rapid pace while maintaining a positive experience for end users. Use practices like continuous integration and continuous delivery to test that each change is functional and safe. Monitoring and logging practices help you stay informed of performance in real-time.

DevOps-What-is_scale

Scale

Operate and manage your infrastructure and development processes at scale. Automation and consistency help you manage complex or changing systems efficiently and with reduced risk. For example, infrastructure as code helps you manage your development, testing, and production environments in a repeatable and more efficient manner.

DevOps-What-is_collaboration

Improved Collaboration

Build more effective teams under a DevOps cultural model, which emphasizes values such as ownership and accountability. Developers and operations teams collaborate closely, share many responsibilities, and combine their workflows. This reduces inefficiencies and saves time (e.g. reduced handover periods between developers and operations, writing code that takes into account the environment in which it is run).

DevOps-What-is_security

Security

Move quickly while retaining control and preserving compliance. You can adopt a DevOps model without sacrificing security by using automated compliance policies, fine-grained controls, and configuration management techniques. For example, using infrastructure as code and policy as code, you can define and then track compliance at scale.

Why DevOps Matters

Software and the Internet have transformed the world and its industries, from shopping to entertainment to banking. Software no longer merely supports a business; rather it becomes an integral component of every part of a business. Companies interact with their customers through software delivered as online services or applications and on all sorts of devices. They also use software to increase operational efficiencies by transforming every part of the value chain, such as logistics, communications, and operations. In a similar way that physical goods companies transformed how they design, build, and deliver products using industrial automation throughout the 20th century, companies in today’s world must transform how they build and deliver software.

How to Adopt a DevOps Model

DevOps Cultural Philosophy

Transitioning to DevOps requires a change in culture and mindset. At its simplest, DevOps is about removing the barriers between two traditionally siloed teams, development and operations. In some organizations, there may not even be separate development and operations teams; engineers may do both. With DevOps, the two teams work together to optimize both the productivity of developers and the reliability of operations. They strive to communicate frequently, increase efficiencies, and improve the quality of services they provide to customers. They take full ownership for their services, often beyond where their stated roles or titles have traditionally been scoped by thinking about the end customer’s needs and how they can contribute to solving those needs. Quality assurance and security teams may also become tightly integrated with these teams. Organizations using a DevOps model, regardless of their organizational structure, have teams that view the entire development and infrastructure lifecycle as part of their responsibilities.

DevOps Practices Explained

There are a few key practices that help organizations innovate faster through automating and streamlining the software development and infrastructure management processes. Most of these practices are accomplished with proper tooling.

One fundamental practice is to perform very frequent but small updates. This is how organizations innovate faster for their customers. These updates are usually more incremental in nature than the occasional updates performed under traditional release practices. Frequent but small updates make each deployment less risky. They help teams address bugs faster because teams can identify the last deployment that caused the error. Although the cadence and size of updates will vary, organizations using a DevOps model deploy updates much more often than organizations using traditional software development practices.

Organizations might also use a microservices architecture to make their applications more flexible and enable quicker innovation. The microservices architecture decouples large, complex systems into simple, independent projects. Applications are broken into many individual components (services) with each service scoped to a single purpose or function and operated independently of its peer services and the application as a whole. This architecture reduces the coordination overhead of updating applications, and when each service is paired with small, agile teams who take ownership of each service, organizations can move more quickly.

However, the combination of microservices and increased release frequency leads to significantly more deployments which can present operational challenges. Thus, DevOps practices like continuous integration and continuous delivery solve these issues and let organizations deliver rapidly in a safe and reliable manner. Infrastructure automation practices, like infrastructure as code and configuration management, help to keep computing resources elastic and responsive to frequent changes. In addition, the use of monitoring and logging helps engineers track the performance of applications and infrastructure so they can react quickly to problems.

Together, these practices help organizations deliver faster, more reliable updates to their customers. Here is an overview of important DevOps practices.

Learn More

Accidentally ufw aws disable

Detach and fix the volume of the problem instance using another instance

  • Launch a new instance (recovery instance).
  • Stop the original instance (DO NOT TERMINATE)
  • Detach the volume (problem volume) from the original instance
  • Attached it to the recovery instance as /dev/sdf.
  • Login to the recovery instance via ssh/putty
  • Run sudo lsblk to display attached volumes and confirm the name of the problem volume. It usually begins with /dev/xvdf. Mine is /dev/xvdf1
  • Mount problem volume.
$ sudo mount /dev/xvdf1 /mnt
$ cd /mnt/etc/ufw

Open ufw configuration file

  $ sudo vim ufw.conf
  • Press i to edit the file.
  • Change ENABLED=yes to ENABLED=no
  • Type Ctrl-C and type :wq to save the file.
  • Display content of ufw conf file using the command below and ensure that ENABLED=yes has been changed to ENABLED=no
  $ sudo cat ufw.conf 

Unmount volume

 $ cd ~
 $ sudo umount /mnt
  • Detach problem volume from recovery instance and re-attach it to the original instance as /dev/sda1.
  • Start the original instance and you should be able to log back in.

If you have any problem please call me aws support – +91-9555699081

How to manage Journal logs in ubuntu

Yes you can delete everything inside of /var/log/journal/* but do not delete the directory itself. You can also query journalctl to find out how much disk space it’s consuming:

$ journalctl --disk-usage
Journals take up 3.8G on disk.

You can control the size of this directory using this parameter in your /etc/systemd/journald.conf:

SystemMaxUse=50M

You can force a log rotation:

$ sudo systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service

NOTE: You might need to restart the logging service to force a log rotation, if the above signaling method does not do it. You can restart the service like so:

$ sudo systemctl restart systemd-journald.service

abrt logs

These files too under /var/cache/abrt-di/* can be deleted as well. The size of the log files here is controlled under:

$ grep -i size /etc/abrt/abrt.conf 
# Max size for crash storage [MiB] or 0 for unlimited
MaxCrashReportsSize = 1000

You can control the max size of /var/cache/abrt-di by changing the following in file, /etc/abrt/plugins/CCpp.conf:

DebugInfoCacheMB = 2000

NOTE: If not defined DebugInfoCacheMB defaults to 4000 (4GB).

What is the journal?

what is journal in ubuntu

Many modern file systems employ a journal including NTFS, Ext3/4, XFS, HFS+, and others. The journal helps with two things, avoiding file system corruption and speeding up recovery after a failure such as a power loss or system crash. There are two major components to a file system, the data and the metadata. The data is the contents of a file, image, video, documents, and ultimately it is what gives the file system it’s value. The metadata is what describes the structure of the filesystem including how files are named, stored in directories, access permissions, file modification times, and recording areas of the disk that are in use or are free to be allocated to other files as they grow or are created. If the metadata becomes corrupted because of a system crash, it could lead to further data loss/corruption. For example, part of the disk might be selected for allocation to a file, but if it’s not recorded correctly before a crash, it might be added to the file’s list of data blocks, but still in the list of free data blocks and allocated to a second file later on. Now, there are two files that are sharing the same data blocks/content.

The journal is a place on the disk reserved for recording changes to the file system. The exact details of what is being changed it written first to the journal located in a single location on disk, then, after the journal is updated, the changes are applied to the appropriate locations on the disk which might require several writes. One the updates are done, the journal entry is marked as complete. After a crash, the system only need to examine the journal for incomplete entries and complete them to fix the file system. This speeds recovery and ensures a change is made entirely or not at all. If a block is allocated to a growing file, it will be added to the file’s block list and also marked as in use.

Also, on file systems that support journalling, most often it’s only metadata journalling to preserve the structure, but not the data itself. Full data journalling is normally quite expensive and slow, but less crucial than metadata. It’s possible to enable for data as well if needed.

Also, to complete this, there are some file systems that don’t currently offer journalling including FAT32, exFAT, Ext2, and UDF. If there’s a crash during an update, a full scan of the filesystem needs to be done to track down any errors or corruption.

check which website get more load on ubuntu

System Load or System Load Average

It is run-queue i.e a queue of processes waiting for a resource(cpu, i/o etc.) to become available .

Consider a single-core cpu as a single lane of traffic with bridge and process as cars.

Now in this situation System load is

  • 0.0 – If there is no traffic on the road.
  • 1.0 -If the traffic on the road is exactly the capacity of bridge.
  • More than 1 – If the traffic on road is higher than the capacity of bridge and cars have to wait to pass trough the bridge.

This number is not normalized according to your cpu. In Multiprocessor system, load 2 mean 100 % utilization of we are using dual-core processor, load 4 means 100% utilization if we are using quad-core.

You can get your system load using

  • uptime
  • cat /proc/loadavg
  • top$uptime 22:49:47 up 11:47, 4 users, load average: 2.20, 1.03, 0.82

Here the last three number representing the system load average for 1, 5 and 15 minutes respectively.

The example above indicates that on average there were 2.20 processes waiting to be scheduled on the run-queue measured over the last minute.

Upsell Best Selling products for Shopify

by Cozy eCommerce Addons

Upsell Geo-Targeted Best Sellers Popular Trending Products

Editable Best Selling Products

Fully controlled best selling products where app will create best selling products and you can edit collection as well instead of hoping!

Country Based Best Selling

App will generate products based on countries from which orders are coming. You can edit these collection as well

Show Country Based Best Seller

You can use our app to redirect the customers to show best selling products from the country they are visiting from.

About Upsell Best Selling products

  • Have you ever wondered if you could edit your best sellers?
  • Have you ever thought of having best sellers based on countries?

Well, our Cozy Trending App does this for you.

Best Selling From Countries

Cozy Trending App generates the best selling products of all the countries your customers are buying from. Then you can simply go ahead and create just one page where depending on the visitor countries, the best selling products will be shown.

Editable Best Selling Products

Cozy Trending App will generate the best selling products and then you can simply go to the collection and add your own products in these best selling products. Hence, you will be able to prompt some of the products which might be good match for the current season but not necessary best sellers!

Multiple Form Builder instructions for Shopify

  1. Create FormCreating multiple forms for your store with the Multipurpose form builder to accept online payments is easy and hassle-free. You can create your forms the way you need from our multiple types of form.
    1. Choose a form you want to create from the Registration Form, Donation Form, Contact Us Form, Sticky Form, Customer Profile Update, Pop-up Form, and Age Verification Form.
    2. After selecting any form type you can start to set up the form details by customizing the required field details. Below are the type of forms you can select and how to set up the selected form easily.
    3. After selecting the Custom form type you can create a form by following the steps given below.
      1. Form Name: Enter a name for the form.
      2. Submit Button Text: Enter the text you want on the Submit button.
      3. Enable Google Captcha: Check/Uncheck the Google Captcha.
      4. Custom Redirect URL: Enter the URL at which you want to redirect your users.
      5. Success Message: Enter the success message you want to display after the form submission.
      6. You can customize your form with an option to Drag and Drop the components to the main panel to build your form content. There is an option to edit, make a copy, or remove the component from the panel. Also, you can add a required or optional validation to your fields and you can use the hidden fields for static or dynamic values. Below are the components you can drag and drop to create your form.
        1. Header
        2. Paragraph
        3. Text Field
        4. Text Area
        5. Select
        6. Number
        7. Autocomplete
        8. File Upload
        9. Hidden Input
        10. Checkbox Group
        11. Radio Group
      7. Add a custom style: An option to add your own custom CSS file that allows the user to integrate custom design to the form without having to compromise on the design each time an iframe is called.
      8. Event Listener: You add event listener action to the form to effectively store all the data of the form in the backend of the website. This eliminates any inefficiency of i-frame that may prevent the user from storing the required data in the admin panel of the website.
      9. There is an email template for sending mail to the user and sending mail to multiple admins by following the below steps:
        1. Select send mail to the user: You can add the mail subject and mail content to send emails to your users who fill the form.
        2. Select send mail to admin: You can add multiple receiver email ids, mail subject, and mail content to send emails to the admin after the form is submitted.
  2. Forms ListYou can search and view the list of the forms you have created by the name of the form, form type, creation date. There will be options to view, edit, or delete the list.
    1. Option to search the Forms list by entering the name of the form, form type, shortcode, submissions, creation date.
    2. Option to view the Forms list with.
      1. Form Name
      2. Form type
      3. Shortcode
      4. Submissions
      5. Creation date
      6. Action
        1. View Data: Option to view submissions for form.
        2. Edit Data: Option to edit the form by editing/adding/deleting the fields data.
        3. Delete Data: Option to delete the form from the list.
    3. View Data.
      When you click on the View data, option to view the details of the respective selected form with total form submissions.
      1. Option to view the fields as per the selected form.
      2. The IP address column will fetch the ip address of the users who submit the form.
      3. Through this option you can download the form submission details in excel format and store on your device.
  3. SettingsYou can enable the SMTP Settings to send emails by following some simple steps given below:
    1. Title: Option to enter a title.
    2. Host: Option to enter the host server name.
    3. Port: Option to enter the SMTP Port number.
    4. Username: Option to enter the username.
    5. Password: Option to set the password.
    6. Encryption: Option to choose the type of encryption.
    7. From Name: Option to enter the sender name.
    8. From Email: Option to enter the sender email address.
    9. Google reCaptcha V2 Setting: Option to enter site key and an option to enter secret key.
    10. Option to Update the settings.
  4. ReportsOn selecting the reports, the you will have to enter the following details:
    1. Form: A dropdown to select the form for which you want the report.
    2. Date: Select the duration for which you want to view the reports.
    3. Option to submit: On submitting the form name and duration, a report with a number of forms submitted on a particular date will be viewed.

google cloud services

AWS services

1. Amazon EC2 (Elastic Compute Cloud)

2. Amazon RDS (Relational Database Services)

3. Amazon S3 (Simple Storage Service)

4. Amazon Lambda

5. Amazon CloudFront

6. Amazon Glacier

7. Amazon SNS (Simple Notification Service)

8. Amazon EBS (Elastic Block Store)

9. Amazon VPC (Virtual Private Cloud)

10. Amazon Kinesis

11. Amazon Auto-scaling

12. Amazon IAM (Identity and Access Management)

13. Amazon SQS (Simple Queue Service)

14. Amazon Elastic Beanstalk

15. Dynamo DB

16. Amazon ElastiCache

17. Amazon Redshift

18. Amazon Sagemaker

19. Amazon Lightsail

20. Amazon EFS (Elastic File System)

21. Amazon Cloudwatch

22. Amazon Chime

23. Amazon Cloud Directory

24. Amazon Cognito

25. Amazon Inspector