Skip to content

Instantly share code, notes, and snippets.

View ragusa87's full-sized avatar

Laurent Constantin ragusa87

View GitHub Profile
<?php
$this->get('ns.twig_mailer')->send(
'NSWebBundle:Mail:forgottenPassword.mail.twig',
$user->getEmail(),
array('user' => $user, 'token' => $token)
);
#!/bin/bash
# Backup Mysql database staring with "__apps", compress the dump.
# Olds backup are removed if they are older than X days
# LCO 2016-06-05
# Script based on http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
MUSER="root"
MPASS="PASSWORD-GOES-HERE"
MHOST="localhost"
MYSQL="$(which mysql)"
@ragusa87
ragusa87 / StrokeFilter.php
Created September 12, 2016 08:47
LiipImagine Stroke filter
<?php
namespace Generalmedia\AppBundle\Filter;
use Imagine\Image\ImageInterface;
use Imagine\Image\ImagineInterface;
use Imagine\Image\Palette\RGB;
use Imagine\Image\Point;
use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface;
@ragusa87
ragusa87 / index.php
Created May 6, 2017 11:19
Data transform "page_history" column of a CSV file
<?php
/**
* @author Laurent Constantin
* Alter the 'page_history' column of a CSV file with emotions.
* A map between page number and emotion's name is required in a csv format.
*/
class WhatDoYouDo4Love
{
/**
@ragusa87
ragusa87 / !Wrench
Last active July 27, 2018 13:52
Wrench passbolt tool
Wrench
@ragusa87
ragusa87 / pdfrotate.sh
Created July 29, 2015 07:50
Rotate pdf left with pdftk
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 filename"
exit 1;
fi
if [ ! -f $1 ]; then
echo "File not found!"
exit 2
fi
@ragusa87
ragusa87 / code-css.txt
Last active February 26, 2019 12:08
Highlight the source code of a directory and embed all files into a single PDF. Usefull to print a lab. This file needs other software like: htmldoc,source-highlight,pdftk, iconv. (installed via macport) ## See Readme.md ##
bgcolor "white"; // the background color for documents
context gray; // the color for context lines (when specified with line ranges)
keyword blue b ; // for language keywords
type darkgreen i, b ; // for basic types
usertype teal ; // for user defined types
string red f ; // for strings and chars
regexp orange f ; // for strings and chars
specialchar pink f ; // for special chars, e.g., \n, \t, \\
comment brown i, noref; // for comments
@ragusa87
ragusa87 / a2dp.py
Created March 28, 2019 14:59 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.6
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
@ragusa87
ragusa87 / moodleclone.sh
Last active April 4, 2019 07:57
Liip clone moodle repo (private)
#!/bin/bash
set -xe
MOODLE_REPO=git@gitlab.liip.ch:elearning/moodle.git
MOODLE_CACHE=~/gitcaches/moodle.reference
MOODLE_ALTERNATE_REPO=git@gitlab.liip.ch:elearning/moodle-testmigration.git
MOODLE_ALTERNATE_REPO_NAME=test
if [[ $# -eq 0 ]]; then
echo "Entrez le nom de la branche client: [mdl31-tcs]: "
read branch
else
### Keybase proof
I hereby claim:
* I am ragusa87 on github.
* I am ragusa87 (https://keybase.io/ragusa87) on keybase.
* I have a public key ASAbz7DA36ZJeEWBRGlwuGKPvYseNlSa9B4nMZIaQLGkDQo
To claim this, I am signing this object: