This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Script usage: | |
* | |
* /script.php?fade_width=200&image_url=http://localhost/images/image.jpg | |
* | |
* @see http://imagemagick.org/Usage/compose/#copy | |
* @see http://imagemagick.org/Usage/compose/#dstout | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Calculate the inverse cosine to | |
get the angle of the focus plane | |
in relation with the photographed surface. | |
Where `adjacent`, `opposite` and `hypotenuse` | |
are the parts of a right-angled triangle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = dirname(__DIR__); | |
$dir_iterator = new RecursiveDirectoryIterator($path | |
, FilesystemIterator::SKIP_DOTS); | |
$iterator = new RecursiveIteratorIterator($dir_iterator | |
, RecursiveIteratorIterator::LEAVES_ONLY | |
, RecursiveIteratorIterator::CATCH_GET_CHILD); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize $1 | |
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script does a full backup of a MySQL server | |
* it uses `mysqldump` to save: | |
* | |
* - full database: create & inserts | |
* - tables create statements | |
* - table inserts | |
* - database routines: functions & stored procedures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example of the NASA APOD API with Memcached | |
* | |
* @see https://api.nasa.gov/api.html#apod | |
* @see http://php.net/manual/en/class.memcached.php | |
* | |
* Since it is working with the `DEMO_KEY` rate limits | |
* are very low, and can be see in the RESPONSE headers, e.g.: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/csv'); | |
$data[] = ['sent' | |
, 'success' | |
, '114661698' | |
, '709081462' | |
, '+919900123456' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello | |
world | |
apple | |
fruit | |
banana | |
yellow | |
orange | |
strawberry | |
cherry | |
pie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
if LC_ALL=C grep -q '[^[:print:][:space:]]' "/path/to/file.jpg"; then | |
echo "file contains non-ascii characters" | |
else | |
echo "file contains ascii characters only" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$word = 'scmo'; | |
$pspell_config = pspell_config_create("it"); | |
# Available modes: | |
# | |
# PSPELL_FAST | |
# PSPELL_NORMAL | |
# PSPELL_BAD_SPELLERS # this will slow down the script |