Skip to content

Instantly share code, notes, and snippets.

View svortex's full-sized avatar

svortex

  • Paris
View GitHub Profile
@svortex
svortex / VirtualHost
Last active December 14, 2015 06:59
a shell script to manage your virtual hosts without any pain
#!/bin/sh
#================================================================================
# virtualhost.sh
#
# A fancy little script to setup a new virtualhost in Ubuntu based upon the
# excellent virtualhost (V1.04) script by Patrick Gibson <patrick@patrickg.com> for OS X.
#
# This script has been tested on Ubuntu 7.10 (Gutsy Gibbon) with Apache2(!) and
# probably works on Debian as well, but this has not been tested (yet). If you use
# this script on other Linux distributions and can confirm it to work I would like to hear
@svortex
svortex / bomremover
Created May 23, 2013 11:21
remove bom from utf-8 files
#!/bin/bash
#
# BOMRemover v1.0
#
# (c) 2011, Adil Aliyev
# NEATS LLC
# Baku/Azerbaijan
#
# adilaliev@gmail.com
#
aptitude install -y git curl python-dev python-pip redis-server ruby1.9.1-full rubygems1.9.1
aptitude install -y mysql-server libmysqlclient-dev
adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git
adduser --disabled-login --gecos 'gitlab system' gitlab
usermod -a -G git gitlab
su - gitlab
ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa
aptitude install gitolite
cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
su - git
@svortex
svortex / symfony_security_bypass
Last active March 10, 2017 16:47
Bypass authentication for functional tests
$session = $this->client->getContainer()->get('session');
$container = $this->client->getContainer();
// the firewall context (defaults to the firewall name)
$firewall = 'main';
$em = $container->get("doctrine")->getManager();
$user = $em->getRepository('AppBundle:Utilisateur')
->findOneByEmail("compte_user@alteis.fr");
$token = new UsernamePasswordToken($user, null, $firewall, array('ROLE_USER'));
$session->set('_security_'.$firewall, serialize($token));