Skip to content

Instantly share code, notes, and snippets.

Avatar
🖥️

Karoly Gossler connorhu

🖥️
View GitHub Profile
@connorhu
connorhu / update.sh
Last active January 16, 2023 12:36
phpmyadmin update script
View update.sh
#!/bin/sh
CURRENT_VERSION=$(ls -la | grep \ web | awk '{ print $11 }' | sed -e 's/phpMyAdmin-\(.*\)-all-languages/\1/') # '
VERSION_CONTENT=$(curl -s https://www.phpmyadmin.net/home_page/version.json | php -r 'echo json_decode(file_get_contents("php://stdin"), true)["version"];')
LATEST_VERSION=$(echo "$VERSION_CONTENT" | head -n1)
LATEST_VERSION_DL_URL="https://files.phpmyadmin.net/phpMyAdmin/${LATEST_VERSION}/phpMyAdmin-${LATEST_VERSION}-all-languages.zip"
PHP_VERSION="php8.2"
if [ ! -f config.inc.php ]
@connorhu
connorhu / phpbrew ext installs
Last active January 20, 2023 14:56
phpbrew ext
View phpbrew ext installs
# php w mysql
# default:
# bcmath, bz2, calendar, cli, ctype, dom, fileinfo, filter, ipc,
# json, mbregex, mbstring, mhash, pcntl, pcre, pdo, pear, phar, posix,
# readline, sockets, tokenizer, xml, curl, openssl, zip
phpbrew install php-{version} +default +dbs +intl +soap
phpbrew ext install gd
phpbrew ext install iconv -- --with-iconv=/usr/local/opt/libiconv
View Woocommerce number of all orders between dates
SET @prefix = 'wp_';
SET @date_from = '2020-01-01';
SET @date_to = '2020-12-31';
SET @query = CONCAT('SELECT sum(woim.meta_value) number_of_item_sold, woi.order_item_name
FROM ', @prefix, 'woocommerce_order_itemmeta as woim
LEFT JOIN ', @prefix, 'woocommerce_order_items as woi ON woi.order_item_id = woim.order_item_id
LEFT JOIN ', @prefix, 'posts as p ON woi.order_id = p.ID
WHERE woim.meta_key = \'_qty\'
AND p.post_status = \'wc-completed\'
@connorhu
connorhu / build
Last active March 9, 2021 15:58
symfony build and deploy
View build
#!/bin/bash
env=$1
if [ "$env" == "" ]
then
echo "env missing"
exit 1
fi