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 | |
$glob = glob('zblog/application/views/scripts/*'); | |
//var_dump($glob); | |
foreach ($glob as $g) { | |
if (!is_readable($g)) { | |
continue; | |
} | |
echo '<h1>' . $g . '</h1> | |
<table> |
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
<h1>Scratch</h1> | |
<pre> | |
<?php | |
date_default_timezone_set('UTC'); | |
$official_pattern='/^[\w\.]+\.[a-zA-Z]{2,4}$/'; | |
$official_pattern_2='/^[\w\.]+\.[a-zA-Z]{2,4}(?:|\/.{3,20})$/'; | |
$pattern = "%"; | |
//match a www or other subdomain followed by a dot if its there, | |
//not required though, from very start of subject | |
$pattern.="\A([\w]+\.){0,1}"; |
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 | |
//setcookie('username', 'joseph'); | |
//echo $_COOKIE['username']; | |
//Check if they have the cookie value for username | |
if(!empty($_COOKIE['username1'])){ | |
//If they do display it | |
echo $_COOKIE['username1']; | |
}else{ | |
// If they do not, display a form that will post the username |
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 | |
//First Off - Start the Session | |
session_start(); | |
//Now Test if the Session contains a Student ID | |
if(array_key_exists('student_id', $_SESSION)){ | |
//If it does, query the demo.students table for the details of that student |
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
function getCurrentMysqlConfigForVariable(){ | |
local variable=$1 | |
mysql -e "select variable_value from information_schema.global_variables where variable_name like '$variable'" | | |
while read variable_value; | |
do | |
if [[ 'variable_value' == "$variable_value" ]] | |
then | |
# skip the header | |
continue | |
fi |
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 | |
find . -type d -ipath '*app/etc/modules' | \ | |
while read f; | |
do | |
echo $f; | |
ls -l "${f}" | \ | |
grep 'EM_Quickshop.xml\|EM_Ajaxcart.xml\|Smartwave_QuickView.xml\|MD_Quick'; | |
done | grep -B 1 'xml' |
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
# /etc/nginx/conf.d/domain.com.conf | |
location /jira { | |
if ($scheme = 'http') { | |
rewrite ^ https://$http_host$request_uri? permanent; | |
} | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
client_max_body_size 10M; |
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 | |
/** | |
* @category EdmondsCommerce | |
* @package EdmondsCommerce_ | |
* @author Ross Mitchell <ross@edmondscommerce.co.uk> | |
*/ | |
namespace EdmondsCommerce\ServerHardening; | |
use Symfony\Component\Yaml\Yaml; |
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
#!/usr/bin/env bash | |
PID=$(pgrep -n gnome-session) | |
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) | |
GSETTINGS_BACKEND=dconf | |
gsettings set org.gnome.desktop.background picture-uri '"file://'$(ls ~/Pictures/Wallpapers/*.jpg | shuf -n 1)'"' | |
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
# This will take a CSV file as input, | |
# pull out the header row, | |
# split that onto new lines | |
# and then prepend a zero indexed line number to each line | |
head ./filename.csv -n 1 | sed "s/,/\n/g" | awk '{printf("%d %s\n", NR-1, $0)}' | |
OlderNewer