Skip to content

Instantly share code, notes, and snippets.

View okovalov's full-sized avatar
🏠
Working from home

Oleksandr Kovalov okovalov

🏠
Working from home
View GitHub Profile
@okovalov
okovalov / app.js
Created December 11, 2012 16:53
Here is my helper which is included in app.js and which is being called in mysql provider
var helpers = require('../components/helpers');
var app = express();
app.set('helpers', helpers);
<?php
class BdController
{
private $_instance = null ;
public function __construct()
{
$this->_instance = new PDO('mysql:host=127.0.0.1; dbname=pa_tp1','root', '');
}
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/boot.php';
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Synfony\Component\HttpFoundation\Response;
$app = new Application();
@okovalov
okovalov / ant-composer.xml
Created August 22, 2016 17:03 — forked from cpliakas/ant-composer.xml
Apache Ant tagets for Composer commands.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Composer Targets" default="build">
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>
<target name="php-check">
<condition property="php" value="php">
<not>
<isset property="${php}"/>
@okovalov
okovalov / gist:7a233858653e69b64bf4d5c23adb3f60
Created September 1, 2016 20:20 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
Following these instructions you would get three virtual machines , whereas one would be a server (ansible machine)
from where ansible would install software into two remaining virtual machines (destination servers).
Prerequsets (installed on a host machine):
- virtual box
- vagrant
List of software which will be installed on the destination servers (basic list, some dependencies will be installed as well):
- git
To be able to use Fabric for deploy you must have some things done:
- you need to be able to ssh to the server where the deployemnt is meant to be done.
- your Python version should match a certain required one
- you must have `pip` installed
- you must have `virtualenv` installed
- you must have `fabric` installed inside your virtual environment (please read about virtual env below)
Note about SSH: Basically Fabric uses ssh to connect to the sever so before you even
start with Fabbric please make sure your computer (user) public key is added to the
server's authorized hosts and you are able to ssh to the server without prompting
@okovalov
okovalov / gist:1207185e1d93567f8470e41f9405ad26
Created September 8, 2016 16:55 — forked from robertfyffe/gist:8315921
HTML: Starting Template
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<link rel="stylehsheet" href="">
</head>
<body>
</body>
from __future__ import with_statement
from fabric.api import local, env, settings, abort, run, cd
from fabric.contrib.console import confirm
import time
# Please create this directory on your production server
code_dir='/var/www/deploy-stage'
# Please make sure this directory exists and contains uploaded files
# most of the cases it is a good idea to keep your uploads apart from your source code
#!/bin/bash
if [ -z "$1" ]
then
echo "No destination path is given"
exit 1
fi
if [ -z "$2" ]
then