Skip to content

Instantly share code, notes, and snippets.

View flug's full-sized avatar
:octocat:
yeah yeah yeah

Flug flug

:octocat:
yeah yeah yeah
View GitHub Profile
@flug
flug / gist:0e4b91b1828b1d61acc3
Created June 13, 2014 16:07
Sort process by memory and kill the biggest proccess
ps ax --sort %cpu --format pid|tail -n 1|xargs kill

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@flug
flug / composer-update.sh
Last active August 29, 2015 14:07
dynamize
function composer-update (){
echo "-- composer update --"
$(which hhvm) $(which composer) self-update
$(which hhvm) $(which composer) update -vvv --profile --no-scripts && $(which php) $(which composer) run-script post-update-cmd
echo "-- composer update end --"
}

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@flug
flug / README.md
Created January 7, 2015 09:15
FosUserBundle without other bundles
    entity.admin.user.entity.class: My\WebBundle\Entity\User
    admin_user.user_manager:
        class: FOS\UserBundle\Doctrine\UserManager
 arguments: [@security.encoder_factory, @fos_user.util.username_canonicalizer, @fos_user.util.email_canonicalizer, @fos_user.entity_manager,%entity.admin.user.entity.class% ]
@flug
flug / gist:2295dd95dc9a147695ac
Created March 5, 2015 14:23
hhvm with composer other method for using composer with hhvm
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 /bin/composer
#!/usr/bin/env zsh
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
setopt promptsubst
autoload -U add-zsh-hook
ROOT_ICON_COLOR=$FG[111]
MACHINE_NAME_COLOR=$FG[208]
PROMPT_SUCCESS_COLOR=$FG[103]
PROMPT_FAILURE_COLOR=$FG[124]
echo Bonjour $USER, nous sommes le `date +"%A %e %B %Y"`, et il est : `date +"%H"` h `date +"%M"` | cowsay -f $(/bin/ls /usr/share/cowsay/cows -1 | head -n $(expr $$$(date +%s) % $(ls /usr/share/cowsay/cows | wc -w) + 1) | tail -n 1)
@flug
flug / AbstractType.php
Last active August 29, 2015 14:24
An abstract class for reflect entity
<?php
namespace My\Bundle\FrontendBundle\Form;
use Symfony\Component\Form\AbstractType as SymfonyAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
abstract class AbstractType extends SymfonyAbstractType
{
@flug
flug / gist:bc930bcce1c39475331f
Created July 20, 2015 12:32
stopwords elasticsearch
"stopwords" : ["ès", "vers", "a", "à", "afin", "ai", "ainsi", "après", "attendu", "au", "aujourd", "auquel", "aussi", "autre", "autres", "aux", "auxquelles", "auxquels", "avait", "avant", "avec", "avoir", "c", "ça", "car", "ce", "ceci", "cela", "celle", "celles", "celui", "cependant", "certain", "certaine", "certaines", "certains", "ces", "cet", "cette", "ceux", "chez", "ci", "combien", "comme", "comment", "concernant", "contre", "d", "dans", "de", "debout", "dedans", "dehors", "delà", "depuis", "derrière", "des", "dès", "désormais", "desquelles", "desquels", "dessous", "dessus", "devant", "devers", "devra", "divers", "diverse", "diverses", "doit", "donc", "dont", "du", "duquel", "durant", "elle", "elles", "en", "entre", "environ", "est", "et", "etc", "été", "etre", "être", "eu", "eux", "excepté", "hélas", "hormis", "hors", "hui", "il", "ils", "j", "je", "jusqu", "jusque", "l", "la", "là", "laquelle", "le", "lequel", "les", "lesquelles", "lesquels", "leur", "leurs", "lorsque", "lui", "ma", "mais", "malgré", "