Le déploiement est lancé depuis une box Vagrant disposant de Ruby >= 2.0. Dans le gestionnaire de paquets RubyGem, il faut penser à ajouter capistrano.
- Git
<?php | |
set_time_limit(0); | |
$db = new PDO( | |
'pgsql:dbname=dbname host=host port=5432;options=--application_name=APPLICATION_NAME', | |
'user', | |
'password', | |
[ | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, |
#!/bin/bash | |
# This script requires [entr](http://entrproject.org): `brew install entr` | |
# Tested on macOS Mojave | |
while true; do | |
# Watch for files changes or new files in the current directory, except in ./dist, ./vendor and ./.git, and execute ./do-something.sh | |
find . \( -path "./dist" -o -path "./vendor" -o -path "./.git" \) -prune -o -print | entr -d ./do-something.sh | |
done |
Vagrant.configure('2') do |config| | |
config.push.define "staging", strategy: "ftp" do |push| | |
push.host = "staging.dev" | |
push.passive = false | |
push.secure = true | |
push.username = "user" | |
push.password = "password" | |
push.destination = "/var/www/staging/" | |
push.dir = "./html/" | |
end |
#! /bin/sh | |
# Installation | |
# - Move this to /etc/init.d/myservice | |
# - chmod +x this | |
# | |
# Starting and stopping | |
# - Start: `service myservice start` or `/etc/init.d/myservice start` | |
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop` |
#!/bin/bash | |
vNbLights=9 | |
vWidth=3 | |
vSleep=0.5 | |
function sendRequest() { | |
nc -w0 -u lights.climagic.com 45444 <<< $1 | |
} |
<?php | |
/** | |
* Convert bytes | |
* @param int|string $bytes | |
* @return mixed returns an array with the converted value and a label key (see $unit) | |
*/ | |
function convert_bytes($bytes) | |
{ | |
$unit = array( |
#!/bin/bash | |
cd /path/to/dir/ | |
find . -type f -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -10 | cut -f2- -d" " | |
# or with modification time | |
find . -type f -print0 | xargs -0 stat -f "%m %t%Sm %N" | sort -rn | head -10 | cut -f2- |
#!/bin/bash | |
cd /path/to/dir/ | |
find . -type d -exec chmod 755 {} + | |
find . -type f -exec chmod 644 {} + |