Tag Cloud
Currently Reading
Latest Book Reviews
- Certified Kubernetes Application Developer (CKAD) Study Guide, 2nd Edition Posted on January 11, 2025
- Rancher Deep Dive Posted on March 31, 2023
- Leveraging Kustomize for Kubernetes Manifests Posted on March 24, 2023
- Automating Workflows with GitHub Actions Posted on October 13, 2022
- Deep-Dive Terraform on Azure Posted on August 30, 2022 All Book Reviews
Latest Posts
- PHP memory_limit stress testing Posted on December 22, 2012
- Finding the number of files inside a subdirectory Posted on December 18, 2012
- Setting phpMyAdmin to display a single database Posted on December 18, 2012
- Creating a loopback file system for testing purposes Posted on December 17, 2012
- Flush DNS cache in Mac OS X Posted on December 11, 2012
December 22, 2012
PHP memory_limit stress testing
by Alpha01
I wrote this code a couple of years ago that I found it was very useful when I was troubleshooting PHP memory limit settings. The script essentially creates one huge array until it runs out of memory.
<?php
ini_set('display_errors', true);
while (1) {
echo 'Hello' . nl2br("\n");
$array = array(1,2);
while(1) {
$tmp = $array;
$array = array_merge($array, $tmp);
echo memory_get_usage() . nl2br("\n");
flush();
sleep(1);
}
}
?>
php
apache
]
December 18, 2012
Finding the number of files inside a subdirectory
by Alpha01
for i in `ls .`; do echo $i; ls -laR $i| grep -v ^[.dlt] | grep -v ^$ | wc -l; echo "--------------------" ; done
bash
]
December 18, 2012
Setting phpMyAdmin to display a single database
by Alpha01
Edit config.inc.php
$cfg['Servers'][$i]['only_db'] = 'databasename';
php
mysql
]
December 17, 2012
Creating a loopback file system for testing purposes
by Alpha01
Using the all mighty dd
tool, this example the block size is 1024 bytes and a total of 5000 blocks:
dd if=/dev/zero of=/tmp/temploopbackimage.img bs=1024 count=5000
Associate the image file to the loopback device
losetup /dev/loop3 /tmp/temploopbackimage.img
Now you should be able to format /dev/loop3
testing
]
December 11, 2012
Flush DNS cache in Mac OS X
by Alpha01
Mountain Lion and Lion
sudo killall -HUP mDNSResponder
Snow Leopard
sudo dscacheutil -flushcache
macos
networking
]