Skip to content

Instantly share code, notes, and snippets.

View davidalger's full-sized avatar

David Alger davidalger

View GitHub Profile
@peterjaap
peterjaap / DB_CLEANUP_WITH_QUOTE_TABLE.php
Last active April 13, 2020 20:46
Updated Magento 2 cleanup script for sensitive data in wishlist_item_option, quote_item_option AND order_item_option (not in original script). Also added try/catch block for unserializable data. See for more info https://support.magento.com/hc/en-us/articles/360040209352 and https://magento.com/security/hot-fix-available-cve-2019-8118
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\App\Bootstrap;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Query\Generator;
use Magento\Framework\DB\Select\QueryModifierFactory;

Valet+ Configuration

Before Valet Install

Kill Native PHP and MySQL

brew services stop php
brew services stop mysql
@davidalger
davidalger / magento2-order-counts.sql
Last active March 8, 2023 10:57
magento2-order-counts.sql
SET @utc_offset = 6;
-- Orders Per Year --
SELECT period_date, CONCAT("UTC-", @utc_offset) AS utc_offset, order_count, gross_revenue, ROUND(gross_revenue / order_count, 2) AS gross_aov
FROM (
SELECT
COUNT(*) AS order_count,
ROUND(SUM(base_grand_total), 2) AS gross_revenue,
date_format(date_sub(o.created_at, INTERVAL @utc_offset HOUR), "%Y") AS period_date
FROM sales_order o

NOT UP TO DATE!

Things in this document might not work or be broken nowadays

my laptop:

I'm writing this here because a few things in here are spesific to this model laptop.
Dell XPS 15 9560 (4k) touch screen

Some notes:

Most things after setup are not specific for this laptop
# = run as root

@CNanninga
CNanninga / magento2-clone-prod-to-stage.sh
Last active August 27, 2019 07:00
Magento 2 Production to Stage Clone
#!/bin/bash
SOURCE_DB_NAME="example_prod"
SOURCE_ROOT_DIR="/var/www/prod"
SOURCE_DUMP_FILENAME=example_prod_$(date +%F).sql.gz
TARGET_DB_NAME="example_stage"
TARGET_ROOT_DIR="/var/www/stage"
TARGET_SSH_USER="www-stage"
TARGET_SSH_HOST="stage.example.com"
@goodwill
goodwill / cloud-sql-proxy.service
Last active May 28, 2024 18:24
Example Systemd file for starting cloud sql proxy at system start
[Install]
WantedBy=multi-user.target
[Unit]
Description=Google Cloud Compute Engine SQL Proxy
Requires=networking.service
After=networking.service
[Service]
Type=simple
@mttjohnson
mttjohnson / system_performance_monitoring.sh
Last active March 23, 2022 02:55
Linux System Performance Monitoring
# Poll for various system stats for monitoring system
# Just copy and paste the commands into a bash prompt
# Use Ctrl-C to exit the polling
# Simple Example (CPU/Load/Memory)
# Settings
INTERVAL_DURATION="5" # seconds to average across
TIME_PAD=' '
@posener
posener / go-shebang-story.md
Last active June 28, 2024 21:18
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@willejs
willejs / README.md
Last active January 4, 2023 09:39
Moving Concourse Pipelines

Moving Concourse Pipelines

Currently concourse does not support moving pipelines between teams via fly CLI. There is an issue for that here

The only way to do this is to make a few changes in the DB.

If you run the statement below you will see that 6 tables have the team_id column.

concourse=> select table_name                                                                                                                                                                                                                                                                                                                                                       from INFORMATION_SCHEMA.COLUMNS                                                                                                                                                                                                                                                                            
@mttjohnson
mttjohnson / composer_private_repos.sh
Last active April 22, 2021 19:37
Composer Notes and Private Repositories
# List the composer home directory
# Typically /Users/<user>/.composer or /home/<user>/.composer or C:\Users\<user>\AppData\Roaming\Composer
echo $COMPOSER_HOME
# List files in the composer home
ls -la $COMPOSER_HOME
# View auth.json in composer home used when no local ./auth.json exists in the directory executed from
cat $COMPOSER_HOME/auth.json