Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
function phpargs() { | |
curl -s http://us3.php.net/$1 | \ | |
sed -n '/<div class="methodsynopsis dc-description">/,/<\/div>/p' | \ | |
sed 's/<[^>]*>//g' | tr -d "\n" | |
echo | |
} |
<?php | |
// Before (this was repeated 3 times in one script, copy and pasted exactly...) | |
for($i=0,$btotal=0,$total=0,$page=1;$lclass=$row['class'],$lwhse=$row['whse'],$row=mysql_fetch_array($res);$i++,$total+=$row['cost'],$btotal+=$row['cost'],$gtotal+=$row['cost']) { | |
// ...snip.. 35 lines of echo statements dumping HTML | |
} | |
// Removing all the unused variables reduced it down to: | |
for ($i = 0; $row = mysql_fetch_array($res); $i++) { | |
// Same 35 lines of echo statements dumping HTML |
exec { "change_httpd_user": | |
command => "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars", | |
onlyif => "/bin/grep -q 'www-data' '/etc/apache2/envvars'", | |
notify => Service['apache2'], | |
require => Package['apache2'], | |
} | |
file { "/var/lock/apache2": | |
ensure => "directory", | |
owner => "vagrant", |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
# Mouse support | |
setw -g mode-mouse on | |
set-option -g mouse-select-pane on | |
set-option -g mouse-select-window on | |
set -g mouse-resize-pane on | |
set -g mouse-select-window on | |
# tmux vi mode | |
setw -g mode-keys vi |
// Enter the day you would like to create | |
WITH { day: 18, month: 1, year: 2014 } as dayMap | |
// Merge hours in a day | |
MERGE (thisDay:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year }) | |
MERGE (firstHour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: 1 }) | |
CREATE (thisDay)-[:FIRST]->(firstHour) | |
FOREACH (i IN tail(range(1, 24)) | | |
MERGE (thishour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i }) | |
MERGE (lasthour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i - 1 }) |
# pretty-print a JSON result | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.' | |
# grab the data list | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data' | |
# Get *just* the first album | |
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data[0]' | |
# Narrow that first entry to some specific data |
By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk.
This process is outlined at the Nginx ngx_http_fastcgi_module page manual page.
<?php | |
namespace Twilio; | |
use GuzzleHttp\Client as HttpClient; | |
use GuzzleHttp\Collection; | |
use GuzzleHttp\Command\Guzzle\GuzzleClient; | |
use GuzzleHttp\Command\Guzzle\Description; | |
use GuzzleHttp\Command\Model; | |
use GuzzleHttp\Subscriber\Retry\RetrySubscriber; |