Skip to content

Instantly share code, notes, and snippets.

View grambas's full-sized avatar

Mindaugas Milius grambas

View GitHub Profile
@grambas
grambas / StackTraceProcessor.php
Created January 18, 2024 07:50
Log stack trace as string too for exceptions
<?php
declare(strict_types=1);
namespace App\Monolog;
use Throwable;
/**
* log stack trace instead of exception class
@grambas
grambas / TestLoggingCommand.php
Created January 18, 2024 07:47
Test symfony logging with command
<?php
declare(strict_types=1);
namespace App\Command;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
{
"contact": "https://discord.gg/lturepublic",
"templates": [
{
"name": "Vytautas",
"sources": [
"https://imgur.com/OrIub1b.png"
],
"x": 1359,
@grambas
grambas / portforward.sh
Last active January 23, 2024 10:04 — forked from codeinthehole/portforward.sh
bashrc port forward helper
# add these functions in ~/.bashrc
#
# Easier port forwarding - usage:
#
# $ portforward 9204 stageX localhost 9200
#
# where 'stageX' is an alias from ~/.ssh/config
# 9200 is the remote port on localhost
# 9204 is local port
#
@grambas
grambas / auth.json
Created February 15, 2023 15:54
auth.json
{
"github-oauth": {
"github.com": "abc123def456ghi7890jkl987mno654pqr321stu"
}
}
@grambas
grambas / battery_monitoring_blueprint.yaml
Created September 17, 2022 18:21
battery monitoring home assistant
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@grambas
grambas / git.migrate
Last active February 16, 2022 07:51 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@grambas
grambas / git-pull-all
Created February 16, 2022 07:50 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@grambas
grambas / clean_mysql_bin_logs.sh
Last active November 2, 2020 19:00
cleant mysq bin logs
docker exec -it -u root DB_CONTAINER_NAME /bin/bash
mysql -u root -p
PURGE BINARY LOGS BEFORE NOW(); # OR RESET MASTER;
# check option
SELECT * FROM performance_schema.global_variables WHERE VARIABLE_NAME IN ('log_bin');
class TextToImage
{
/**
* @param string $text
* @param int $width
* @param int $height
* @param int $font
*
* @return Response
*/