Skip to content

Instantly share code, notes, and snippets.

View Swop's full-sized avatar
👨‍💻

Sylvain MAUDUIT Swop

👨‍💻
View GitHub Profile
@Swop
Swop / gist:5192053
Created March 18, 2013 23:40
Increase shmmax on MacOS X to enable more concurrent clients on Postgres.app
To increase temporary (during the current session):
sudo sysctl -w kern.sysv.shmmax=12582912
sudo sysctl -w kern.sysv.shmall=12582912
To enable it forever:
sudo vim /etc/sysctl.conf
kern.sysv.shmall=12582912
kern.sysv.shmmax=12582912
@Swop
Swop / gist:5520908
Created May 5, 2013 13:59
Delete submodule
oldPath="vendor/example"
git config -f .git/config --remove-section "submodule.${oldPath}"
git config -f .gitmodules --remove-section "submodule.${oldPath}"
git rm --cached "${oldPath}"
rm -rf "${oldPath}" ## remove src (optional)
rm -rf ".git/modules/${oldPath}" ## cleanup gitdir (optional housekeeping)
git add .gitmodules
git commit -m "Removed ${oldPath}"
@Swop
Swop / gist:5591187
Created May 16, 2013 11:48
Vim: save the file as root (by Vincent Jousse)
" Paste this in your .vimrc file
" Use w!! when you've forgotten to open your file as root
cmap w!! w !sudo tee % >/dev/null
@Swop
Swop / gist:5766293
Created June 12, 2013 15:25
PHP CLI Debug with Vagrant, XDebug and a allready configured PHPStorm
export PHP_IDE_CONFIG=serverName=mywebsite.lan
php -dxdebug.remote_host=192.168.33.1 app/console ...
@Swop
Swop / gist:5870975
Created June 26, 2013 19:48
Enable and configure OPCache in PHP 5.5
# Enable OPCache
zend_extension=/path/to/lib/php/extensions/no-debug-non-zts-20121212/opcache.so
# OPCache settings
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
@Swop
Swop / LocaleListener.php
Created July 2, 2013 07:36
Create a culture switch in Symfony2
<?php
namespace Your\Bundle\Listener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LocaleListener implements EventSubscriberInterface
{
<?php
namespace Foo\BarBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ArticleController extends Controller
{
public function editAction(Article article)
{
@Swop
Swop / gist:5990749
Created July 13, 2013 13:38
Get MySQL global databases size
#!/bin/bash
echo "SELECT table_schema, round(sum(data_length+index_length)/1024/1024,4) AS \"Size (MB)\" FROM information_schema.tables GROUP BY table_schema;" | mysql -u root --password=XXXX
@Swop
Swop / gist:6025390
Created July 17, 2013 23:14
Recreate /dev/null on a Linux box
rm /dev/null && mknod -m 666 /dev/null c 1 3
@Swop
Swop / gist:6025403
Created July 17, 2013 23:16
RSync symmetry powaa command
rsync -Haurov {USER}@{IP}:{REMOTE_PATH} {LOCAL_PATH}