Skip to main content

Posts

Apple MacBook macOS Critical Battery Warning at 5% or less

Coming from Windows where there's an entire set of configuration options to set Low Battery Warnings, Critical Battery Warnings and Actions, etc. I'm dismayed that macOS doesn't have any configuration at all, and only has a permanently fixed Low Battery notification at 10% and nothing else. I have made a script ( available on GitHub Gist ) that will show a warning alert like this:  You can save the first file as  /usr/local/bin/battcritical (without the .sh ) and if you only want it in current session, just run it with: nohup /usr/local/bin/battcritical & To have it start warning you at another percentage (and below), change the number after -le on line 11 to your desired percentage. In order to have it automatically run every time you boot up your Mac, also save the second file as  /usr/local/bin/login-scripts (without the .sh ), then drag and drop the login-scripts file into the Login Items list in your System Settings. Remember to give both files the execut...
Recent posts

How to force redirect HTTP to HTTPS in Amazon Elastic Beanstalk

After picking up bits and pieces over the Internet, here I have the complete guide for my particular setup. My Amazon AWS Elastic Beanstalk (ELB or EBS) is as follows: 64bit Amazon Linux 2016.03 v2.1.1 running Tomcat 8 Java 8 Java/JSP application on Apache Tomcat Maven Build How to get it done: First, configure your EBS instance: Go to Configuration and click the gear on Load Balancing. Under Load Balancer, set the following options: Listener port: 80 Protocol: HTTP Secure listener port: 443 Protocol: HTTPS SSL certificate ID: Choose the cert ID that goes with your server. If you don't have one, you can use Certificate Manager to create one. Apply and save this configuration. Let the server health be OK. Test it by accessing your application web page through both HTTP and HTTPS: HTTP should load the page unsecurely. HTTPS should load the page securely. No port number should be added after the domain name in either case. Then, add a configuration file ...

Make Google Chrome fast again

TL;DR: Get Native Lazy Tabs  or Tiny Suspender  (You need to enable "native discard" experimental feature in its options). Pro Tip: Press Shift-Esc in Chrome to view its task manager. Sort the memory column and you'll get an idea of which tabs or extensions are using the most of it. When Google Chrome browser first came out, the pitch was a no-frills super fast browser that is very light on memory. This was amazing at the time when competing browsers like Firefox were heavy on RAM, drinking up copious amounts of it, slowing computers down. But as time went by, browsers like Firefox have leaned down in response, but the memory footprint of Chrome seems to only have been going up, especially if you're a heavy user of web apps. However, Chrome is still a favorite to many including me for its simplicity, clean interface, and maintenance-free upgrades. (In fact, I had briefly switched to Firefox when Chrome killed custom extensions, but shortly after I went back...

Convert the Atom Editor into a PHP IDE using PHP Integrator

Atom Editor is basically a text editor on steroids. It is not an IDE for any language by default. Through the power of plugins, you can convert Atom into almost anything you wish, except a toaster. Here I am documenting what I did in order to convert Atom Editor to a nice PHP IDE. You can do the same too using PHP Integrator and make it much easier to maintain your PHP projects in Atom. Note: Throughout the guide, I'll indicate version numbers at the time of writing in brackets. This is only for reference, and you must always install the latest version of the software, not the version indicated here. Upgrade to the latest version of Atom (1.21.1). Install the package php-integrator-base (3.1.0). (File > Settings > Install) Atom will ask you to install dependencies. Say Yes. The dependencies are (at the moment): atom-ide-ui  (0.5.3) (previous versions used linter , but you should disable/remove that now as it will conflict with Diagnostics) intentions (1.1.5) ...

Make Atom Editor load faster

The default installation of Atom editor comes with a bunch of core packages that you may not need. I have found that you can actually speed up the load time of Atom by disabling a lot of these core packages. The good thing about Atom is anytime I need a package I can just enable it and it's instantly active (for most packages). Please note that what you disable would depend on your own needs. For example, if you develop Java, you would want to keep 'language-java' enabled. I proceeded to  disable  the following packages as I did not see the need for them at the moment. about - if disabled, nothing will happen if you click Help > About Atom. You can still check for updates using Help > Check for Update. archive-view autocomplete-atom-api autoflow autosave - Atom will still save your edit buffer. This package is not necessary to save buffer. background-tips - The tips shown when you don't have any tab open. bookmarks command-palette dalek deprecation...

Google Drive service unaffected, app being shut down

About a week ago, Google made a confusing announcement in their G Suite Updates Blog. It resulted in shocking many Google Drive users that their favorite service is being killed off by the search giant Google. Even tech blogs kept trumpeting the false information without taking care to verify the rumors that were spreading about. But thankfully, there are those who saw through the folly and are trying their best to clear the confusion. Here's what's actually happening: The name ‘Google Drive’ refers to two different things: Google Drive online service to create Docs, Sheets, Slides and other collaborative documents, as well as backup your files. Google Drive app (a.k.a. computer program) that runs on your Mac or PC, which gives you access to those documents and files, and also syncs the files with the service. Here’s what Google said (read it with a big bag of salt): With this launch, Google Drive for Mac/PC is officially deprecated. It will no longer be supported...

How to SHRINK an Amazon AWS EBS volume safely with no data loss

Note: This guide assumes your volume is based on a Linux file system such as ext4. If you're using a different file system, you may still be able to shrink the volume but your mileage may vary. To get to the guide, scroll down and skip the prologue. Prologue Once my 1 year free trial with Amazaon AWS was over, I found that I'm paying for 30 GB of storage space while I'm actually using only about 5 GB. Hence I decided to shrink it down to about 7 GB or so. My plan is to just monitor the usage and see if I can reduce the usage or expand the volume later as needed. Searching for guides on Google, the top hit was this blog post . But I found that the instructions are actually terrible. Here are the problems with it: The guide tells you to FORMAT the volume with your existing data. YES! That's ridiculous, but it's true. It's this command: sudo mkfs -t ext4 /dev/xvdf . I did it and destroyed my data , but lucky for me, I had made a snapshot. No problem, jus...