Skip to content

Instantly share code, notes, and snippets.

View florentdestremau's full-sized avatar

Florent Destremau florentdestremau

View GitHub Profile
@florentdestremau
florentdestremau / gist:59fe3568ca72943aece5
Created March 3, 2015 13:32
VirtualHost for sf2 apache 2.4+
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/project/web
<Directory /var/www/project/web>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
@florentdestremau
florentdestremau / Apache-auth
Last active August 29, 2015 14:16
Enable apache auth for websites under construction
First of all, you need uapache2-utils tools.
sudo apt-get install apache2-utils
Then you add this in your virtualhost in your <Directory> tag :
#Require all granted
# you need to comment this line above to require a valid-user
AuthName "This website is not ready to go public !"
AuthType Basic
@florentdestremau
florentdestremau / create_thumb.php
Created March 17, 2015 20:58
Make an automatic thumbnail in PHP
function create_thumb($src,$dest,$desired_width = false, $desired_height = false)
{
/*If no dimenstion for thumbnail given, return false */
if (!$desired_height&&!$desired_width) return false;
$fparts = pathinfo($src);
$ext = strtolower($fparts['extension']);
/* if its not an image return false */
if (!in_array($ext,array('gif','jpg','png','jpeg'))) return false;
/* read the source image */
@florentdestremau
florentdestremau / gist:6af2b904f6f384a0fd11
Created June 10, 2015 18:25
Simple basic capifony config for a symfony app
set :application, "auxiliaris"
set :domain, "#{application}.flodz.ovh"
set :deploy_to, "/var/www/#{domain}"
set :app_path, "app"
set :user, "root"
ssh_options[:forward_agent] = true
set :repository, "git@github.com:florentdestremau/#{application}.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`
@florentdestremau
florentdestremau / .tmux.conf
Created September 22, 2015 08:40
Simple set up for tmux: Alt + arrow switching and split binding
set -g prefix C-a
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind | split-window -h
bind - split-window -v
@florentdestremau
florentdestremau / ProjectConfiguration.php
Created September 28, 2015 16:45
Symfony 1 relocate cache dir for vagrant use
<?php
require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
@florentdestremau
florentdestremau / -etc-apache2-apache2.conf
Created October 11, 2015 10:15
PhpMyAdmin problem solving
Include /etc/phpmyadmin/apache.conf
@florentdestremau
florentdestremau / brightness
Created January 13, 2016 10:56
Manually set the brightness (from 0 to 1 scale). For those like me with an Asus Zenbook and no control over it, you can have a custom shortcut
xrandr --output eDP1 --brightness 0.75
@florentdestremau
florentdestremau / xdebug.ini
Created January 22, 2016 10:16
Xdebug config
zend_extension=/usr/lib/php5/20100525/xdebug.so
[xdebug]
xdebug.cli_color = 1
xdebug.scream = Off
xdebug.max_nesting_level = 500
[xdebug-remote-debug]
xdebug.remote_enable = true
xdebug.remote_autostart = 0
xdebug.remote_mode = req
@florentdestremau
florentdestremau / .tigrc
Created April 13, 2016 13:29
A simple tig custom config
# In status view, push to origin
bind status P !git push origin
# In status view, pull from origin
bind status L !git pull origin
# In any view, amend current commit
bind generic + !git commit --amend
# In status view, delete selected file