Tips

Windows Terminal Interfaces You Won’t Regret

Windows Terminal – The first awesome native Windows terminal that came out of Microsoft. Released May 2019. Note: Windows Terminal requires Windows 10 1903 (build 18362) or later.

Cmder – Portable console emulator for Windows. Cmder is a software package created out of pure frustration over the absence of nice console emulators on Windows. It is based on amazing software, and spiced up with the Monokai color scheme and a custom prompt layout, looking sexy from the start.

SmarTTY – a multi-tabbed SSH client with SCP support for Windows. Time to put Putty to bed.

WSL – The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a virtual machine. Ubuntu 18.04 or Debian exclusively because it’s the closest you can get to running Linux binaries natively on NT without a virtualization abstraction layer. The primary reason behind using this instead of the other tools is: seamless integration. When administering Linux servers, it helps to be using a Linux-based client even though an OpenSSH client binary exists for NT.

 

VMWare: Enable Inter-VM Transparent Page Sharing (v5.x – 6.7)

If you’re using VMWare ESXi in a non-production environment, such as a home lab, consider changing the advanced host setting Mem. ShareForceSalting to “0” in order to encourage likeliness of the hypervisor to increase the inter-VM page sharing pool. After doing so, the PSHARE on my host increased from about 3GB to 4.5GB with 3767MB savings (esxtop then press m).

PMEM /MB: 32672 total: 1636 vmk,28639 other, 2397 free
VMKMEM/MB: 32510 managed: 939 minfree, 15602 rsvd, 16907 ursvd, clear state
PSHARE/MB: 4541 shared, 788 common: 3753 saving
SWAP /MB: 0 curr, 0 rclmtgt: 0.00 r/s, 0.00 w/s
ZIP /MB: 0 zipped, 0 saved
MEMCTL/MB: 0 curr, 0 target, 12773 max

The concept of salting has been introduced to help address concerns system administrators may have over the security implications of TPS as described in KB Security considerations and disallowing inter-Virtual Machine Transparent Page Sharing (2080735). Salting is used to allow more granular management of the virtual machines participating in TPS than was previously possible. As per the original TPS implementation, multiple virtual machines could share pages when the contents of the pages were same. With the new salting settings, the virtual machines can share pages only if the salt value and contents of the pages are identical. A new host config option Mem.ShareForceSalting is introduced to enable or disable salting.

By default, salting is enabled after the ESXi update releases mentioned above are deployed, (Mem.ShareForceSalting=2) and each virtual machine has a different salt. This means page sharing does not occur across the virtual machines (inter-VM TPS) and only happens inside a virtual machine (intra VM).

When salting is enabled (Mem.ShareForceSalting=1 or 2) in order to share a page between two virtual machines both salt and the content of the page must be same. A salt value is a configurable vmx option for each virtual machine. You can manually specify the salt values in the virtual machine’s vmx file with the new vmx option sched.mem.pshare.salt. If this option is not present in the virtual machine’s vmx file, then the value of vc.uuid vmx option is taken as the default value. Since the vc.uuid is unique to each virtual machine, by default TPS happens only among the pages belonging to a particular virtual machine (Intra-VM).
If a group of virtual machines are considered trustworthy, it is possible to share pages among them by setting a common salt value for all those virtual machines (inter-VM).

The following table shows how different settings for TPS are used together to effect how TPS operates for individual virtual machines:

Mem. ShareForceSalting (host setting) sched.mem.pshare.salt (per VM setting) vc.uuid (per VM setting) Salt value of VM TPS between VMs (Inter-VM) TPS within a VM (Intra-VM)
0 Ignored Ignored 0 Yes, among all VMs on host. yes
1 Present Ignored sched.mem.pshare.salt Only among VMs with same salt yes
1 Not Present Ignored 0 Yes, among all VMs yes
2 Present Ignored sched.mem.pshare.salt Only among VMs with same salt yes
2
(default)
Not Present
(default)
Present (default) vc.uuid No inter-VM TPS yes
2 Not Present Not Present random number No inter-VM TPS yes

For more information on TPS, see:

 

Copy/Paste and Run Multi-line Bash/Shell Scripts

BASH TIP: You can copy/paste multi-line bash/shell scripts directly from sites like this and run them without syntax errors.
Type ( and then paste the contents of your clipboard, and then type ) and press enter.

 

Chrome Network Internals

This has been deprecated. Go to chrome://about for a list of all Chrome settings and chrome://flags to turn specific features on/off

 

Get Public IP Address from Command Line

On a Linux terminal (or Windows with gnuwin32), you can return your public IP address with curl on ipconfig.io (see examples below).

# curl ipconfig.io
47.100.16.27

# curl ipconfig.io/json
{"ip":"47.100.16.27","ip_decimal":795086875,"country":"United States","city":"Fremont"}

 

Weather Report in your Terminal

$ curl -4 http://wttr.in

 

WordPress NGINX Permalink Rewrite

Change WordPress permalink structure from <domain.com/year/mo/day/post> to <domain.com/post>

