Assuming you’ve apache2 already installed and a reachable internet server running
apt-get install dehydrated
Add/edit /etc/apache2/conf-available/letscrypt.conf
(notice the difference between the alias and the real directory which is plural acme-challenges):
Alias /.well-known/acme-challenge/ "/var/lib/dehydrated/acme-challenges/"
<Directory "/var/lib/dehydrated/acme-challenges/">
Options None
AllowOverride None
# Apache 2.x
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Directory>
Add/edit /etc/dehydrated/conf.d/99_email.sh
:
CONTACT_EMAIL="anymail@yourdomain"
Edit /etc/dehydrated/domains.txt
, set the domains for which generate certificates.
Restart apache2 and run dehydrated -c
, it should create the domain certs.
Edit your apache’s host file (/etc/apache2/sites-available/default-ssl.conf
), replace DOMAIN with your domains:
SSLCertificateFile /var/lib/dehydrated/certs/DOMAIN/fullchain.pem
SSLCertificateKeyFile /var/lib/dehydrated/certs/DOMAIN/privkey.pem
Add/edit /etc/cron.daily/dehydrated
:
#!/bin/sh
exec /usr/bin/dehydrated -c >/var/log/dehydrated-cron.log 2>&1
Run chmod 0755 /etc/cron.daily/dehydrated
Add/Edit /etc/logrotate.d/dehydrated
:
/var/log/dehydrated-cron.log
{
rotate 12
monthly
missingok
notifempty
delaycompress
compress
}
mkdir ~/.git-templates
git config --global init.templatedir ~/.git-templates
git config -l
mkdir -p ~/.git-templates
tar -xvzf git-templates.tgz -C ~/.git-templates
get the url
cd ~/some-git-repo
git ls-remote --get-url 'origin'
EDIT ~/.gitconfig
and add an entry
[user "url-from--get-url"]
email = sample@eml
name = name surname
check it is working
git clone <url-from--get-url>
references: git-templates.tgz
~/ttyACM0
:
#!/bin/sh
exec /usr/bin/picocom -b 115200 /dev/ttyACM0
initialization:
ATZ
AT+VCID=1
ATS0=0
attach tmux:
tmux attach
detach from tmux:
Ctrl+b d
PhpStorm versions older than 9.5 may have some trouble running phpunit tests:
PHP Fatal error: Call to undefined method PHP_CodeCoverage_Filter::addFileToBlacklist()
so:
composer require --dev "phpunit/phpunit=4.*" # to install phpunit as dev dependency then...
# not working with phpunit 5
composer require --dev phpunit/php-code-coverage dev-master#b8436b000263f6d72fbad1d36890e247ce84857e
- packages/
- xpackage/
- projects/
- xproject/
(may have more packages and/or more projects)
mkdir -p $HOME/.composer/vendor/bin
curl -sS https://getcomposer.org/installer | php
mv composer.phar $HOME/.composer/vendor/bin/composer
and add the path to the environment variable PATH
export PATH=$PATH:$HOME/.composer/vendor/bin
composer global require "phpunit/phpunit=4.7.*"
composer.json
phpunit.xml
bootstrap.php
- src/
- XClass.php
- tests/
- OutputTest.php
namespace XVendor\XPackage;
class XClass {
public static function test() {
echo "should work";
}
}
{
"name": "xvendor/xpackage",
"description": "package description",
"authors": [
{
"name": "Author",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"XVendor\\XPackage\\": "src/"
}
}
}
<phpunit bootstrap="bootstrap.php">
<testsuites>
<testsuite name="xpackage">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
spl_autoload_register(function ($class) {
$dirs = explode("\\", $class);
if ($dirs[0] !== 'XVendor')
return;
array_splice($dirs, 0, 2); /* drop vendor & package */
$file = dirname(__FILE__).'/src/'.implode('/',$dirs).'.php';
include $file;
use XVendor\XPackage\XClass;
class OutputTest extends PHPUnit_Framework_TestCase
{
/* @covers XClass:test */
public function testExpectFooActualFoo()
{
$this->expectOutputString('should work');
print XClass::test();
}
}
cd xpackage/
git init
git add .
git commit -m 'initial import'
versioning the package is required
- composer.json
- phpunit.xml
- bootstrap.php
- src/
- index.php
- tests/
- OutputTest.php
# created on composer install
- vendor/*
- composer.lock
{
"repositories": [
{ "packagist": false },
{
"type":"vcs",
"url":"../../packages/xpackage"
}
],
"require": {
"xvendor/xpackage": "@dev"
}
}
create it then install the dependency
composer install
(will create composer.lock
and vendor/
)
<phpunit>
<testsuites>
<testsuite name="xproject">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
require_once __DIR__ . '/../vendor/autoload.php';
use \XVendor\XPackage\XClass;
function test() {
XClass::test();
}
require __DIR__.'/../src/index.php';
class OutputTest extends PHPUnit_Framework_TestCase
{
/* @covers XClass:test */
public function testExpectShouldWork()
{
$this->expectOutputString('should work');
print test();
}
}
On production you should optimize loader performances creating a class map file
composer dumpautoload -o