Skip to content

Instantly share code, notes, and snippets.

View JulienBreux's full-sized avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / gist:5480728
Last active December 16, 2015 18:49
This little script will protect access to dirs. Use like this: /home/<user>/www/fichiers/admin/index.php /home/<user>/www/fichiers/<first-directory>/ /home/<user>/www/fichiers/<second-directory>/
<?php
/////// FUNCTIONS
function removeHtaccess($path, $filename = '.htaccess')
{
file_exists($path.DIRECTORY_SEPARATOR.$filename) && unlink($path.DIRECTORY_SEPARATOR.$filename);
}
function removeHtpasswd($path, $filename = '.htpasswd')
{
file_exists($path.DIRECTORY_SEPARATOR.$filename) && unlink($path.DIRECTORY_SEPARATOR.$filename);
@JulienBreux
JulienBreux / smalte-migration_03-26-2013.sh
Created March 26, 2013 17:07 — forked from Asenar/gist:5246483
smalte-migration_03-26-2013.sh
mkdir ~/tmp_working_dir
cd ~/tmp_working_dir
git init full_smalte
cd full_smalte
all_subs="installer framework module.sample tests theme.backoffice.default theme.frontoffice.default"
# part 1 : import all
# Six branch doomed to die
## Configure
./configure \
--enable-cli \
--prefix=/opt/php53 \
--with-readline \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pdo-sqlite \
--with-gd \
@JulienBreux
JulienBreux / gist:4510862
Created January 11, 2013 14:00
TRUNCATE / DROP tables DATABASE
TRUNCATE
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "truncate table $table" DATABASE_NAME; done
DROP
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "drop table $table" DATABASE_NAME; done
## Configure
./configure \
--enable-cli \
--prefix=/opt/php54 \
--with-readline \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pdo-sqlite \
--with-gd \
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test page for launching the application via JNLP</title>
</head>
<body>
<h3>Test page for launching the application via JNLP</h3>
<script src="http://java.com/js/deployJava.js"></script>
<script>
deployJava.createWebStartLaunchButton("launch.jnlp")
@JulienBreux
JulienBreux / gist:3833470
Created October 4, 2012 13:18
Opera Shortcut
"C:\Program Files (x86)\Opera\opera.exe" -kioskmode -kioskresetstation -nocontextmenu -nodownload -nocontextmenu -nokeys -nomail -nomaillinks -nomenu -nosave -resetonexit
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEC0w
LjAxNTkyNDQwNTMxIDAuMTI2NTIwOTE2OCAwLjE1OTY5NjAxMjcgMC45NgAQAYAC0hAR
EhNaJGNsYXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXll
@JulienBreux
JulienBreux / compile.sh
Created August 18, 2012 11:41
Compilation: NGINX 1.2.3
./configure
--prefix=/usr/local/nginx
--user=www-data --group=www-data
--without-mail_pop3_module
--without-mail_imap_module
--without-mail_smtp_module
--with-http_stub_status_module
--with-http_ssl_module
--http-log-path=/var/log/nginx/access.log
--conf-path=/etc/nginx/nginx.conf
<?php
function secure(&$value, $key)
{
if ((bool)preg_match('/^[0-9]+$/', $value))
$value = (int)$value;
elseif ((bool)preg_match('/^[0-9]+\.[0-9]+$/', $value))
$value = (float)$value;
else
$value = mysql_real_escape_string($value);
}