Skip to content

Instantly share code, notes, and snippets.

View chesio's full-sized avatar

Česlav Przywara chesio

View GitHub Profile
@chesio
chesio / .htaccess
Last active February 13, 2020 13:03
Language redirect via .htaccess
### BEGIN Language redirect
## Example:
# - root URL: http://www.example.com/
# - DE version: http://www.example.com/de/
# - EN version: http://www.example.com/en/
# - IT version: http://www.example.com/it/
## Further notes
# Works also for websites with site root in subdirectory, eg. http://www.example.com/blog/
@chesio
chesio / aspect-ratios.md
Last active March 3, 2023 14:04
Common aspect ratios

Aspect ratios from high-most to wide-most

Up to 1000px width

ratio 48px 240px 320px 400px 480px 512px 600px 640px 768px 960px
1:1 48×48 240×240 320×320 400×400 480×480 512×512 600×600 640×640 768×768 960×960
4:3 48×36 240×180 320×240 400×300 480×360 512×384 600×450 640×480 768×576 960×720
3:2 48×32 240×160 - - 480×320 - 600×400 - 768×512 960×640
16:10 48×30 240×150 320×200 400×250 480×300 512×320 - 640×400 768×480 960×600
@chesio
chesio / .htaccess
Created November 28, 2018 19:09
Apache version detection
<IfModule mod_version.c>
<IfVersion >= 2.5>
RewriteRule ^ https://httpd.apache.org/docs/trunk/ [R=301,L]
</IfVersion>
<IfVersion >= 2.3>
RewriteRule ^ https://httpd.apache.org/docs/2.4/ [R=301,L]
</IfVersion>
<IfVersion >= 2.1>
RewriteRule ^ https://httpd.apache.org/docs/2.2/ [R=301,L]
</IfVersion>
@chesio
chesio / bash_aliases.sh
Last active October 19, 2021 12:33
Useful Bash aliases
## Working with shell
# - [r]e[m]ove [d]irectory
alias rmd='rm -rf'
# - [l]ist in [h]uman format
alias lh='ls -lh'
# - [l]ist [u]sage
alias lu='ls | xargs -d "\n" du -sh'
@chesio
chesio / .htaccess
Created January 10, 2018 16:56
.htaccess rules for Cachify on WordPress installations in subdirectory at EDIS vhost
# BEGIN Cachify
<IfModule mod_rewrite.c>
RewriteEngine on
# Set hostname directory
RewriteCond %{ENV:HTTPS} =on
RewriteRule .* - [E=CACHIFY_HOST:https-%{HTTP_HOST}]
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* - [E=CACHIFY_HOST:%{HTTP_HOST}]
@chesio
chesio / .screenrc
Created November 23, 2017 19:38
GNU Screen - main configuration file
# GNU Screen - main configuration file
# Inspired by:
# - https://gist.github.com/ChrisWills/1337178
# - https://wiki.archlinux.org/index.php/GNU_Screen
# Turn welcome message off
startup_message off
# Allow bold colors - necessary for some reason
attrcolor b ".I"
@chesio
chesio / wordpress-apache-hardening.md
Last active January 3, 2023 04:22
Some common rules to harden WordPress running on Apache webserver
@chesio
chesio / .htaccess
Created May 10, 2017 12:20
Restrict access to a file (debug.log) on Apache webserver
# Restrict access to debug.log only to certain IPs
<Files "debug.log">
<IfModule mod_authz_core.c>
# Multiple IP (network) addresses need to be separated by space
Require ip 127.0.0.1
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
# Multiple IP (network) addresses need to be separated by space
@chesio
chesio / .htaccess
Created May 10, 2017 12:12
Locally disable execution of PHP files on Apache webserver
# Block access to php, php3, php4, php5 and phtml files
<FilesMatch "\.(?:[Pp][Hh][Pp][345]?|[Pp][Hh][Tt][Mm][Ll])$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</FilesMatch>