This command will parse an Apache or Nginx log file and print-out the 50 highest occurring IP’s, along with the number of occurrences, to the shell prompt. machine:~ User$ cat access.log | awk ‘{print $1}’ | sort -n | uniq -c | sort -nr | head -50 cat – reads the file access.log – is… Continue reading Count IP Occurrences in Apache / Nginx Logs
Category: Networking
List of tips, predictions and explanations of computer networking.
Git Submodule Work-Tree Hook on Push to Compile Sass
Working on a WordPress Theme, but inside of another repo. Best option I thought of was using a submodule. I also need that theme to pull WordPress Customizer Color Values, but the theme is using Sass, so there has to be some type of Sass compiler on the server. So using Git’s work-tree set-up, I… Continue reading Git Submodule Work-Tree Hook on Push to Compile Sass
WordPress: change all url/websites address in posts
The SQL statement to change all references of a string in WordPress posts is: UPDATE wp_posts SET post_content = REPLACE(post_content, ‘staging.server.com’, ‘www.productionserver.com’);
Quickly Testing TTFB (Time To First Byte) with Apache Benchmarking Tool
Checking the cause of a high TTFB (Time To First Byte) can be time consuming. And pinpointing the issue requires multiple tests against even the smallest changes. Enter Apache’s Benchmarking Tool ab to help with quick testing. ab -n 100 http://www.website.com/ The above command will execute 100 tests against the website entered. The results are… Continue reading Quickly Testing TTFB (Time To First Byte) with Apache Benchmarking Tool
AWS EC2 Amazon Linux AMI change timezone
AWS (Amazon Web Services) EC2 Amazon Linux AMI timezone will most likely be different than your local machines’ timezone. To remedy this issue on Amazon’s Linux machine image, ssh in and type the following commands in prompt: sudo su become root user ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime Choose your time zone ( in this example Toronto… Continue reading AWS EC2 Amazon Linux AMI change timezone
Free Server Testing Tools
Site 24 x 7 – Tools for server testing is a great resource for free server testing tools from a web interface. Extremely helpful set of tools when your trying to find out ways to improve the speed and performance of a site. It also is helpful to use these tools on other more popular… Continue reading Free Server Testing Tools
RSYNC – Fastest Way to Download a Clone of any directory
RSYNC is the fastest way to clone and sync directories from any server. Below is an rsync example using ssh tunneling on port 2222 to a server using cPanel, thus the exclusion of the .cpanel and public_ftp. /home/user is the folder to clone/sync to /Volumes/HardDrive/BackupLocation. And a log file is created to log any issues… Continue reading RSYNC – Fastest Way to Download a Clone of any directory
Secure Google search – encrypted search string and url
https://encrypted.google.com/ If you want to search Google securely, over an encrypted connection, use the above link. This prevents your search from being seen by anyone but you and Google, that includes your ISP. Resources: http://stackoverflow.com/questions/499591/are-https-urls-encrypted Video explaining SSL Security Now, episode #195
Generate CSR file for GoDaddy SSL certificate in OSX, using terminal command line and openssl
This works for generating CSR files required by GoDaddy SSL certificates. This will work with more than just GoDaddy SSL certificates, you can even sign your own certificates. In the Terminal application, type: $ openssl genrsa -des3 -out domain.key 2048 You will now have to enter a passphrase, so type: $ openssl req -new -key… Continue reading Generate CSR file for GoDaddy SSL certificate in OSX, using terminal command line and openssl
Duplicate row in MySQL
INSERT INTO `table` (`col1`, `col2`, `col3`, `col4`) SELECT `col1`, `col2`, `col3`, `col4` FROM `table` WHERE `id`=1; `id` can be anything unique.