Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Need help ? Call me.....

Michael Bladowski michabbb

💭
Need help ? Call me.....
View GitHub Profile
View debugging_sendmail.txt
/usr/local/bin/phpsendmail
==================================================================================================
#!/usr/local/bin/php
<?php
/**
This script is a sendmail wrapper for php to log calls of the php mail() function.
Author: Till Brehm, www.ispconfig.org
(Hopefully) secured by David Goodwin <david @ _palepurple_.co.uk>
*/
@michabbb
michabbb / mysql_float_to_decimal_column_helper_select.sql
Created Jul 28, 2020
Helper SELECT: Changing FLOAT to DECIMAL in MySQL
View mysql_float_to_decimal_column_helper_select.sql
SELECT
CONCAT('ALTER TABLE `',c.TABLE_NAME,'` CHANGE COLUMN `',c.COLUMN_NAME,'` `',c.COLUMN_NAME,'` ',REPLACE(c.COLUMN_TYPE,'float','decimal'),' ',IF(c.COLUMN_DEFAULT='NULL','DEFAULT NULL',' NOT NULL'),';')
FROM information_schema.COLUMNS c
WHERE c.TABLE_SCHEMA = 'mydatabase'
AND c.COLUMN_TYPE LIKE 'float%'
@michabbb
michabbb / findSellerStandardsProfiles.json
Created Jun 11, 2020
ebay findSellerStandardsProfiles response example
View findSellerStandardsProfiles.json
{
"standardsProfiles": [
{
"standardsLevel": "ABOVE_STANDARD",
"program": "PROGRAM_US",
"cycle": {
"cycleType": "CURRENT",
"evaluationDate": "2018-07-20T19:30:32.000Z"
},
"evaluationReason": "Default",
@michabbb
michabbb / Dockerfile
Created Apr 23, 2020
Dockerfile for pt-table-sync
View Dockerfile
FROM debian:9
RUN apt-get update && apt-get install -y \
libdbd-mysql-perl \
libdbi-perl \
libio-socket-ssl-perl \
libterm-readkey-perl \
perl \
wget \
&& rm -rf /usr/share/doc/* && \
@michabbb
michabbb / compare_large_table_by_hash.sql
Created Apr 22, 2020
mysql: Compare large tables by hash
View compare_large_table_by_hash.sql
/* create tmp table with entries that exist */
DROP TEMPORARY TABLE IF EXISTS source;
CREATE TEMPORARY TABLE source (compare_hash char(32) PRIMARY KEY) ENGINE = MEMORY
SELECT
compare_hash
FROM table_source AS s;
/* create tmp table with entries that SHOULD exist */
DROP TEMPORARY TABLE IF EXISTS target;
CREATE TEMPORARY TABLE target (compare_hash char(32) PRIMARY KEY) ENGINE=MEMORY
View Dockerfile
FROM php:7.4-fpm-alpine3.11
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
RUN chmod u+x /usr/local/bin/docker-php-ext-* /usr/local/bin/docker-php-entrypoint
ENV IMAGICK_VERSION 3.4.4
ENV PHPMEMCACHED_VERSION 3.1.5
ENV PHPXDEBUG_VERSION 2.9.1
ENV PHPREDIS_VERSION 5.1.1
ENV GEARMAN_VERSION 2.0.3
@michabbb
michabbb / mass_rename_file_extension_and_convert_it_to_utf8.sh
Created Jan 28, 2020
mass rename file extension and convert it to utf8
View mass_rename_file_extension_and_convert_it_to_utf8.sh
#!/bin/bash
find /yourpath/ -path /yourpath/vendor -prune -o -type f -name "*.inc" -print0 | while read -d $'\0' file
do
DIR=$(dirname "${file}")
filename=$(basename -- "$file")
filename_without_ext="${filename%.*}"
NEWFILENAME="$DIR"/"$filename_without_ext".php
echo "$NEWFILENAME"
git -C /yourpath/ mv "$file" "$NEWFILENAME"
done
View parse_ebay_itemid_from_url.js
parseUrlForEbayItemId(url) {
if (url) {
if (url.toLowerCase()
.indexOf('ebay') >= 0) {
console.log('ebay found');
// this url is on ebay, try to get the item id
const splited = url.split('/');
// search for "/itm/"
if (splited.indexOf('itm') > 0) {
console.log('itm found');
@michabbb
michabbb / angular_ebay_custom_shop_pages_example.html
Created Jul 9, 2019
load angular inside ebay custom shop pages
View angular_ebay_custom_shop_pages_example.html
<link rel="stylesheet" href="https://mydomain.com/css/styles.css">
<script type="text/javascript">
var _runtimeES2015 = document.createElement('script');
_runtimeES2015.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(_runtimeES2015);
_runtimeES2015.setAttribute('src', 'https://mydomain.com/js/runtime-es2015.js');
var _polyES2015 = document.createElement('script');
_polyES2015.setAttribute('type', 'text/javascript');
@michabbb
michabbb / ebay-upload-images-parallel.php
Created May 27, 2019
Upload Images to Ebay in parallel
View ebay-upload-images-parallel.php
<?php
/**
the composer.json used here:
{
"require": {
"guzzlehttp/guzzle": "^6.3"
},
"require-dev": {
"kint-php/kint": "^3.2"
You can’t perform that action at this time.