How To Search the APT Sources for Available Packages

Author: , Posted on Thursday, June 10th, 2021 at 4:14:53pm

Search for a string:

List all packages:

How To Convert from AWS Instance Family t2 to t3 with Enhanced Networking on Amazon Linux 1

Author: , Posted on Thursday, June 10th, 2021 at 1:19:03pm

I wanted to change instance type from t2 to t3, but got an error when i went to start the instance:

I found this AWS docs page: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html

Below are the steps I need to follow on AWS Linux 1.

Summary Steps

Pre-flight tests on t2

modinfo ena
-> see “ERROR: modinfo: could not find module ena”
ethtool -i eth0 | grep ^driver:
-> see “driver: vif”

Install the latest drivers

sudo yum -y update
sudo reboot
modinfo ena | grep ^description:
-> see “description: Elastic Network Adapter (ENA)”

Convert the instance to t3 to get ENA working

aws ec2 stop-instances --instance-ids {instanceid}
aws ec2 modify-instance-attribute --instance-id {instanceid} --instance-type t3.large
aws ec2 start-instances --instance-ids {instanceid}
ethtool -i eth0 | grep ^driver:
-> see “driver: ena”

Detailed Steps

Ensure the latest drivers are installed:

sudo yum -y update

IMPORTANT: You must reboot once the updates are done!

After the reboot, check to ensure the driver is loaded properly:

modinfo ena

DRIVER NOT INSTALLED

DRIVER INSTALLED √

Enable ENA on the instance

aws ec2 modify-instance-attribute --instance-id {instanceid} --ena-support

Note: To disable ENA support, use this command:
aws ec2 modify-instance-attribute --instance-id {instanceid} --no-ena-support

Check that it is enabled

aws ec2 describe-instances --instance-ids {instanceid} --query "Reservations[].Instances[].EnaSupport"

You should see the string ‘True’ as the result when enabled, and nothing when disabled.

Stop the instance so you can change the instance type.

aws ec2 stop-instances --instance-ids {instanceid}

Change instance type from t2 to t3

aws ec2 modify-instance-attribute --instance-id {instanceid} --instance-type t3.large

Start the instance

aws ec2 start-instances --instance-ids {instanceid}

Check the interface

ethtool -i eth0

DRIVER NOT INSTALLED

DRIVER INSTALLED √

NOTE: As per the AWS docs -> “The following AMIs include the required ENA module and have ENA support enabled: Amazon Linux 2”

How To Undo A Conflicting Merge in GIT

Author: , Posted on Tuesday, June 8th, 2021 at 11:11:18am

shell> git merge branch-with-messy-changes

shell> git status

shell> git merge --abort
shell> git status

IMPORTANT NOTE: Previous versions of git used different commands for this operation:

Latest version: git merge --abort
Older than version 1.7.4: git reset --merge
Older than version 1.6.2: git reset --hard

How To Control Output Formatting Via The MySQL Shell CLI

Author: , Posted on Wednesday, May 26th, 2021 at 3:32:31pm

https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-output-formats.html

Multiple Formats Available:
Table Format – use --result-format=table, alias --table
Tab Separated Format – use --result-format=tabbed, alias --tabbed
Vertical Format – use --result-format=vertical, alias --vertical
JSON Format Output – use --result-format=VALUE, alias --json[=pretty|raw|off]
VALUE may be one of:

  • json or json/pretty – These options both produce pretty-printed JSON.
  • ndjson or json/raw – These options both produce raw JSON delimited by newlines.
  • json/array – This option produces raw JSON wrapped in a JSON array.

How To Restart a Hung Top Menu Bar in MacOS

Author: , Posted on Friday, April 23rd, 2021 at 11:30:23am

Ever get the spinning beachball when trying to access the top menu on your Mac?

SOLUTIONS

Use the GUI
Open the Activity Monitor application
Select All Processes from the View menu
Click on the SystemUIServer process, then click Force Quit.

~or~

Via CLI
In Terminal, execute killall SystemUIServer

How To Dynamically Add a Path to the Perl @INC At Compile-Time

Author: , Posted on Friday, April 16th, 2021 at 3:07:24pm

The key is to define a variable first, then use the BEGIN block to initialize the variable, then reference the variable in use lib $var; later on ;-}

For example, enable a module contained in the same directory as a script called via the PATH:

How To Determine Where MySQL Looks For my.cnf

Author: , Posted on Monday, March 22nd, 2021 at 2:32:54pm

Ah, the power of grep!

How To Configure GIT To Push The Current Branch Only

Author: , Posted on Tuesday, March 16th, 2021 at 1:51:04pm

Recent changes to git have made the push default choice a bit confusing – “matching” vs. “simple”

I picked “matching” when prompted. This means that git push by itself will try to push ALL local branches, not just the one you are working on.

Personally, I find that a bit mad, so I decided to change it.

Push the Current Branch ONLY
To set the default to the single-branch push:

Push All Branches
To set the default to the multi-branch push:

https://git-scm.com/docs/git-config

Possible Values for push.default

  • nothing – do not push anything (error out) unless a refspec is given. This is primarily meant for people who want to avoid mistakes by always being explicit.
  • current – push the current branch to update a branch with the same name on the receiving end. Works in both central and non-central workflows.
  • upstream – push the current branch back to the branch whose changes are usually integrated into the current branch (which is called @{upstream}). This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow).
  • tracking – This is a deprecated synonym for upstream.
  • simple – in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one.
    When pushing to a remote that is different from the remote you normally pull from, work as current. This is the safest option and is suited for beginners. This mode has become the default in Git 2.0.
  • matching – push all branches having the same name on both ends. This makes the repository you are pushing to remember the set of branches that will be pushed out (e.g. if you always push maint and master there and no other branches, the repository you push to will have these two branches, and your local maint and master will be pushed there).
    To use this mode effectively, you have to make sure all the branches you would push out are ready to be pushed out before running git push, as the whole point of this mode is to allow you to push all of the branches in one go. If you usually finish work on only one branch and push out the result, while other branches are unfinished, this mode is not for you. Also this mode is not suitable for pushing into a shared central repository, as other people may add new branches there, or update the tip of existing branches outside your control.

How To Process System Exit Codes Using Perl Eval

Author: , Posted on Tuesday, March 9th, 2021 at 10:36:25am

The trick to using eval to catch shell execution is to return twice, once inside the eval and once outside:

Neat!

How To Prevent Spotlight From Indexing External Drives on MacOS

Author: , Posted on Friday, February 26th, 2021 at 11:46:15am

On MacOSX 10.10.5 Yosemite, I was having trouble with Spotlight preventing the clean eject of an attached hard drive.

Using the fuser command allowed me to see that it what the Spotlight-specific mds process preventing the eject.

At first, I tried to disable the indexing via the mdutil command, but that just gave me an error:

I ended up having to force eject the drive:

The actual solution was so very simple, just create an empty file at the root of each external drive you with to prevent being indexed: