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
<?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 / 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', '');
}
@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
@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
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
#!/bin/bash
if [ -z "$1" ]
then
echo "No destination path is given"
exit 1
fi
if [ -z "$2" ]
then
Hi guys. Recently I had a situation when a certain directory had a few more sub-directories, and
I needed to perform an identical list of actions for each of those sub-directories and doing that
manually by changing the current directory and repeatedly executing same commands was quite annoying
so I decided to spend half an hour and create a bash script for that purpose.
A particular example of the situation I had was having several virtual machines located accordingly
in ~/Boxes/serverOne ~/Boxes/serverTwo ~/Boxes/serverThree (I was testing ansible and was recreating and destroying vms).
This script asks for the confirmation as well.