Skip to content

Instantly share code, notes, and snippets.

View smalot's full-sized avatar

Sebastien MALOT smalot

View GitHub Profile
@smalot
smalot / PdfParser.php
Last active February 13, 2022 09:59
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
<?php
/**
* Author : Zikko
* Source : http://www.zikko.se/resources/extractFromPDF.php
*
* Usage :
*
* $path = 'my_pdf_file.pdf';
* $pdf = new pdf( $path );
@smalot
smalot / .vimrc
Created August 8, 2013 11:24
VIM setup file. Put it directly in your home
set ts=4
set sw=4
set softtabstop=4
set expandtab
syn on
set syn=php
set autoindent
set smartindent
set showmatch
set ruler
@smalot
smalot / mountall.sh
Created September 25, 2013 09:31
Script found on dedibox rescue mode to amount all DD. Could be useful
#!/bin/sh
if [ $( whoami ) != "root" ]; then
echo "Ce script doit être exécuter en tant que root."
exit 1
fi
is_inlist () {
OIFS=$IFS
IFS=:
@smalot
smalot / vim.txt
Created September 26, 2013 07:50
"VIM" tips and tricks
// Force EOL to unix : "\n"
:set fileformat=unix
@smalot
smalot / systemstats.sh
Last active July 24, 2020 03:58
Script allowing stats on ssh login.
#!/bin/bash
#
# Server Status Script
# --------------------
#
# Install
# -------
#
# need dependencies :
# - bc
@smalot
smalot / py2php.py
Created November 12, 2013 09:37 — forked from reusee/py2php.py
import ast
from cStringIO import StringIO
import sys
INFSTR = '1e308'
def interleave(inter, f, seq):
seq = iter(seq)
try:
f(next(seq))
@smalot
smalot / remove_accent.php
Created November 18, 2013 14:54
PHP function which removes accent
/**
* Found on http://www.weirdog.com/blog/php/supprimer-les-accents-des-caracteres-accentues.html
*/
function wd_remove_accents($str, $charset='utf-8') {
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. '&oelig;'
$str = preg_replace('#&[^;]+;#', '', $str); // supprime les autres caractères
#!/bin/sh
apt-get install apache2-prefork-dev
apt-get install libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libdb4.8-dev libjpeg62-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libt1-dev libgd2-xpm-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev
wget ""
tar zxvf ""
cd ""
./configure \
--prefix=/usr/share/php53 \
--datadir=/usr/share/php53 \
--mandir=/usr/share/man \
--bindir=/usr/bin/php53 \
--with-libdir=lib64 \
--includedir=/usr/include \
--sysconfdir=/etc/php53/apache2 \
--with-config-file-path=/etc/php53/cli \
--with-config-file-scan-dir=/etc/php53/conf.d \