This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### ——————————————————————– ### | |
# This script creates a text file that contains all the current permissions | |
# of the entire linux system. | |
# Run: sudo bash get_all_permissions.sh | |
# Location: http://virtualparadise.wordpress.com/2010/04/29/linux-repair-permissions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<style> | |
* { | |
color: white; | |
} | |
p { | |
color: green; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Auto detect line endings | |
ini_set('auto_detect_line_endings', true); | |
function loadCSV($file) | |
{ | |
// Create an array to hold the data | |
$arrData = array(); | |
// Create a variable to hold the header information | |
$header = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove Apache variations on URL, best for SEO | |
Options -MultiViews | |
<IfModule mod_dir.c> | |
# Ensure index.php is only allowed as index | |
DirectoryIndex index.php | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_speling.c> | |
CheckSpelling On | |
CheckCaseOnly On | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
# Ensure index.php is only allowed as index | |
index index.php; | |
server { | |
listen 80; | |
server_name localhost; | |
root /var/www; | |
# Manage the slashes via rewrites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /test/ | |
# Strip main index.php and query string | |
RewriteCond %{THE_REQUEST} ^GET./+test/+index\.php\? | |
RewriteRule . /test/? [R=301,NE,L] | |
# Strip multiple slashes and query string | |
RewriteCond %{THE_REQUEST} (.*)//(.*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location @testrewrites { | |
# Send all requests to index.php | |
rewrite ^ /test/index.php last; | |
} | |
# Else use this location block | |
location ~* ^/test/.*\.php$ { | |
# Strip subdir index.php and query string | |
if ( $request_uri ~* ^/(.*)/index\.php\?+) { | |
rewrite (?i)^/(.*)/index\.php /$1/? permanent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getMiddle($first, $end, $contents, $file) | |
{ | |
$arrBegin = explode($first, $contents); | |
if (count($arrBegin) != 2) | |
{ | |
echo 'Bad Begin: '.$file; | |
die(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get the OS from the HTTP_USER_AGENT string | |
* | |
* * @link http://stackoverflow.com/questions/18070154/get-operating-system-info-with-php | |
* | |
* @return string | |
*/ | |
function getOS() | |
{ | |
$user_agent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'NA'); |
OlderNewer