awk ‘{gsub(/^|$/,”\x027″);gsub(/,/,”\x027,\x027″)}7’ filename >newfilename vi newfilename :%s/\r//g
lsyncd error terminating since out of inotify watches
echo 65536 > /proc/sys/fs/inotify/max_user_watches or sysctl fs.inotify.max_user_watches=65536 vi /etc/sysctl.conf #fix lsyncd error terminating since out of inotify watches fs.inotify.max_user_watches=65536
Force all traffic to be SSL
vi .htaccess RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]
OpenSSL CSR Generation Centos
1. Generate CSR openssl req -nodes -newkey rsa:2048 -keyout www.domain.key -out www.domain.csr Country Name (2 letter code) [AU]: US State or Province Name (full name) [Some-State]: State Locality Name (eg, city) []: City Organization Name (eg, company) [Internet Widgits Pty Ltd]: Company Name Organizational Unit Name (eg, section) []: Webhosting…
Php dynamic forms not caching form fields
Form Fields are not Populated after Pressing Back Button 1. Create the file: cache.html 2. chmod 666 cache.html 3. Add this code to the top of your php form page $cachefile = ‘cache.html’; $cachetime = 4 * 60; // Serve from the cache if it is younger than $cachetime if…
Scroll to top of page after form submit
<head> <script type=”text/javascript”> parent.window.scrollTo(0,0); </script> </head> Or <body onload=”parent.window.scrollTo(0,0); “>
Javascript validate empty form fields
Check for Empty Fields Using JavaScript To make the web browser check that a field is not empty, you will need to add a call to your validation function when the form is submitted. Do this by adding a “onsubmit” attribute to your FORM tag, like the following : <form…
Bulk change author wordpress
1) Login into wordpress admin area. 2) Click Pages section. 3) Select the pages for which you need to edit the author details. [check box] 4) From the top there is drop down for bulk actions -> select edit and apply. 5) Now, you can change author, comment, status, pings,…
Create admin user wordpress
########################################### <?php // ADD NEW ADMIN USER TO WORDPRESS // ———————————- // Put this file in your WordPress root directory and run it from your browser. // Delete it when you’re done. require_once(‘wp-blog-header.php’); require_once(‘wp-includes/registration.php’); // —————————————————- // CONFIG VARIABLES // Make sure that you set these before running the file.…
Chmod directories & files
To change all the directories to 755 (-rwxr-xr-x): find /var/html/htdocs -type d -exec chmod 755 {} \; To change all the files to 644 (-rw-r–r–): find /var/html/htdocs -type f -exec chmod 644 {} \;