If you’re about to run a process that is going to take a considerable amount of time to execute, it is convenient to have that process run without your supervision. And having some type of notification as to when the process has finished executing… or throwing an error, is a big help. Luckily in Ubuntu,… Continue reading Ubuntu/Debian Notification After Command Has Run
Category: Programming
Git; Get All Branches Last Commit Date and Time
for k in `git branch | perl -pe s/^..//`; do echo -e `git show –pretty=format:”%Cgreen%ci %Cblue%cr%Creset” $k — | head -n 1`\\t$k; done | sort -r The set of piped commands above produces easy-to-read output of all your repo’s branch names and their last commit dates. Below is an explanation of the commands: for k… Continue reading Git; Get All Branches Last Commit Date and Time
Count IP Occurrences in Apache / Nginx Logs
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
GIT Using SSH to Push Remote to Server
On the server terminal, type: git remote add origin ssh://user@domain.com:22/home/user/remote.git The name of your remote repo will be ‘origin’. ‘user’ is your user name, ‘domian.com’ is your domain or IP address. ‘:22’ is the port number used to connect to your ssh server. ‘/home/user/remote.git’ is the location of your remote git repo. Before you push… Continue reading GIT Using SSH to Push Remote to Server
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
Pushing Large Git Repository
Pushing a large Git Repository can cause issues; time-outs, disconnects or general freezing tend to happen with especially large Git Repos. The best way to handle pushing those large git repos is to break the pushes down into commit chunks. Using git log you can decide how far back and how many chunks you would… Continue reading Pushing Large Git Repository
Create Git Archive From Specific Commit Range
git archive -o ~/Desktop/update.zip HEAD $(git diff –name-only f0ae46ac15a3d420c08de8ab440b4eb80b66bf7a –diff-filter=ACMRTUXB) The above command will create a zip archive from your git repo from commit ‘f0ae46ac15a3d420c08de8ab440b4eb80b66bf7a’ to your latest commit being the HEAD. The –diff-filter=ACMRTUXB will prevent an error if you’ve deleted files between ‘f0ae46ac15a3d420c08de8ab440b4eb80b66bf7a’ and HEAD. The above example will produce a zip file on… Continue reading Create Git Archive From Specific Commit Range
OpenX – PHP 5.4.34 Upgrade Error Fix
If your OpenX installation is printing-out the following: Strict Standards: Non-static method PEAR::setErrorHandling() should not be called statically in /home/user/directory/lib/Max.php on line 222 Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/user/directory/lib/max/ErrorHandler.php on line 134 Strict Standards: Non-static method Log::singleton() should not be called statically, assuming $this… Continue reading OpenX – PHP 5.4.34 Upgrade Error Fix
Prevent Ampersand Issues in Javascript on WordPress Pages & Posts
Ampersands in WordPress Posts and Pages are always encoded into either their numeric (&) or name (&) html entity. This can become troublesome if you are including javascript into the page or post. Using the ampersand’s unicode code point value (0026) is the best way around this issue. So writing ampersand would be done by… Continue reading Prevent Ampersand Issues in Javascript on WordPress Pages & Posts