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.
Read a huge file line by line in PHP
benchmarking
performance
php
refactoring
Retry a callable with exponential backoff
async
design-patterns
php
queues
Flatten a nested array in PHP
design-patterns
oop
php
refactoring
Show the current MySQL sql_mode
linting
migrations
mysql
sql
Time a block of code in PHP
benchmarking
performance
php
profiling
Dump and restore a single Redis database
backup
bash
migrations
redis
Follow the logs of one Docker container
bash
docker
logging
monitoring
Delete rows in batches without locking the table
migrations
mysql
performance
sql
Find the biggest keys in Redis
bash
monitoring
performance
redis
Reindex an Elasticsearch index behind an alias
bash
deployment
elasticsearch
migrations
Find which Docker images are using the disk
bash
deployment
docker
monitoring
Test an nginx config before reloading
bash
deployment
linux
nginx
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
Newer
1
2
3
4
5
6
Older