Skip to content

Instantly share code, notes, and snippets.

View vpArth's full-sized avatar

Alexander Deider vpArth

  • https://github.com/skyeng
  • Russia, Novosibirsk
View GitHub Profile
@vpArth
vpArth / package.json
Created May 17, 2024 19:25
Show your TOTPs and update password files
{
"name": "totp",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"speakeasy": "^2.0.0"
}
}
@vpArth
vpArth / TicTacToe.php
Created August 24, 2018 09:34
TicTacToe implementation (variable map size, win condition, players set)
<?php
class TicTacToeGame
{
/** @var int */
private $width;
/** @var int */
private $height;
/** @var int */
private $winCond;
@vpArth
vpArth / AjaxAuthenticationListener.php
Created November 30, 2016 19:14 — forked from xanf/AjaxAuthenticationListener.php
AJAX auth errors listener for Symfony2
<?php
namespace Application\ProdrepHelperBundle\Component\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
/**
*/
class AjaxAuthenticationListener
@vpArth
vpArth / php5mod.py
Last active July 14, 2016 12:38
Ansible modules
#!/usr/bin/python
import os.path
import re
from subprocess import call
DOCUMENTATION = '''
module: php5mod
short_description: Wraps php5enmod/php5dismod functionality
description:
@vpArth
vpArth / _service.md
Created December 7, 2015 15:41 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
// http://www.multiplayerpiano.com/
var TEMP = 210; // bpm
function tap(note, part, next) {
MPP.piano.play(note, 1, MPP.client.getOwnParticipant(), 0);
setTimeout(function(){
MPP.piano.stop(note, MPP.client.getOwnParticipant(), 0);
next();
}, 60e3/(TEMP*part)*4);
@vpArth
vpArth / Symfony2 + FOSRestBundle.md
Created September 15, 2015 15:07 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

#include <map>
#include <iostream>
#include <signal.h>
#include <unistd.h>
class Strategy
{
public:
virtual void use(void) = 0;
};
@vpArth
vpArth / commenting.vimrc
Created November 16, 2014 15:36
Vim Snippets
" Toggle comment line
" Ctrl+/
let s:comment_map = {
\ "c": '//',
\ "cpp": '//',
\ "go": '//',
\ "java": '//',
\ "javascript": '//',
\ "php": '//',