Skip to content
Türker Yıldırım
Writing
Snippets
About
Search
Snippets
One-liners, regexes and short scripts worth keeping. Copy, adapt, move on.
Find rows in one table with no match in another
indexing
mysql
query-optimization
sql
Forward a remote MySQL port over an SSH tunnel
bash
mysql
security
ssh
Limit how many post revisions WordPress keeps
mysql
php
wordpress
wp-performance
Run a command on every reboot with cron
backup
bash
deployment
linux
Run a single test method with PHPUnit
bash
php
phpunit
testing
List every Docker container including the stopped ones
bash
deployment
docker
linux
Check the health of an Elasticsearch cluster
bash
elasticsearch
linux
monitoring
Find which php.ini file is actually loaded
deployment
linting
logging
php
Convert a size string like 128M into bytes in PHP
oop
performance
php
refactoring
Stream a mysqldump straight into another server
backup
bash
mariadb
mysql
ssh
Find the process using the most memory
bash
linux
monitoring
vps
Show how much memory Redis is using
bash
monitoring
performance
redis
Raise the WordPress memory limit for the admin only
deployment
php
wordpress
wp-performance
Regenerate all WordPress thumbnails after changing an image size
bash
wordpress
wp-cli
wp-performance
Minify JavaScript and CSS with Grunt
css
html
javascript
linting
Show the size of every index on a table
indexing
mysql
query-optimization
sql
Make iptables rules survive a reboot
bash
firewall
linux
security
Detect when the user has scrolled to the bottom of the page
html
javascript
jquery
performance
Find the slowest PHP-FPM requests in the slow log
logging
monitoring
nginx
php
Convert a date string between two formats in PHP
linting
oop
php
refactoring
Limit the request rate for one URL in nginx
deployment
nginx
performance
security
Show a custom checkbox without a JavaScript plugin
bootstrap
css
html
javascript
Check which SSL protocols a server accepts
bash
monitoring
security
tls
Update the query string without reloading the page
html
javascript
jquery
refactoring
Find which files a running process has open
bash
deployment
linux
monitoring
Check whether a string starts with a prefix in PHP
linting
oop
php
refactoring
Show the OPcache hit rate
opcache
performance
php
profiling
Show the InnoDB status after a lock wait timeout
logging
monitoring
mysql
sql
Stream a large file download without exhausting memory in PHP
logging
oop
performance
php
Get the number of days between two dates in PHP
design-patterns
oop
php
refactoring
Show free disk space and inode usage
bash
linux
monitoring
vps
Convert an array to XML in PHP
api-design
oop
php
refactoring
Scroll to an element smoothly with jQuery
css
html
javascript
jquery
Style a placeholder across browsers
css
html
javascript
linting
Vertically centre a block of unknown height
bootstrap
css
html
javascript
Install a WordPress plugin from the command line
bash
wordpress
wp-cli
wp-plugins
Escape output for an HTML attribute in PHP
html
linting
php
security
Serialize a form to JSON with jQuery
api-design
html
javascript
jquery
Show the MySQL queries running right now
monitoring
mysql
query-optimization
sql
Copy an SSH public key to a server
bash
linux
security
ssh
Newer
1
2
3
4
5
6
Older