Skip to content

Instantly share code, notes, and snippets.

View hmphu's full-sized avatar
🎯
Focusing

Hoang Manh Phu hmphu

🎯
Focusing
View GitHub Profile
@hmphu
hmphu / Caddyfile
Created March 7, 2019 09:06 — forked from molotovbliss/Caddyfile
Caddyfile for Magento 2.2.x+ for Caddy web server
# source: https://caddy.community/t/using-caddy-on-a-fresh-magento-2-2-3-ce-install/3708/8
https://example.com {
root /var/www/magento2/pub
gzip {
ext .txt .css .less .js .jsonp .json .xml .rss .svg .svgz .html
level 6
min_length 1100
}
tls webmaster@example.com
log stdout
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
@hmphu
hmphu / robots.txt
Created November 5, 2018 03:54 — forked from petskratt/robots.txt
Magento robots.txt
# robots.txt for Magento 1.9.x / v1.6 2018-08-19 / Peeter Marvet
# (original version from 2015, edited in 2017 to add filter query parameter disallow samples + some wildcards,
# edited in 2018 to add query params blocking to Yandex as named User-agent does not read *)
# based on:
# http://inchoo.net/ecommerce/ultimate-magento-robots-txt-file-examples/
# http://www.byte.nl/blog/magento-robots-txt/
# https://astrio.net/blog/optimize-robots-txt-for-magento/
#
# comment and clone at https://gist.github.com/petskratt/016c9dbf159a81b9d6aa
# Keep in mind that by standard robots.txt should NOT contain empty lines, except between UA blocks!
@hmphu
hmphu / remove_closing_tags.sh
Created October 13, 2018 06:41
Strips the closing php tag `?>` and any following blank lines from the end of any PHP file in the current working directory and sub-directories
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28
@hmphu
hmphu / install-dokku.sh
Created September 22, 2018 19:09
Install Dokku on Debian 8
# Install latest NGINX
### Backup your current sources.list file
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
### Signing Nginx repo
wget -O - http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
### Add Nginx repositories to the end of ` /etc/apt/sources.list`
echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" | tee -a /etc/apt/sources.list
@hmphu
hmphu / nginx-tuning.md
Created August 17, 2018 06:06 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

Ref: https://gist.github.com/vertexclique/9839383

Important Note

Please use built-in Terminal.app (of Mac OS X) to type and rune the command, do not use another tool (like iTerm2).

For 3170 build 2018.05.08

VERSION PLATFORM OFFSET ORIGINAL CRACKED
@hmphu
hmphu / mage_stockToAllWebsites
Created April 15, 2018 06:45 — forked from rewake/mage_stockToAllWebsites
Magento - Fix broken/missing stock statuses
REPLACE INTO
cataloginventory_stock_status
(product_id, website_id, stock_id, qty, stock_status)
SELECT
csi.product_id,
cw.website_id,
csi.stock_id,
csi.qty,
csi.is_in_stock
FROM