Skip to content

Instantly share code, notes, and snippets.

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

Michael Bladowski michabbb

💭
Need help ? Call me.....
View GitHub Profile
@michabbb
michabbb / index.js
Last active Aug 19, 2021
lambda function to handle eBay Marketplace Account Deletion Notifications
View index.js
const EventNotificationSDK = require('event-notification-nodejs-sdk');
const https = require('https');
// https://github.com/eBay/event-notification-nodejs-sdk/blob/main/lib/constants.js
const constants = {
ALGORITHM: 'ssl3-sha1',
AUTHORIZATION: 'Authorization',
BASE64: 'base64',
BEARER: 'bearer ',
ENVIRONMENT: {
@michabbb
michabbb / laravel_command_db_create_triggers.php
Last active Apr 18, 2021
In case u never use laravel timestamp columns in your models
View laravel_command_db_create_triggers.php
<?php
namespace App\Console\Commands\helper;
use DB;
use Doctrine\DBAL\Exception;
use Illuminate\Console\Command;
class db_create_triggers extends Command
{
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');