Skip to content

Instantly share code, notes, and snippets.

View jflefebvre's full-sized avatar
🏠
Working from home

jean-françois lefebvre jflefebvre

🏠
Working from home
View GitHub Profile
@jflefebvre
jflefebvre / symfony-components-after-installed
Created April 7, 2019 09:30
symfony components installed after symfony
composer require --dev symfony/dotenv
composer require --dev symfony/profiler-pack
composer require symfony/maker-bundle --dev
composer require symfony/orm-pack
composer require symfony/security-bundle
composer require symfony/translation
composer require annotations
composer require twig/twig
composer require google/recaptcha
$app['twig'] = $app->extend("twig", function (\Twig_Environment $twig, Silex\Application $app) {
$twig->addExtension(new MyApp\Helpers\TwigTimer($app));
return $twig;
});
@jflefebvre
jflefebvre / TwigTimer.php
Created April 9, 2015 20:11
Twig Filter to measure execution time
<?php
namespace MyApp\Helpers;
class TwigTimer extends \Twig_Extension {
protected $total_time = array();
protected $previous_time = array();
/**
Verifying that +jflefebvre is my openname (Bitcoin username). https://onename.io/jflefebvre
@jflefebvre
jflefebvre / gitlog.py
Created August 15, 2014 21:31
Scan all folders and extract git log if folder contains a git project and save the log file in gitlogs (put the scripts in your www containing all your projects folders)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fnmatch
import string
import os, sys, time
import subprocess
def isUnderGit():
curPath = os.getcwd()
@jflefebvre
jflefebvre / e.py
Created January 5, 2014 14:22
Allows - to build an sqlite database storing name/path and creation date of your ebooks (-b parameter) - easily find ebook (-f searchstring parameter)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import string
import fnmatch
import os
import sys
import time
@jflefebvre
jflefebvre / filter.php
Last active December 16, 2015 00:29
Filter php source file and removes comments, white spaces, crlf ...Used to pack my reverse script file.-- still some minor fixes to do in the future but the main idea is implemented :)
#!/usr/bin/env php
<?php
/**
* Take a source file and strip all comments, spaces, crlf
*
* Author: Jean-François Lefebvre
* E-mail: lefebvre.jf@gmail.com
*
*/
@jflefebvre
jflefebvre / twitterify.php
Last active December 15, 2015 15:19
Allows to detect mentions, hashtags and links in a tweet and create links.
<?php
function twitterify($str) {
$str = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $str);
$str = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $str);
$str = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $str);
$str = preg_replace("/#(\w+)/", "<a href=\"http://twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $str);
return $str;
}
@jflefebvre
jflefebvre / reverse
Last active December 15, 2015 15:19
Allows to automate the use of apktool and dex2jar to reverse engineer an apk file.
#!/usr/bin/env php
<?php
/**
* Allows to automate the use of apktool and dex2jar to reverse engineer an apk file.
*
* Usage:
*
* reverse <file-apk>
* or