Skip to content

Instantly share code, notes, and snippets.

View michabbb's full-sized avatar
💯
Need help ? Call me.....

Micha(el) Bladowski michabbb

💯
Need help ? Call me.....
View GitHub Profile
@michabbb
michabbb / Dockerfile
Created July 31, 2022 12:12
make electron run inside docker (used to get Tinkerwell run inside docker)
FROM php:8.1.9RC1-cli-buster
RUN apt-get update && apt-get -y install fuse3 libfuse2 libfuse-dev kmod libnss3 libatk1.0-0 libatk-bridge2.0-0 libcpuset1 libcpuset-dev libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2
RUN apt-cache search libcpus
ENV GTK_IM_MODULE=xim \
QT_IM_MODULE=fcitx \
XMODIFIERS=@im=fcitx \
DefalutIMModule=fcitx \
DBUS_SESSION_BUS_ADDRESS="autolaunch:"
FILES=""
for entry in /crontab/*
do
FILES+="$entry "
done
echo "update crontab"
cat $FILES |crontab
for entry in /where-your-files-are-after-a-checkout-of-your-ci/*
do
echo "Verify $entry"
CHECK=`chkcrontab -w bash -w docker $entry`
if [ "$?" -gt 0 ];then
echo "$CHECK"
exit 1;
fi
done
<?php declare(strict_types=1);
class Mode_test_exception extends Mode_test {
public function exception(): void
{
$this->throwerror($this->aConfig['error_reporting']['service']);
}
private function throwerror(array $params): void
@michabbb
michabbb / backup_mysql_schema_with_git.sh
Created January 18, 2022 11:26
backup mysql schema with git
#!/bin/bash
NOW=`date +%Y%m%d%H%M%S`
GIT_MYSQL=/backup/mysql
for T in `mysql -u root -N -B -e 'SELECT t.TABLE_NAME FROM information_schema.TABLES t WHERE t.TABLE_SCHEMA = "my_database" AND t.ENGINE != "MEMORY"'`;
do
echo "Backing up $T"
mysqldump -d --lock-tables=false --single-transaction=TRUE --skip-comments -u root my_databaswe $T | sed 's/ AUTO_INCREMENT=[0-9]*//g' > $GIT_MYSQL/$T.sql
done;
git add -A && git commit -m "schema from $NOW" && git push
@michabbb
michabbb / laravel_command_db_create_triggers.php
Last active April 18, 2021 12:30
In case u never use laravel timestamp columns in your models
<?php
namespace App\Console\Commands\helper;
use DB;
use Doctrine\DBAL\Exception;
use Illuminate\Console\Command;
class db_create_triggers extends Command
{
@michabbb
michabbb / debugging_sendmail.txt
Created August 6, 2020 15:09
debugging sendmail php
/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 July 28, 2020 14:24
Helper SELECT: Changing FLOAT to DECIMAL in MySQL
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 / Dockerfile
Created April 23, 2020 00:02
Dockerfile for pt-table-sync
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 April 22, 2020 23:18
mysql: Compare large tables by hash
/* 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