Skip to content

Instantly share code, notes, and snippets.

View ragusa87's full-sized avatar

Laurent Constantin ragusa87

View GitHub Profile
#!/bin/bash
#
# Create environement for development.
# docker script is inspired by https://github.com/jessfraz/dockerfiles
#
#
# 1 = docker name
@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 / 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;
#!/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 / 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 / android-authenticator2-extract-qrcode.sh
Created May 27, 2015 21:36
Extract data from android backup of Google Authenticator 2 to qrcodes
#!/bin/bash
# Extract data from nandroid backup of Google Authenticator 2
# > /data/data/com.google.android.apps.authenticator2/databases/databases
# require: sqlite3 + qrencode
sqlite3 databases <<!
.headers off
.mode csv
.output codes.csv
select printf("otpauth://totp/%s?secret=%s&issuer=%s",email,secret,issuer) from accounts;
@ragusa87
ragusa87 / BROTHER-MFC-J4510DW.md
Last active September 21, 2021 11:56
Install BROTHER MFC-J4510DW on Linux Ubuntu 14.10

NOTE

This memo helps you to install the Multifunction printer BROTHER MFC-J4510DW using a network connection. Local printing though USB is not the goal of this memo.

You can download drivers from the Brother support page for your printer

Installation

You have 2 methods, you can run a script or do it yourself. Prefer the second option as the script is outdated

<?php
$this->get('ns.twig_mailer')->send(
'NSWebBundle:Mail:forgottenPassword.mail.twig',
$user->getEmail(),
array('user' => $user, 'token' => $token)
);
@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 / bluetooth-a2dp
Last active January 30, 2020 19:08
Enable bluetooth A2DP on Raspberry-PI via pulseaudio. To install, edit /etc/udev/rules.d/99-input.rules and add the line: SUBSYSTEM=="bluetooth", RUN+="/usr/lib/udev/bluetooth" Then save this script as /usr/lib/udev/bluetooth and set it executable. Bluetooth devices must be linked first.
#!/bin/bash
# This script is called by udev when you link a bluetooth device with your computer
# It's called to add or remove the device from pulseaudio
#
#
# Output to this file
LOGFILE="/var/log/bluetooth_dev"
# Name of the local sink in this computer