Skip to content

Instantly share code, notes, and snippets.

@gsouf
gsouf / getcomposer.bash
Last active December 23, 2015 06:39
Installer composer en tant qu'executable
#!/bin/bash
BIN_DIRECTORY=$1
USER=$2
usage ()
{
echo "Usage : $0 bin_directory owner"
}
if [[ $EUID -ne 0 ]]; then
@gsouf
gsouf / PHPUnitTestDb.php
Created August 6, 2013 21:31
PHPUnit / DBUnit / Fixture : fixing Foreign key contraints
<?php
namespace Test;
abstract class PHPUnitTestDb extends \PHPUnit_Extensions_Database_TestCase
{
// one instance per whole test
static private $pdo = null;
@gsouf
gsouf / colors.sh
Created July 15, 2013 22:12
Bash color
#!/bin/bash
# prints a color table of 8bg * 8fg * 2 states (regular/bold)
echo
echo Table for 16-color terminal escape sequences.
echo Replace ESC with \\ 033 in bash.
echo
echo "Background | Foreground colors"
echo "---------------------------------------------------------------------"
for((bg=40;bg<=47;bg++)); do
@gsouf
gsouf / browse.php
Created July 7, 2013 09:48
Script that allows to check unix file system's security issues
<?php
echo "<pre>\n";
if (ini_get('safe_mode')) {
echo "[safe_mode enabled]\n\n";
} else {
echo "[safe_mode disabled]\n\n";
}
@gsouf
gsouf / scp-rsync-ssh.sh
Last active December 19, 2015 08:59
rsyn over ssh and scp
# COPY DIRECTORY /source/dir FROM myhost to /destination/dir on the localhost WITH THE SSH SHELL
rsync -avz -e "ssh" user@myhost:/source/dir /destination/dir
### OPTIONS
# -a for archive mode (recursive, copys symlink, copys permissions, copys update times, preserves owner)
# -v for verbose (writes what it does)
# -z for compress while transfering
# SAME BUT WE EXCLUDE SOME FILES/DIR
rsync -avz -e "ssh" \
@gsouf
gsouf / clean_session.sh
Created May 24, 2013 13:31
Php clean session + Shell
cd /path/to/sessions; find -cmin +24 | xargs rm
# to try :
# find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm
@gsouf
gsouf / myApp.MultiSortToolbar.js
Created May 22, 2013 06:43
ExtJs MultiSortToolbar (for architect)
// this is a multisortToolbr which should override a basical toolbar. It can be added as toolbar for a grid. Then you can drop columns from the column model of the grid and it will sort grid as following example : http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#multi-sort-grid.
// It is almost an adapted version of the code used in the example.
Ext.define('myApp.view.override.MultiSortToolbar', {
override: 'myApp.view.MultiSortToolbar',
requires: [
@gsouf
gsouf / query.sql
Last active December 16, 2015 11:29
List MySQL Columns
SELECT
Table_Catalog
,Table_Schema
,Table_Name
,Column_Name
,Column_Type
FROM INFORMATION_SCHEMA.COLUMNS
WHERE Table_Schema = "nom de la base à lister"
@gsouf
gsouf / aide
Last active December 16, 2015 10:28
Linux Memo
FILESYSTEM INFORMATIONS
-----------------------
http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/usr.html
COMMANDES UTILES
----------------
du -hs /home Donne la taille du contenu de /home
df -k Affic les taux d'occupation des systèmes de fichiers
cp /home/fichier.html{,.bak} equivalent de cp /home/fichier.html /home/fichier.html.bak
mount.cifs //serveur/partage /mnt/montage -o username=throud,password=pass Montage d'un partage samba
@gsouf
gsouf / install.sh
Last active March 11, 2016 00:01
New Linux installation (Debian)
# For chromixium 1.5
# sh ./install.sh
# rm ./install.sh
sudo apt-get update -y
sudo apt-get upgrade -y
mkdir $HOME/bin