Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Luka Paunović lukapaunovic

🎯
Focusing
View GitHub Profile
View Optimize all images - cPanel server
yum install epel-release -y
yum install jpegoptim -y
yum install optipng -y
for i in `ls --hide='system' /var/cpanel/users/`; do
find /home/$i/ -type f -iname '*.jpg' -print0 | xargs -0 -n4 -P5 sudo -H -u $i jpegoptim -s
find /home/$i/ -type f -iname '*.jpeg' -print0 | xargs -0 -n4 -P5 sudo -H -u $i jpegoptim -s
find /home/$i/ -type f -iname '*.png' -print0 | xargs -0 -n4 -P5 sudo -H -u $i optipng -o1 -strip all
sleep 5
@lukapaunovic
lukapaunovic / Megatools CentOS install
Last active Oct 6, 2020
Megatools CentOS install
View Megatools CentOS install
yum -y install gcc make glib2-devel libcurl-devel openssl-devel gmp-devel tar automake autoconf libtool wget asciidoc -y
wget https://megatools.megous.com/builds/megatools-1.10.0-rc1.tar.gz
tar -xzvf megatools*.tar.gz
cd megatools*
./configure
make
make install
View gist:38a95d5bfadb2612f497ddc41338e142
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtYAMj6ZcTAsgLCgHz2TnAl0lbyq/iU3msaXJaT7PfSVQYX8qQZ5tmycumEvwkgHG0bKxF6tmjuNYkSN4jWQX8McPllneDHoEwlw7nyx9lv05PsL+qziG/4MR81lETowvBbvhXN82MnbmjlV7eGuM3eyDL5v5JGxKBsPtNHTsXXfy9h5CIBLQBFbRHX9glGV/gs3wSdiw/iRAsFJ+g4YQCfdzPURwYis8shmKHeotUirlLURa7Q6PctnkTJ3sTA52aKy/3zgPtFj29Ky58yOqN/v1KIy1iBbhEzIXk7RhFN6QDsGrirL2uwBgGIOgFjg2+D2Pa8JbNLQ8KazH9qomH luka@paunovic
View script-that-lazy-loads-png-background
window.lazyprocess22 = 'yes';
jQuery(window).on('resize scroll', function() {
if (jQuery('.et_pb_section_3').isInViewport()) {
if (window.lazyprocess22 == 'yes') {
window.lazyprocess22 = 'no';
View script-that-lazy-loads-gif-background-image
jQuery.fn.isInViewport = function() {
var elementTop = jQuery(this).offset().top;
var elementBottom = elementTop + jQuery(this).outerHeight();
var viewportTop = jQuery(window).scrollTop();
var viewportBottom = viewportTop + jQuery(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};
View gist:9e4ca4765e7e09bd4d6160b8c5df6063
location ~* ^.+\.(css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public";
}
View gist:0c66f5048654279651587cc086f2330d
location ~* ^.+\.(css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public";
}
View autoptimize
location ~* /wp-content/resources/.*\.(js|css)$ {
try_files $uri $uri/ /wp-content/autoptimize_404_handler.php;
}
View nginx rules
# WebP Express rules
# --------------------
location ~* ^/?wp-content/.*\.(png|jpe?g)$ {
add_header Vary Accept;
expires 365d;
if ($http_accept !~* "webp"){
break;
}
try_files
/wp-content/webp-express/webp-images/doc-root/$uri.webp
View hotjar-rashaunjones121
<!-- Hotjar Tracking Code for https://yazolewatches.com/ -->
<script>
jQuery(document).ready(function(c){window.cbload232="no",c(window).scroll(function(){var n,t,o,e;1<c(document).scrollTop()&&"no"==window.cbload232&&(window.cbload232="yes",n=window,t=document,n.hj=n.hj||function(){(n.hj.q=n.hj.q||[]).push(arguments)},n._hjSettings={hjid:1187058,hjsv:6},o=t.getElementsByTagName("head")[0],(e=t.createElement("script")).async=1,e.src="https://static.hotjar.com/c/hotjar-"+n._hjSettings.hjid+".js?sv="+n._hjSettings.hjsv,o.appendChild(e))})});
</script>