Entries Categorized as 'Technology'

How To Redirect to https in Apache Using mod_rewrite

Author: , November 17th, 2017

1 2 3 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

How To Create a Single Custom Post Type Template for Genesis in WordPress

Author: , October 21st, 2017

wordpress/wp-content/themes/yourTheme/single-yourCPTslug.php 1 2 3 4 5 6 7 8 9 10 11 add_action( ‘genesis_before_entry_content’, ‘display_custom_fields’ ); function display_custom_fields() {     $jobTitle = get_field(’_jobTitle’) ?: ‘-’;     print <<<EOT     <br style="clear:both"/>     <p>Job Title: $jobTitle</p> EOT; }   // Genesis Loop genesis(); add_action( ‘genesis_before_entry_content’, ‘display_custom_fields’ ); function display_custom_fields() { $jobTitle = […]

How to Manage Remote Branches in Git

Author: , October 19th, 2017

Git does not download all branches unless you tell it to. Until then, they are ‘remote’ branches. Use -r to list remote branches: git branch -r git fetch –all git pull –all If you see this error: fatal: The current branch CT-37 has no upstream branch. Push the current branch and set the remote as […]

How To Revert a Single File in Git to Match the Master Branch

Author: , October 19th, 2017

If you want to revert the file to its state in master: git checkout origin/master [filename]

How To Clean Up Lost Disk Space in MacOS High Sierra

Author: , October 12th, 2017

Reposted from https://mcbguru.blog/2017/10/12/macos-high-sierra-disk-space/ The new APFS creates snapshots during local Time Machine backups, and this can mean, especially if you’be been dealing with some large files, that when you delete them and empty the wastebasket, you don’t get your disk space back. The key is to look at your local backups, and the easiest method […]

How To get haproxy status via socket using cli

Author: , October 6th, 2017

echo “show stat” | nc -U /var/lib/haproxy/stats | cut -d “,” -f 1,2,5-11,18,24,27,30,36,50,37,56,57,62 | column -s, -t

How To Calculate Dates In Perl Using Date::Manip

Author: , September 18th, 2017

1 2 3 4 my $created_at  = ’2017-09-18T13:43:40Z’; my $marker      = DateCalc(’today’,’30 days ago’); my $cmp = Date_Cmp($created_at,$marker); if ($cmp < 0) { print "Older than marker!\n"; } else { print "Same date or later than marker\n"; } my $created_at = ’2017-09-18T13:43:40Z’; my $marker = DateCalc(‘today’,’30 days ago’); my $cmp = Date_Cmp($created_at,$marker); if […]

Host to Delete a Specific Email in Postfix on Linux

Author: , September 14th, 2017

root@outbound:/var/log # postqueue -p -Queue ID- –Size– —-Arrival Time—- -Sender/Recipient——- 593E2FC69D 3970 Tue Sep 12 23:15:36 MAILER-DAEMON (connect to yourDomain.com[10.10.10.10]:25: Connection timed out) yourUser@yourDomain.com — 4 Kbytes in 1 Request. root@outbound:/var/log # postsuper -d 593E2FC69D postsuper: 593E2FC69D: removed postsuper: Deleted: 1 message root@outbound:/var/log # postqueue -p Mail queue is empty

How To Make Firefox Focus on the URL not Search in a New Tab

Author: , September 5th, 2017

Set browser.autofocus to false in about:config

How To Watch https Calls to Apache 2.4 using Perl and mod_status

Author: , September 5th, 2017

Step 1: Enable Apache status and lock it down: Make sure mod_status is being loaded: grep -Rn mod_status /etc/httpd/* 1 /etc/httpd/conf.modules.d/00-base.conf:58:LoadModule status_module modules/mod_status.so /etc/httpd/conf.modules.d/00-base.conf:58:LoadModule status_module modules/mod_status.so Add support for the call just under the first DocumentRoot statement: vim /etc/httpd/conf/httpd.conf 1 2 3 4 5 6 <Location /server-status>     SetHandler server-status     Require ip […]