rewrite "/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)" $scheme://$server_name/$4 permanent;

Or change from <domain.com/mo/post> to <domain.com/post>

rewrite "/([0-9]{4})/([0-9]{2})/(.*)" $scheme://$server_name/$3 permanent;

 

Remove all Directories in the Current Directory

$ find . -type d -exec rm -r "{}" \;

 

Common Access/Permission Commands for WordPress Directory Structure

$ chown www-data:www-data  -R * # "www-data" is commonly the web server user account
$ find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
$ find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--
$ find /var/www/sysinfo.io -type f -exec chmod 644 {} \;
$ find /var/www/sysinfo.io -type d -exec chmod 755 {} \;
$ find /var/www/sysinfo.io/wp-content/ -type d -exec chmod 775 {} \;
$ find /var/www/sysinfo.io/wp-content/ -type f -exec chmod 664 {} \;
$ find /var/www/sysinfo.io -type d -exec chmod g+s {} \;
$ find /var/www/sysinfo.io/wp-content/uploads -type d -exec chmod 775 {} \;

 

Correct Previous Shell Command Using Carat (^) Symbol

Suppose you were trying to update your repo and upgrade your programs but mistyped apt-get as ap-get

# ap-get update && apt-get upgrade -y
 No command 'ap-get' found, did you mean:
 Command 'apt-get' from package 'apt' (main)
 ap-get: command not found

Commands are easily replaced with the proper command by wrapping the typo with two carats (^) followed by the correct command which will then re-execute the entire previous line.

^ap-get^apt-get

 # apt-get update && apt-get upgrade -y
 Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
 Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
 Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
 Hit:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease
 Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [380 kB]
 Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [375 kB]
 Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [321 kB]
 Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [317 kB]
 Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [110 kB]
 Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [24.9 kB]

 

Access AWS S3 from Windows with S3 Browser

S3 Browser is a freeware Windows client for Amazon S3 and S3-compatible bucket storage services as almost every large IaaS providers (Digital Ocean, Linode, Microsoft Azure).  Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. Amazon CloudFront is a content delivery network (CDN). It can be used to deliver your files using a global network of edge locations.

Direct download s3browser-8-5-9.exe


1 Download

Or the command line version called s3cmd

Direct download s3cmd-2.0.1.tar.gz


0 Downloads

 

Windows 10 Windows Update Powershell Wrapper Script

Since the GUI for Windows Update stopped working for me I decided to write a wrapper for an existing PowerShell script to update Windows for me via Task Scheduler. Click here to download the Windows Update PowerShell Module and click here for my simple 2-line wrapper:


$winupdfile = 'Windows-Update-' + $(get-date -f MM-dd-yyyy) + '.txt'
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -Command `"Get-WUInstall -AcceptAll | Out-File $env:USERPROFILE\$winupdfile -Append`"" -Verb RunAs; exit } else { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -Command `"Get-WUInstall -AcceptAll | Out-File $env:USERPROFILE\$winupdfile -Append`""; exit }

 

Bypass HSTS on Broken Website SSL Certificate

While on the error page in Chrome, type badidea and you will be allowed to proceed.

 

AWS EC2 VPC Network Address Resolution

After contacting the free AWS Support channel over multiple days and trying to confirm if it was true that they transparently convert destined (outbound) public IP traffic to the corresponding internal IP address of the receiving instance, as long as both instances reside within the same AZ and within the same region. That is logical since the traffic wouldn’t go out to the internet and come right back if they used a special translation system. But apparently I have confirmation that this is not true according to AWS Support which you can see below my original tip. If you definitively know whether or not this is true please contact me.

If you communicate to an running Amazon instance via its public Amazon DNS name (ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com) from another instance within the same region over TCP/IP, network traffic will silently resolve and talk via its internal address as opposed to its public, which lowers latency since the two systems do not have to touch the internet, as well as save you money because availability zone to availability zone (intra-region) traffic is billed at a cheaper rate than external traffic.

Correspondence
Amazon Web Services
Dec 27, 2016
04:33 PM -0800
Hello,

We are glad to assist and address your concern on this matter.

If you have any technical questions in the future, we have a number of Premium Support plans that allow you to speak directly with a Support Engineer. With Premium Support, you can speak to an engineer by email, chat, or phone depending on what support plan you choose.

These plans offer a tailored support experience that allows you select the support level that best fits your needs. Premium Support plans which all include direct access to Support Engineers start out at just $29/mo. The plans are prorated, and can be cancelled any time. More information including pricing and how to sign up can be found here:

https://aws.amazon.com/premiumsupport/pricing/

Please feel free to contact us if you have any questions.

Best regards,

Suzie Q.
Amazon Web Services

 

 

Identify your Outbound Phone Number

Call the toll-free MCI Automatic Number Announcement Circuit (ANAC) which will audibly repeat back to you the phone number it detected you calling from.

  • 1-800-437-7950
  • 1-800-444-4444

 

Disqus Comments Loading...