Skip to content

Instantly share code, notes, and snippets.

View phpdave's full-sized avatar

UseTheForceDave phpdave

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDY7D60w303zFxMEkB/VZ17Vf8orxTEbmnCMIw1+LRRU+KW9D/z1ywuV/flFQnoGjKritXYy6o4CbXhn8NHwpEp7a3BxxT1lr1rzYyaP9pOmQTtoqm9PvpHD54hYS/3rzB8orN0+i6FtZ+8RdUuILijUedFlhwP1pCIVkQr6xXwGlN18mux6cFqM9FW4BNDXRV/nxbHy/1LMOvM2WtqFfIWVjlTmzkt3IV94og6tSyIlY5+8IpLzjOBDoGQDT8ZrVAZWsenPskE4XehoKTQM37e1VSmZDqKMfWoi9wrDX03krAmftr7/NYCIIpxMVVVXuMP7GJeQy7W9YWo35Fm+AdzXEh0z5hnes5tEqcRA++hsoaKFtoBOzaY9Yjap9dDmPNaz96RP/uCKxTqJFT+zOUaTMa1jwQk0CNO2LI2QAKgqOLxw3Yvj9W30WzVwAnDXEiegOvZrfODoLKc2jBsbkat0acnoBLwC6XCUBEgSx/K0ChiLpgV/YkJyXGa6kBJVBIC0VbK6Ms/mNDPNJFHuhpXpNV9II6MFIjp0a40nCd/Gqa/rAyPjBmsFUOlNYC5mnfNSbIqSxG4RKzp/Zf+WI2yLw9JSHb94UtKxyVOtdCT61Ah5kzceR80p+o37w1ak0kIMDOkzkavBWEHWMcBqqgBkSmGDSfumaAWqAZQIK8x+Q== your_email@example.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC0P3+bkvpMU5V1c+2LNDcGjNTTXsM3sY1SZQYRPRNCCWTMOC4ZZYFBri7Jbx+nGvz/h7NzWgfivdx1rPNcPragE0CipJNUJPCTjubWIeG1wH3j1fST/FEGa0DakcEgaur6YxW8xHpHwrbZD49a6nKlG6XIvvoREZNHzEDQ16D/F69HDXze7o3/a/vgVp5548gK34l5nnOtihB1Gw/BlxUNwrv2Dimovn2dHYzJGVtF/ial
@phpdave
phpdave / .functions.sh
Last active March 16, 2016 19:24
functions to add to your shell profile to easily manage file permissions. Can then do "git pull && http-permissions" to make sure your files have the write permissions. Thanks to Josh Hall for the idea to add the functions to shell
#Parameter ${1} is the directory you want to effect like /www/zendsvr/htdocs/ or /www/zendsvr/writeable/uploads
function http-permissions() {
system -i "CHGAUT OBJ('${1}') USER(NOGROUP) DTAAUT(*RX) OBJAUT(*NONE) SUBTREE(*ALL)"
system -i "CHGPGP OBJ('${1}') NEWPGP(NOGROUP) RVKOLDAUT(*NO) SUBTREE(*ALL)"
#Usage: on the command line
#http-permissions /www/zendsvr/htdocs/
#/www/zendsvr/htdocs/ will be given permissions recursively to the apache group
}
function http-write-permissions() {
@phpdave
phpdave / LearnAboutYourPHPCLI.sh
Last active March 11, 2016 15:52
Learn about your php cli setup
# learn what php-cli is doing
cat /usr/local/zendsvr/bin/php-cli
# learn what configuration values are set
cat /etc/zce.rc
# learn what extensions are enabled in php.ini
cat /usr/local/zendsvr/etc/php.ini | grep extension
# see extensions included
/usr/local/zendsvr/bin/php-cli -r "phpinfo();" | grep conf.d
# things you should probably create for setting up php-cli specific configuration
@phpdave
phpdave / MyShellScript.sh
Created March 10, 2016 20:19
./MyShellScript.sh
#!/QOpenSys/usr/bin/bash
echo “Your running MyShellScript”
#use shell utilities
if test -d mydir;
then
echo "true";
else
echo "false";
fi
CREATE OR REPLACE PROCEDURE modify_department_transaction (
-- Required parameters
IN p_trns_type SMALLINT,
IN p_deptno CHAR(3),
-- Optional parameters
IN p_when_Changed TIMESTAMP DEFAULT NULL,
IN p_deptname VARCHAR(36) DEFAULT NULL,
IN p_mgrno CHAR(6) DEFAULT '*NOCHG',
IN p_location CHAR(16) DEFAULT '*NOCHANGE',
@phpdave
phpdave / pseudoKillJobsGivenFile.sql
Last active May 10, 2018 22:24
Pseudo logic - Kill all jobs on a file in IBMi 7.2 to remove record locks
CREATE PROCEDURE MYLIB.KILLJOBSGIVENFILE ( )
LANGUAGE SQL
SPECIFIC MYLIB.KILLJOBSSP
BEGIN
--Variable to control loop
DECLARE END_TABLE INT DEFAULT 0;
--If there's no record update END_TABLE to 1 to end the loop
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET END_TABLE = 1;
<?php
$sql="SELECT
CAST(1 as smallint) as smallint,
CAST(2 as INTEGER) as INTEGER,
CAST(3 as BIGINT) as BIGINT,
CAST(4. as real) as real,
CAST(5.1 as FLOAT) as FLOAT,
CAST(6.1 as DOUBLE) as DOUBLE,
CAST(7.1 as DECIMAL) as DECIMAL,
CAST(8.1 as NUMERIC) as NUMERIC,
<?php
/*before this is all your code that is doing things to the browser and perhaps submitting some data via ajax*/
//Lets make the webdriver wait for the ajax call
$webdriverWait = new WebDriverWait($driver, 10);
$webdriverWait->until(
//pass in our closure
function($driver)
{
echo 'loop...';
try
@phpdave
phpdave / SetupSeleniumAndFirefoxAmazonEC2.sh
Last active April 18, 2017 12:41
Sample script to setup Selenium and FireFox on an AmazonEC2 instance and then run the PHP Webdriver made by facebook. If you don't have php installed you'll want to run the setup script in here https://godzillai5.wordpress.com/2016/02/02/run-php7-on-aws-ec2-cloud/
#Setup FireFox on Amazon Linux
curl -X GET -o RPM-GPG-KEY-lambda-epll https://lambda-linux.io/RPM-GPG-KEY-lambda-epll
sudo rpm --import RPM-GPG-KEY-lambda-epll
curl -X GET -o epll-release-2015.09-1.1.ll1.noarch.rpm https://lambda-linux.io/epll-release-2015.09-1.1.ll1.noarch.rpm
sudo yum -y install epll-release-2015.09-1.1.ll1.noarch.rpm
sudo yum --enablerepo=epll install firefox-compat
wget -O firefox-latest.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
bzcat firefox-latest.tar.bz2 | tar xvf -
#setup Xvfb - X virtual framebuffer is a display server implementing the X11 display server protocol
find /var/www/html/www.example.com/ -name "*.php" -print | xargs sed -i 's/dev.example.com/www.example.com/g'