Skip to content

Instantly share code, notes, and snippets.

View FabienSalles's full-sized avatar
💭
I may be slow to respond.

Fabien Salles FabienSalles

💭
I may be slow to respond.
View GitHub Profile
@FabienSalles
FabienSalles / .gitconfig
Last active March 4, 2024 23:12
Simple Git Config
[user]
name = ton_nom
email = ton@email.tld
[color]
ui = true
diff = auto
status = auto
branch = auto
interactive = auto
[alias]
@FabienSalles
FabienSalles / gist:050d1d8dcce0ea76ef8cf40abd71bdc7
Created April 3, 2019 10:03
Overide symfony validation mapping
Symfony 2.5 changed the way validation files were loaded. Here is how to do it now (using the Finder component to dynamically load):
Create a compiler pass:
namespace MyBundle\DependencyInjection\Compiler;
use Symfony\Component\Finder\Finder;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@FabienSalles
FabienSalles / Listener.php
Last active December 7, 2017 14:47
Surchage entité doctrine
<?php
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Pim\Bundle\ApiBundle\Entity\AuthCode;
class AuthCodeMappingListener
{
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
Using cURL
curl -XDELETE localhost:9200/index/type/documentID
e.g.
curl -XDELETE localhost:9200/shop/product/1
You will then receive a reply as to whether this was successful or not. You can delete an entire index or types with an index also, you can delete a type by leaving out the document ID like so -
docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
@FabienSalles
FabienSalles / nodejs to node ubuntu
Created March 16, 2017 13:15
/usr/bin/env: ‘node’: No such file or directory
sudo ln -s "$(which nodejs)" /usr/local/bin/node
@FabienSalles
FabienSalles / phmyadmin
Created October 13, 2015 11:21
Vhost PhpMyAdmin
Alias /phpmyadmin/ "/usr/share/phpmyadmin/"
<Directory /usr/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
@FabienSalles
FabienSalles / gist:04cfc528cdea66663e6d
Last active September 10, 2015 07:58
Autoriser l'accès à un serveur mysql distant
sed -i 's/bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/my.cnf && sudo service mysql restart
UPDATE mysql.user SET Host='%' WHERE Host='localhost' AND User='username';
FLUSH PRIVILEGES;
mysqldump -u root -p database > dump.sql
scp -P 22 root@host:dump.sql ./
pv sqlfile.sql | mysql -uxxx -pxxxx dbname
@FabienSalles
FabienSalles / gist:362c749ec2335dfd091d
Created August 19, 2015 12:21
Reset mysql root password
sudo -i
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root mysql
update user set password=PASSWORD("mdp") where User='root';
flush privileges;
exit;
killall mysqld
/etc/init.d/mysql start