Skip to content

Instantly share code, notes, and snippets.

View tristanbes's full-sized avatar

Tristan Bessoussa tristanbes

View GitHub Profile
/// 1ST proposal
wamiz.user_registration {
email: ...
firstName: ...
}
consoanimo.user_registration {
email: ...
@tristanbes
tristanbes / snapshot.sh
Created August 29, 2017 10:04 — forked from danharper83/snapshot.sh
Creates a snapshot on platform using platform commands
#!/usr/bin/env bash
ORIGIN="develop"
TARGET="master"
if [ "$PLATFORM_BRANCH" = "$ORIGIN" ]; then
/app/.platformsh/bin/platform self-update -y -q
/app/.platformsh/bin/platform backup -y -q -p $PLATFORM_PROJECT -e $TARGET
fi
#!/bin/bash
YPROX_PR=$1
DB_RESET=$2
echo "Building "$YPROX_PR
# build the new PR
cd /var/www/gh_hook/scripts
@tristanbes
tristanbes / github_hook.php
Created April 13, 2015 10:25
Pull Request Builder: PHP Script which triggers Ansible Tower
$payload = $_POST['payload'];
$json = json_decode($payload);
if (isset($json->action)) {
$action = $json->action;
$prNumber = $json->pull_request->number;
switch ($action) {
case 'opened':
exec_script('scripts/build_pr.sh', array($prNumber, true));
failed: [5.135.xx.xx] => (item=ldap) => {"changed": true, "cmd": ["java", "-jar", "/opt/jenkins/jenkins-cli.jar", "-s", "http://localhost:8081", "install-plugin", "ldap"], "delta": "0:00:00.095061", "end": "2014-08-10 12:18:26.911847", "item": "ldap", "rc": 1, "start": "2014-08-10 12:18:26.816786"}
stderr: Exception in thread "main" java.io.IOException: Failed to connect to http://localhost:8081/
at hudson.cli.CLI.getCliTcpPort(CLI.java:266)
at hudson.cli.CLI.<init>(CLI.java:126)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
at hudson.cli.CLI._main(CLI.java:459)
at hudson.cli.CLI.main(CLI.java:382)
Suppressed: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
# If you open your Ressource monitoring under OSX, you'll see that the
# Process "Spotify Helper" is eating between 20% and 30% of CPU constantly
# It means that when you're on battery, it'll drain it faster.
# To prevent the Spotify Helper (which are basically ads for spotify) from spawning process,
# you should disable access to the app doing this (close Spotify first) :
sudo chmod 000 "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
sudo chmod -N "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
<?php
namespace Tristanbes\ElophantBundle\EventListener;
use Guzzle\Http\Exception\BadResponseException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Tristanbes\ElophantBundle\Manager\StatsManager;
<?php
namespace Tristanbes\ElophantBundle\EventListener;
use Guzzle\Http\Exception\BadResponseException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Tristanbes\ElophantBundle\Manager\StatsManager;
// ...
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
<?php
/**
* This class handles MoxieManager SymfonyAuthenticator (Symfony < 2.x).
*
* @author Tristan Bessoussa <[email protected]>
*/
class MOXMAN_SymfonyAuthenticator_Plugin implements MOXMAN_Auth_IAuthenticator
{
public function authenticate(MOXMAN_Auth_User $user)