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
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/2.2.7.tar.gz \ | |
&& tar xfz /tmp/redis.tar.gz \ | |
&& rm -r /tmp/redis.tar.gz \ | |
&& mv phpredis-2.2.7 /usr/src/php/ext/redis \ | |
&& docker-php-ext-install redis |
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 5.6: | |
RUN apt-get update \ | |
&& apt-get install -y libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \ | |
&& pecl install memcached \ | |
&& echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini \ | |
&& apt-get remove -y build-essential libmemcached-dev libz-dev \ | |
&& apt-get autoremove -y \ | |
&& apt-get clean \ | |
&& rm -rf /tmp/pear |
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
# Remove all stopped containers. | |
docker rm $(docker ps -a -q) | |
#Remove all untagged images | |
docker rmi $(docker images | grep "^<none>" | awk "{print $3}") |
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
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm |
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 | |
function ip_is_private ($ip) { | |
$pri_addrs = array ( | |
'10.0.0.0|10.255.255.255', // single class A network | |
'172.16.0.0|172.31.255.255', // 16 contiguous class B network | |
'192.168.0.0|192.168.255.255', // 256 contiguous class C network | |
'169.254.0.0|169.254.255.255', // Link-local address also refered to as Automatic Private IP Addressing | |
'127.0.0.0|127.255.255.255' // localhost | |
); |
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 | |
function array_to_csv_download($array, $filename = "export.csv", $delimiter=";") { | |
// open raw memory as file so no temp files needed, you might run out of memory though | |
$f = fopen('php://memory', 'w'); | |
// loop over the input array | |
foreach ($array as $line) { | |
// generate csv lines from the inner arrays | |
fputcsv($f, $line, $delimiter); | |
} | |
// reset the file pointer to the start of the file |
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 | |
function fetch_imap( $host, $username, $password, $port ){ | |
$hostname = '{'.$host.':'.$port.'/imap/ssl/novalidate-cert}INBOX'; | |
/* try to connect */ | |
$inbox = imap_open( $hostname, $username, $password ) | |
or die("Can't connect to '$hostname': " . var_dump(imap_errors()) ); | |
// or die('Cannot connect to Gmail: ' . imap_last_error()); | |
/* grab emails */ | |
$emails = imap_search( $inbox, 'UNSEEN' ); |
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 | |
set_time_limit(0); | |
file_put_contents( 'progress.txt', '' ); | |
$targetFile = fopen( 'filename.zip', 'w' ); | |
$ch = curl_init( 'URL to File' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); |
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 | |
/** | |
* Author: minimus | |
* Date: 24.10.13 | |
* Time: 12:14 | |
*/ | |
define('DOING_AJAX', true); | |
if (!isset( $_POST['action'])) die('-1'); |