Provides a small layer on top of serve-static, which allows to serve pre-gzipped files. Supports brotli and allows configuring any other compression you can think of as well.
Change the asset URL with middleware.
app.get('*.js', function(req, res, next) {
req.url = req.url + '.gz';
res.set('Content-Encoding', 'gzip');
res.set('Content-Type', 'text/javascript');
next();
});
app.get('*.css', function(req, res, next) {
req.url = req.url + '.gz';
res.set('Content-Encoding', 'gzip');
res.set('Content-Type', 'text/css');
next();
});
This module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.
a2enmod|a2dismod MODULE_NAME
Example enable mod_deflate
$ sudo a2enmod mod_deflate
Since mod_deflate
re-compresses content each time a request is made, some performance benefit can be derived by pre-compressing the content and telling mod_deflate
to serve them without re-compressing them. This may be accomplished using a configuration like the following:
<IfModule mod_headers.c>
# Serve gzip compressed CSS and JS files if they exist
# and the client accepts gzip.
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.(css|js)" "$1\.$2\.gz" [QSA]
# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped &
# non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
Setup for pre-compressed content. Compression can be done with: gzip -rk *.js *.css
Than add to .htaccess
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.(js|css)$ $1\.$2\.gz [QSA]
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=manualgzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=manualgzip:1]
<ifmodule mod_headers.c>
# setup this header only if rewrites above were used
Header set Content-Encoding "gzip" env=manualgzip
</ifmodule>
To find the files that have been changed (with the files data modification time older than) in the last N days from a directory and subdirectories, use:
find /directory/path/ -mtime -N -ls
Where:
find
is the Unix command line tool for finding files (and more)/directory/path/
is the directory path where to look for files that have been modified. Replace it with the path of the directory where you want to look for files that have been modified in the last N
days-mtime -N
is used to match files that had their data modified in the last N
days. Replace N
with a number (integer)-ls
lists the resulting files (the files that have been modified in the last N days) in ls -dils
format on standard output. You can skip this, but using it you'll get more information like the file size, permissions, the modification date, etc.Examples:
Find all files modified in the last day (24 hours; between now and a day ago) in a directory and subdirectories:
find /directory/path/ -mtime -1 -ls
-mtime -1
is the same as -mtime 0
.
Find all files modified in the last 30 days:
find /directory/path/ -mtime -30 -ls
If you need to find the files that have a modification date older than N
, for example older than 30 days? In that case you need to use +N
instead of -N
, like this:
find /directory/path/ -mtime +N -ls
find /directory/path/ -mtime +7 -ls
Find all files modified more than 48 hours ago (at least 2 days ago):
find /directory/path/ -mtime +1 -ls
find /directory/path/ -mtime 1 -ls
So why is 1
one day ago, and +1
older than 2 days / 48 hours ago? That's because according to the man find
, any fractional parts are ignored, so if a file was last modified 1 day and 23 hours ago, -mtime +1
won't match it, treating it as if the file was last modified 1 day, 0 hours, 0 minutes, and 0 seconds ago; see this explanation on why that's the case.
This being the case, how can you get all files modified at least 1 day ago? Use +0
:
find /directory/path/ -mtime +0 -ls
Using minutes instead of days
To find the files that have been modified N minutes ago, or with a modification date older than N
, simply replace -mtime
with -mmin
.
Minimalist Wiki like script
Shorty one-liner! Just for fun.
Minimalist Wiki, but more advanced than 'WikWiki', has two version full & core.
Core version is just one php file, much better implementation than 'WikWiki'. Supports different templates. The full version has some more features, still just 250KB
in size.
DokuWiki is a simple to use and highly versatile Open Source wiki software that doesn't require a database.
Full featured lightweight wiki. No database required!
Neard is a portable WAMP software stack involving useful binaries, tools and applications for your web development. It is a free and open source software and always will be!
Windows 7 or later.