Skip to content

Instantly share code, notes, and snippets.

View B-Galati's full-sized avatar
😁

Benoit GALATI B-Galati

😁
View GitHub Profile
@B-Galati
B-Galati / tmux.sh
Last active September 8, 2022 13:00
tmux script example
#!/bin/bash
tmux has-session -t dev
if [ $? != 0 ]
then
tmux new-session -s dev -n "TEST" -d
tmux split-window -h -t dev:0
tmux split-window -v -t dev:0.1
tmux send-keys -t dev:0.0 'cd ~/foo/bar' C-m
tmux send-keys -t dev:0.1 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "cd ~/bar;bash"' C-m
@B-Galati
B-Galati / pre-commit
Last active April 12, 2022 17:05
git pre-commit hook for php
#!/bin/bash
# Inspiration http://wadmiraal.net/lore/2014/07/14/how-git-hooks-made-me-a-better-and-more-lovable-developer/
# http://nrocco.github.io/2012/04/19/git-pre-commit-hook-for-PHP.html
EXITCODE=0
# Check for php syntax error
FILES=$(git diff --cached --name-only)
for FILE in $FILES ; do
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
@B-Galati
B-Galati / Dockerfile
Last active February 24, 2022 22:30
Dockerfile oracle oci8
FROM php:5.4-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu-dev \
libmysqlclient18 \
libc6 \
@B-Galati
B-Galati / Makefile
Last active December 17, 2020 15:32
Example of Makefile for php script
.PHONY: help clean build vendor node_modules test php-cs-fixer
SYMFONY_ENV ?= dev
SYMFONY_CONSOLE_ARGS ?= --env=dev
SYMFONY_ASSETS_INSTALL ?= relative
COMPOSER_ARGS ?=
PHP=php
ifneq ($(SYMFONY_ENV), dev)
COMPOSER_ARG = --optimize-autoloader --no-dev --no-suggest --no-interaction --classmap-authoritative
@B-Galati
B-Galati / 0-vagrant-rsync-auto.sh
Last active December 15, 2020 08:54
Run vagrant rsync-auto as a daemon
#!/usr/bin/env bash
set -euo pipefail
ROOT_PATH=$(set -e && cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "${ROOT_PATH}"
# Taken from Symfony installer
function output
{
@B-Galati
B-Galati / mkcert-install.sh
Last active December 4, 2020 19:35
A script to automatically install mkcert locally if not installed globally
#!/usr/bin/env bash
#
# A lot of inspiration comes directly from symfony cli installer
set -euo pipefail
ROOT_PATH=$(
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd
@B-Galati
B-Galati / keybase.md
Created June 16, 2019 08:07
keybase.md

Keybase proof

I hereby claim:

  • I am B-Galati on github.
  • I am bgalati (https://keybase.io/bgalati) on keybase.
  • I have a public key whose fingerprint is B675 6E4A F33E 081D AB03 719C D8F2 5183 44D9 921B

To claim this, I am signing this object:

@B-Galati
B-Galati / phpstorm64.vmoptions
Last active December 4, 2018 15:05
phpstorm jvm options
# custom PhpStorm VM options
# https://stitcher.io/blog/phpstorm-performance
-Xms500m
-Xmx1500m
-XX:ReservedCodeCacheSize=512m
-XX:+UseConcMarkSweepGC
-XX:+UseCompressedOops
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
@B-Galati
B-Galati / Makefile
Last active October 15, 2018 12:46
Rebuild docker images only when they are modified
DOCKER_COMPOSE?=docker-compose
DOCKER_FILES=$(shell find ./docker/dev/ -type f -name '*')
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
<?php
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Symfony2Extension\Context\KernelDictionary;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;