Skip to content

Instantly share code, notes, and snippets.

Tristan Bessoussa tristanbes

Block or report user

Report or block tristanbes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tristanbes
tristanbes / snapshot.sh
Created Aug 29, 2017 — forked from danharper83/snapshot.sh
Creates a snapshot on platform using platform commands
View snapshot.sh
#!/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
View build_pr.sh
#!/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 Apr 13, 2015
Pull Request Builder: PHP Script which triggers Ansible Tower
View github_hook.php
$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));
View gist:8580f379c1ec4ef42894
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)
View spotify_battery_drain.bash
# 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"
View GuzzleExceptionListener.php
<?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;
View GuzzleExceptionListener.php
<?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;
View app.php
// ...
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
View Plugin.php
<?php
/**
* This class handles MoxieManager SymfonyAuthenticator (Symfony < 2.x).
*
* @author Tristan Bessoussa <tristan.bessoussa@gmail.com>
*/
class MOXMAN_SymfonyAuthenticator_Plugin implements MOXMAN_Auth_IAuthenticator
{
public function authenticate(MOXMAN_Auth_User $user)
View security.yml
main:
remember_me:
key: "%secret%"
lifetime: 31536000
path: /
domain: .my-domain.com # Defaults to the current domain from $_SERVER
You can’t perform that action at this time.