Türker Yıldırım
Writing
Snippets
About
Search
Snippets
One-liners, regexes and short scripts worth keeping. Copy, adapt, move on.
Recursively delete a directory in PHP
backup
linux
oop
php
Validate an email address in PHP
linting
oop
php
security
Convert a MySQL database to utf8mb4
mariadb
migrations
mysql
sql
Ban an IP with fail2ban from the command line
bash
fail2ban
firewall
security
Show which process is listening on a port
bash
deployment
linux
monitoring
Find the largest directories on a Linux server
bash
linux
monitoring
vps
Reset a MySQL root password
bash
mariadb
mysql
security
Generate a self-signed SSL certificate
bash
nginx
security
tls
Write an array to CSV in PHP
linting
migrations
oop
php
Copy text to the clipboard with JavaScript
css
html
javascript
jquery
Count requests per IP in an nginx access log
bash
logging
monitoring
nginx
security
Export a single table with mysqldump
backup
bash
migrations
mysql
Replace a URL across a WordPress database
bash
migrations
wordpress
wp-cli
Get the peak memory usage of a PHP script
benchmarking
performance
php
profiling
Sync a directory to a remote server over SSH
bash
deployment
linux
ssh
Center an element with flexbox
bootstrap
css
html
javascript
Kill all sleeping MySQL connections
monitoring
mysql
performance
sql
Reset a WordPress admin password with WP-CLI
bash
security
wordpress
wp-cli
Generate a cryptographically secure token in PHP
oop
php
psr
security
Show the largest tables in a MySQL database
mysql
performance
query-optimization
sql
Find files modified in the last hour
bash
deployment
linux
logging
Delete log files older than 30 days
backup
bash
linux
logging
Tail several log files at once
bash
linux
logging
monitoring
Force a log rotation immediately
bash
linux
logging
monitoring
Debounce a JavaScript function
html
javascript
jquery
performance
Truncate text with an ellipsis in CSS
bootstrap
css
html
javascript
Find duplicate rows in a MySQL table
indexing
mysql
query-optimization
sql
Keep a 16:9 aspect ratio for an embedded video
bootstrap
css
html
javascript
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
Newer
1
2
3
4
5
6
Older