Skip to content

Instantly share code, notes, and snippets.

View fhuitelec's full-sized avatar

Fabien Huitelec fhuitelec

View GitHub Profile
@fhuitelec
fhuitelec / badass-makefile
Last active February 5, 2017 16:16
Powerful Makefile template
# Badass Makefile
Badass makefile template ready to use.
@fhuitelec
fhuitelec / medium-replay_jenkins_build_locally-infernal_route.sh
Last active October 2, 2017 16:39
Medium article on "Replay a Jenkins build pipeline locally" - Infernal routine #medium
# Just edited Jenkinsfile dealing with some deploy when merging on master
git add Jenkinsfile lib/jenkins/Servers.groovy # git add
git commit -m "WIP build pipeline" # git commit
git push origin master --force # previously rebased 50 "WIP build pipeline" in git history
# push force on master, yolo
# Wait for the build to be triggered
# ⌘ + Tab
# 3 clicks on Jenkins to get the build output
@fhuitelec
fhuitelec / medium-replay_jenkins_build_locally-download_jenkins_cli.sh
Last active October 2, 2017 16:38
Medium article on "Replay a Jenkins build pipeline locally" - Download Jenkins CLI executable #medium
docker exec -i jenkins_jenkins_1 bash -c ' \
cd /application/vendor/jenkins && \
wget http://localhost:8080/jnlpJars/jenkins-cli.jar \
'
@fhuitelec
fhuitelec / medium-replay_jenkins_build_locally-usually.sh
Last active October 2, 2017 16:38
Medium article on "Replay a Jenkins build pipeline locally" - Usually, it would be... #medium
git add .
git commit -m "WIP build pipeline"
git push origin master
# Wait the build to be triggered
# ⌘ + Tab
# Wait for the build to end
@fhuitelec
fhuitelec / medium-replay_jenkins_build_locally-jenkins_cli_usage.sh
Last active January 15, 2018 10:33
Medium article on "Replay a Jenkins build pipeline locally" - Infernal routine #medium
docker exec -i jenkins_jenkins_1 bash -c ' \
java -jar /application/vendor/jenkins/jenkins-cli.jar -s http://localhost:8080 \
replay-pipeline cd/master \
-s Jenkinsfile < /application/demo/repo/Jenkinsfile \
-s demo.Servers < /application/demo/lib/src/demo/Servers.groovy \
'
@fhuitelec
fhuitelec / medium-replay_jenkins_build_locally-make_recipe_description.sh
Last active October 2, 2017 16:37
Medium article on "Replay a Jenkins build pipeline locally" - Make recipe description #medium
# Use your docker instance to run the commands below
docker exec -i jenkins_jenkins_1 bash -c
# Run locally (in the container, Jenkins runs on 8080) Jenkins CLI
# on your running instance
java -jar /application/vendor/jenkins/jenkins-cli.jar -s http://localhost:8080
# Run the command `replay-pipeline` on the cd item and master branch
replay-pipeline cd/master
@fhuitelec
fhuitelec / Jenkinsfile
Last active October 2, 2017 16:38
Running a stateful Jenkins #evaneos #poc
// Copy/paste it in the build pipeline you'll be creating
// Pipeline syntax: https://jenkins.io/doc/book/pipeline/syntax/
// Docker pipeline plugin docs: https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/index.html#docker-workflow
pipeline {
agent { docker 'php:7.1-alpine' }
stages {
stage('Build PHP 7.1') {
@fhuitelec
fhuitelec / collection-counter-example.php
Last active October 2, 2017 16:37
madewithlove - Avoiding conditional blog post - Comment #comment
<?php
/*
* Comment available here: http://disq.us/p/1lek1yc
*
* Notification collection consumer point of view.
*/
$notifications = Notifications::make()
->add($this->buildParentCreatorNotification($comment))
@fhuitelec
fhuitelec / arguments-management.sh
Created October 2, 2017 16:41
[Bash cheatcheet] Some useful snippets to get some badass bash #cheatsheet
#!/bin/bash
# TODO
@fhuitelec
fhuitelec / 0010.DoctrineRepository.php
Last active October 12, 2017 13:57
[Query builder Doctrine] For lazy entity/relationship mapping #symfony #doctrine
<?php
namespace Super\Duper\Namespace;
use Bread\Namespace;
use Corn\Namespace;
use Entity\Namespace;
class DoctrineRepository extends EntityRepository