Skip to content

Instantly share code, notes, and snippets.

View Swop's full-sized avatar
👨‍💻

Sylvain MAUDUIT Swop

👨‍💻
View GitHub Profile
@Swop
Swop / gist:9588180
Created March 16, 2014 19:04
Composer with GitHub Two Factor Authentication
Composer doesn't work with GitHub Two Factor Authentication.
You have to generate a token (with "repo" scope at least) at https://github.com/settings/applications
Copy the token and keep it somewhere safe.
Run: composer config -g github-oauth.github.com paste-your-token-here
@Swop
Swop / gist:9204942
Created February 25, 2014 08:18
Git log pretty
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
@Swop
Swop / gist:8635526
Created January 26, 2014 16:47
FOSUserBundle YAML configuration (credits: http://2levelsabove.com/fosuserbundle-yaml-configuration/)
# app/config/config.yml
fos_user:
db_driver: ~ # Required
firewall_name: ~ # Required
user_class: ~ # Required
use_listener: true
use_username_form_type: true
model_manager_name: null # change it to the name of your entity/document manager
if you don't want to use the default one.
from_email:
brew install postgresql
initdb /usr/local/var/postgres -E utf8
gem install lunchy
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.3.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents
lunchy start postgres
lunchy stop postgres
# TIPS PostgreSQL
# initdb /usr/local/var/postgres -E utf8 # create a database cluster
@Swop
Swop / gist:7494182
Created November 16, 2013 00:32
Simplify Local Development with Dnsmasq on MacOS X (credits: http://blakeembrey.com/articles/local-development-with-dnsmasq/)
# Install homebrew first...
# Then:
brew install dnsmasq
cp /usr/local/Cellar/dnsmasq/X.XX/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
sudo cp /usr/local/Cellar/dnsmasq/X.XX/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# Edit /usr/local/etc/dnsmasq.conf to add custom TLD (here: *.dev):
echo "address=/dev/127.0.0.1" >> /usr/local/etc/dnsmasq.conf
@Swop
Swop / gist:7224410
Created October 29, 2013 23:14
Stop spotlight indexer (mds deamon) - MacOS X
# Stop
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
# Start
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
@Swop
Swop / gist:6949862
Created October 12, 2013 13:10
Make A OSX Mavericks USB boot stick
# (Need a 8 GB USB drive should be called Untitled and formatted as Mac OS Extended (Journaled). The installer should be called Install OS X Mavericks.app and should be in the Applications folder.)
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
<?php
namespace Eko\MiscBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
@Swop
Swop / AppKernel.php
Created August 21, 2013 12:26
Speed up Vagrant for Sf2 apps by placed the cache & log dir in memory
<?php
class AppKernel extends Kernel
{
// ...
public function getCacheDir()
{
if (in_array($this->environment, array('dev', 'test'))) {
return '/dev/shm/appname/cache/' . $this->environment;
@Swop
Swop / jail.local
Created July 21, 2013 17:53
Adds Nginx DOS detection to Fail2ban
# /etc/fail2ban/jail.local
# [...]
[nginx-dos]
# Based on apache-badbots but a simple IP check (any IP requesting more than
# 240 pages in 60 seconds, or 4p/s average, is suspicious)
# Block for two full days.
# @author Yannick Warnier
enabled = true