Skip to content

Instantly share code, notes, and snippets.

View phpdave's full-sized avatar

UseTheForceDave phpdave

View GitHub Profile
CREATE FUNCTION MYLIB.DOES_TABLE_EXIST (
P_SCHEMA VARCHAR(10),
P_TABLE VARCHAR(256) )
RETURNS SMALLINT
LANGUAGE SQL
SPECIFIC MYLIB.DOES_TABLE_EXIST
DETERMINISTIC
CONTAINS SQL
CALLED ON NULL INPUT
NO EXTERNAL ACTION
@phpdave
phpdave / Example updating wwwperzl local list.sh
Last active May 30, 2016 15:22
Example updating wwwperzl local list so that it has the latest packages on perzl's site
#list what php-cli packages are on perzl for php-cli
./wwwperzl.sh aix53 list php-cli
php-cli-5.4.10-1.aix5.1.ppc.deps
php-cli-5.4.11-1.aix5.1.ppc.deps
php-cli-5.4.12-1.aix5.1.ppc.deps
php-cli-5.4.13-1.aix5.1.ppc.deps
php-cli-5.4.14-1.aix5.1.ppc.deps
php-cli-5.4.8-1.aix5.1.ppc.deps
php-cli-5.4.9-1.aix5.1.ppc.deps
php-cli-5.5.0-1.aix5.1.ppc.deps
@phpdave
phpdave / GetKeyPhysicalUDTF.sql
Last active May 27, 2016 02:47
UDTF to get Key Physicals
-- Followed Birgitta's article @ https://www.ibm.com/developerworks/ibmi/library/i-power-of-udtf/
CREATE FUNCTION DisplayKeyedPhysicals_Fnc(ParTable VarChar(10))
RETURNS TABLE (FieldWeWant1 Char(10) )
LANGUAGE SQL
MODIFIES SQL DATA
BEGIN
DECLARE CLCmd VarChar(256) Not NULL Default '';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
DECLARE ERROR_HIT INTEGER;
--Authority Collection - https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzarl/rzarlautcolstart.htm
--https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/cl/strautcol.htm
STRAUTCOL USRPRF(USER1) LIBINF(*ALL) OBJ(*ALL) OBJTYPE(*ALL) OMITLIB((MYLIB1))
--https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/cl/endautcol.htm
ENDAUTCOL USER(USER1)
--View Data collected
SELECT * FROM QSYS2.AUTHORITY_COLLECTION
[me@webserver /]# php recurlysCurlTest.php
TLS Version Negotiated: TLS 1.0
[me@webserver /]# php recurlysCurlTestModifiedWithCURLOPT_SSLVERSION.php
TLS Version Negotiated: TLS 1.2
@phpdave
phpdave / 5250 Commands to modify startupjob.sh
Last active April 26, 2016 21:10
Modify your startup program to auto start Zend Server after IPL or reboot
#Find where your startup program is. (Program called after an IPL (Reboot))
DSPSYSVAL SYSVAL(QSTRUPPGM)
#Create a source file
CRTSRCPF FILE(MYLIB/MYFILE)
#Put the startup Program in that file
RTVCLSRC PGM(SOMELIB/THESTARTUPPGM) SRCFILE(MYLIB/MYFILE) SRCMBR(MYPROGM)
STRPDM
git clone [email protected]:git-mirror/nginx.git && cd nginx
PATH=/opt/freeware/bin:$PATH \
CC=gcc \
CFLAGS=-O3 \
./auto/configure \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_ssl_module \
--pid-path=/var/run/nginx.pid \
@phpdave
phpdave / CI CD Notes.MD
Last active April 25, 2024 22:23
How to Automate your deployments and move towards Continuous Integration and Continuous Deployment

I. Prepare and Understand

Set up Public Keys between your Deployment Machine and the Remote Machines to deploy to

  1. On your local machine generate a public key that will be exchanged with the remote servers you'll be deploying to. This will authorize your computer to connect and not require a password
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa_abccompany -C "Comment to remember whos key"

also setup your ~/.ssh/config with this info to tie your key to which host

Host 192.168.1.5
    Port 22
<?
$database = 'MYIBMI';
$user = 'dbuser';
$password = 'mypassword';
$options = array('CURSOR' => DB2_SCROLLABLE);
$conn = db2_connect($database, $user, $password, $options);
@phpdave
phpdave / IndexTest.sql
Last active April 8, 2016 13:23
IBM DB2 for i testing indexes
/* Creating schema/library MYLIB if you don't already have it */
BEGIN
IF (NOT EXISTS(SELECT * FROM TABLE(SYSIBM.SCHEMAS()) AS SCHEMAS WHERE ODOBNM='MYLIB')) THEN
CREATE SCHEMA MYLIB;
END IF;
END;
/* Creating table MYLIB.TEST */
CREATE TABLE MYLIB.TEST
( NAME VARCHAR (20) NOT HIDDEN ) NOT VOLATILE ;
-- Grant Permissions