Skip to content

Instantly share code, notes, and snippets.

@phpdave
phpdave / creating a symbolic link.sh
Last active November 5, 2024 02:18
creating a symbolic link.sh
@phpdave
phpdave / sigh.cls
Created May 20, 2019 19:12 — forked from tsalb/sigh.cls
Sanity check your org's CRUD
String DEBUG_TEMPLATE = 'C:[C] R:[R] U:[U] D:[D] MA:[MA] RA:[RA] | [PROFILE_NAME] | [OBJECT_NAME]';
String TRUE_TEMPLATE = '[X]'; // do not use space, horizontal char alignment will be off
String FALSE_TEMPLATE = '[_]'; // same
Integer PROFILE_NAME_MAX_LENGTH;
// Grab the max chars of each, so we can get an evenly formatted / spaced output later
List<Integer> nameLengths = new List<Integer>();
for (Profile profile : [SELECT Name FROM Profile]) {
nameLengths.add(profile.Name.length());
}
@phpdave
phpdave / gist:88f376dba0112cfbae19b9fa097793fb
Created April 6, 2019 00:39
Setting up google cloud natural language
setup follow https://cloud.google.com/natural-language/docs/reference/libraries#client-libraries-install-php
@phpdave
phpdave / Changing yum to work when ftp is blocked.sh
Last active January 24, 2019 23:20
Instalingl Yum on IBM i
#1. Download the entire directory at ftp://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo
#2. Upload the entire directoy to IBM i ifs
#3. Change the baseurl in /QOpenSys/etc/yum/repos.d/ibm.repo to point to ifs directory
# FROM: baseurl=ftp://public.dhe.ibm.com/software/ibmi/products/pase/rpms/repo
# TO: baseurl=file:///path/to/local/repo
# EXTO: baseurl=file:///QOpenSys/etc/yum/IBMRepoLocalMirror/repo
vi /QOpenSys/etc/yum/repos.d/ibm.repo
@phpdave
phpdave / Proof.php
Last active September 6, 2017 13:18
Apparent Memory leak in External Stored Procedure with INOUT param w/ PHP's IBM DB2 extension 1.9.9 when binding the parameter in PHP7. When the bindparam on the out parameter is done outside of the loop memory doesn't increase.
<?php
$db2Connection = db2_connect('MYDB', 'MYUSER', 'MYPASS',array('i5_lib' => 'MYLIB'));
$sql = "CALL MYLIB.TESTSP(?,?)";
$stmt = db2_prepare($db2Connection, $sql);
for ($i = 0; $i <= 20; $i++)
{
if ($stmt)
{
$id = 20;
$name = "";
Output of phpinfo() when xdebug is enabled
xdebug
xdebug support enabled
Version 2.5.1
IDE Key NETBEANS
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive Local Value Master Value
@phpdave
phpdave / debugger.ini
Last active August 28, 2017 20:21
Enabling xdebug on IBM i Zend Server 9 PHP7
;Turn off zend debugger in /usr/local/zendphp7/etc/conf.d/debugger.ini
;zend_extension_manager.dir.debugger=/usr/local/zendphp7/lib/debugger
@phpdave
phpdave / httpd.conf
Last active April 19, 2018 13:22
IBM i apache config for Zend Server https/ssl
# Load the SSL module into Apache
LoadModule ibm_ssl_module /QSYS.LIB/QHTTPSVR.LIB/QZSRVSSL.SRVPGM
# Listen for HTTPS traffic
Listen 10.1.1.200:80
Listen 10.1.1.200:443
NameVirtualHost 10.1.1.200:443
# MYApp - Redirect to HTTPS
<VirtualHost 10.1.1.201:80>
https://www.google.com/search?q=ibm+watson+services+and+apis&oq=ibm+watson+services+and+apis&aqs=chrome..69i57.6374j0j7&sourceid=chrome&ie=UTF-8
Watson API Explorer to test PAIs
https://watson-api-explorer.mybluemix.net/
https://bitbucket.org/litmis/python-itoolkit
Integrated web services (IWS) - SOAP and REST. Expose RPG as REST. Supports XML and JSON
So much data is being consumed and 80% of data can't be consumed... Consumed -> Understand
@phpdave
phpdave / ApacheResourcesUsage.sh
Last active April 20, 2017 15:55
Apache Performance monitoring memory usage.
echo Start $(date '+%Y %b %d %H:%M:%S') $HOSTNAME
ps aux | awk '{print $3;}' | awk '{total += ($1) ;} END {print total " % of CPU Used by All Processes";}'
ps aux | awk '{print $4;}' | awk '{total += ($1) ;} END {print total " % of Memory used by ALL Processes";}'
ps aux | grep 'httpd' | awk '{print $3;}' | awk '{total += ($1) ;} END {print total " % of CPU Used by Apache Processes";}'
ps aux | grep 'httpd' | awk '{print $4;}' | awk '{total += ($1) ;} END {print total " % of Memory used by Apache Processes";}'
ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{total += ($1) ;} END {print total " MB used by Apache Processes";}'
ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB used on average per Apache process";}'
ps -C httpd --no-headers | wc -l | awk '{print $0 " apache processes ";}'
echo '---CPU and IO Usage sar -P ALL 1 5 | grep average---'