Skip to content

Instantly share code, notes, and snippets.

View dfelton's full-sized avatar

Darren Felton dfelton

View GitHub Profile
@dfelton
dfelton / ms-example.php
Created October 16, 2023 19:13
Visual example for testing intervals in milliseconds
<?php
$ms = (int) ($_GET['ms'] ?? 1000);
if ($ms < 1) {
$ms = 1000;
}
?>
<html>
<head>
@dfelton
dfelton / GlobalProtectReadME.md
Created September 5, 2023 18:30
Global Protect Install files|dirs -- Fedora
[100%] Built target gpclient
-- Install configuration: "Release"
-- Installing: /usr/bin/gpservice
-- Installing: /usr/share/dbus-1/system.d/com.yuezk.qt.GPService.conf
-- Installing: /usr/share/dbus-1/system-services/com.yuezk.qt.GPService.service
-- Installing: /etc/gpservice/gp.conf
-- Installing: /usr/lib/systemd/system/gpservice.service
-- Installing: /usr/bin/gpclient
-- Installing: /usr/share/metainfo/com.yuezk.qt.gpclient.metainfo.xml
@dfelton
dfelton / create-rules-exlusions.sh
Last active August 30, 2023 14:30
Generates XML for a PHPCS exlusion list of existing violations, segregated by rule name.
#!/bin/bash
./vendor/bin/phpcs . > phpcs_results
php -r '
$contents = file_get_contents("phpcs_results");
$contents = explode(PHP_EOL, $contents);
$currentFile = "";
$rules = [];
foreach ($contents as $line) {
@dfelton
dfelton / magento-output-cron-xml.sh
Created March 13, 2023 16:24
Magento - Output XML configured cron jobs
#!/bin/bash
#
# - Finds all crontab.xml files within a Magento project
# - Collects all group name, job name, and schedules within these files
# - Outputs to screen this information, sorted by group & job name
#
php -r '
$results = [];
@dfelton
dfelton / localhostMagentoPackageDevelopment.sh
Last active July 22, 2022 15:36
High level steps for developing Magento packages locally outside of vendor, while having those changes reflected in vendor.
# This assumes that you have your Magento project and its dependent composer packages in separate repositories.
#
# While developing directly inside the vendor/VENDOR_NAME/PACKAGE_NAME/ of Magento is possible, this practice
# can potentially lead to mistakes being made and work lost, as the vendor/ diretory should be treated
# as volatile and able to be deleted at any time.
# Values below in capital letters are the variable aspects of these instructions.
# navigate to your package root and create a new branch for your development purposes
cd /PATH/TO/COMPOSER_PACKAGE/
@dfelton
dfelton / customer_attributes.sql
Created June 10, 2022 14:57
Handy MySQL Selects for Magento 2
select
t3.entity_type_code,
t2.attribute_code,
t2.attribute_model,
t2.backend_model,
t2.backend_type,
t2.backend_table,
t2.frontend_model,
t2.frontend_input,
t2.frontend_label,
@dfelton
dfelton / nvidia-gpu-brightness.sh
Created March 3, 2022 05:04
NVidia GPU Lights Brightness Adjustment - Linux
nvidia-settings --assign GPULogoBrightness=0
@dfelton
dfelton / google-sheets-importrange-generator.php
Created February 18, 2022 22:56
IMPORTRANGE() column generator of months of the years for Google Sheets
<?php
declare(strict_types=1);
$format = '"=IMPORTRANGE(""%s"",""%s!H1"")"';
$months = [
"JAN",
"FEB",
"MAR",
@dfelton
dfelton / update-ca-certificates.md
Last active January 21, 2022 04:28 — forked from epcim/update-ca-certificates.md
trusted certificates system update-ca-certificates

Adding trusted root certificates to the server

Mac OS X

# Adding Certificate Authority
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca-filename.crt

# Adding Certificate trusted for SSL
sudo security add-trusted-cert -d -k /Library/Keychains/System.keychain -r trustAsRoot -p ssl filename.crt
@dfelton
dfelton / example.php
Created January 14, 2022 19:15
Example of an informative php docblock
<?php
declare(strict_types=1);
namespace Kobens\Gemini\Report\YearToDateVolume;
interface DataProviderInterface
{
/**
* @return \Kobens\Gemini\ApiModels\TradeInterface[]