Skip to content

Instantly share code, notes, and snippets.

@santanuchakrabarti
santanuchakrabarti / RE_to_Grammar_Algorithm.md
Last active December 5, 2021 21:12
An algorithm to generate a Regular Grammar from a Regular Expression
@nlehuen
nlehuen / prepare_php_session_folder.php
Created May 11, 2012 21:31
This script prepares the PHP session.save_path directory for spreading session files on multiple levels. It is a replacement for the infamous mod_files.sh script.
#!/usr/bin/php
<?php
// See http://www.php.net/manual/en/session.configuration.php#ini.session.save-path
function prepare_dir($base, $hash_chars, $depth, $number) {
if($depth<0) return $number;
if(!file_exists($base)) {
mkdir($base, 0777);
echo "$base\n";
@lavoiesl
lavoiesl / apache-template
Created May 7, 2012 19:24
Apache VirtualHost Template with variable replacement
<VirtualHost *:80>
ServerAdmin {USER}@cslavoie.com
ServerName {DOMAIN}
ServerAlias www.{DOMAIN}
ServerAlias {USER}.localhost
ServerAlias {USER}.static.cslavoie.com
DocumentRoot {DOC_ROOT}
<Directory {DOC_ROOT}>