Skip to content

Instantly share code, notes, and snippets.

View seyfer's full-sized avatar
💭
pet the duck until exploded

Oleg Abrazhaev seyfer

💭
pet the duck until exploded
View GitHub Profile
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@seyfer
seyfer / ocp.php
Created August 6, 2014 10:44 — forked from kabel/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok, n1xim, pennedav, kabel)
Version: 0.2.0
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.2.0 0000-00-00 Updated page layout/styles and restructure code to be more MVC-like (kabel)
implemented HTTP Basic authentication (pennedav)
@seyfer
seyfer / gearmand
Created February 3, 2015 06:59
Gearman Daemon init.d for Debian
#!/bin/sh
# Gearman server and library
# Copyright (C) 2013 Mostafa Amiri
# All rights reserved.
#
# Use and distribution licensed under the BSD license. See
# the COPYING file in this directory for full text.
NAME=gearmand
@seyfer
seyfer / gearmand
Created February 3, 2015 07:27
Gearmand init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: gearmand
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: gearmand
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
#!/bin/bash
# http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast#answer-201018
# 1. Run byzanz-record-window 30 -c output.gif
# 2. Go to the window (alt-tab) you want to capture. Click on it.
# 3. Wait 10 seconds (hard-coded in $DELAY), in which you prepare for recording.
# 4. After the beep (defined in the beep function), byzanz will start.
# 5. After 30 seconds (that's the meaning of 30 in step 1), byzanz ends. A beep will be broadcast again.
@seyfer
seyfer / byzanz-record-window-gui
Created March 18, 2015 08:41
byzanz-record-window-gui
#!/bin/bash
# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc)
# NAME: GIFRecord 0.1
# DESCRIPTION: A script to record GIF screencasts.
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd)
# Time and date
TIME=$(date +"%Y-%m-%d_%H%M%S")
@seyfer
seyfer / gist:2b9b9afb0fe556ad273e
Created September 25, 2015 07:11 — forked from snipe/gist:4256150
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Symfony2
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="My Symfony2 Project" default="build">
<target name="build"
depends="prepare, vendors, dbupdate, fixtures, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare, vendors, dbupdate, fixtures, lint, tools-parallel, phpcpd, phpunit"/>
@seyfer
seyfer / ant-composer.xml
Created September 25, 2015 07:13 — 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}"/>
@seyfer
seyfer / negabase.php
Created March 9, 2017 04:18 — forked from CMCDragonkai/negabase.php
PHP: Negative Base Conversion from Base 10 Decimal
<?php
/**
* Negabase
* To convert a decimal to negative base.
* Divide the number by the negative base.
* Acquire the whole number quotient and remainder.
* If the remainder is negative, add 1 to the quotient and add the absolute value of the base to the remainder.
* Divide the quotient by the negative base... rinse and repeat until the quotient is 0.
* Aggregate the remainders in reverse (as a stack), and you have your negative base representation.
@seyfer
seyfer / knight-moves.js
Created March 9, 2017 05:09
Toptal Codility Problem: Can Knight reach square?
'use strict';
function getNextPositions(start) {
var moves = [
{ x: -2, y: -1 },
{ x: -2, y: +1 },
{ x: -1, y: -2 },
{ x: -1, y: +2 },
{ x: +1, y: -2 },
{ x: +1, y: +2 },