Skip to content

Instantly share code, notes, and snippets.

View medeirosinacio's full-sized avatar
🤙
Stackoverflow Oriented Programming

Douglas Medeiros medeirosinacio

🤙
Stackoverflow Oriented Programming
View GitHub Profile
@medeirosinacio
medeirosinacio / mac-battery-alarm-service.sh
Last active April 15, 2024 17:43
MacOs Battery Alarm Script
#!/bin/bash
## display notification "Battery has disconnected with less than % battery" with title "Battery Alarm"
function debug() {
logger "$1"
echo "$1"
}
debug "CRONTAB | Battery Alarm Service Started"
@medeirosinacio
medeirosinacio / Jira Type Itens Icons.md
Last active March 6, 2024 12:52
Jira Type Itens Icons

Task Suggestion Subtask Story Spike Sales request Requirement Remove feature Question Poc

@medeirosinacio
medeirosinacio / amaterasu.sh
Last active February 22, 2024 12:28
clean up docker
docker stop $(docker ps -aq) && \
docker rm $(docker ps -aq) && \
docker system prune -a && \
docker volume rm $(docker volume ls -qf dangling=true) && \
docker network prune
@medeirosinacio
medeirosinacio / ClassLoader.php
Created January 30, 2024 15:02
src/Composer/Autoload/ClassLoader.php
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@medeirosinacio
medeirosinacio / GracefulShutdown.php
Last active January 10, 2024 20:19
Manual Graceful Shutdown PHP Shared Memory
<?php
declare(strict_types=1);
use SysvSharedMemory;
class GracefulShutdown
{
public const KEY = 666;
@medeirosinacio
medeirosinacio / MockeryExpectations Trait.md
Created November 27, 2023 20:23
MockeryExpectations Trait

Overview

The MockeryExpectations trait provides a convenient method to assert Mockery expectations in PHPUnit tests. It is particularly useful when working with Mockery for mocking and stubbing objects.

Usage

To use the MockeryExpectations trait in your PHPUnit test class, follow these steps:

  1. Include the trait in your test class:
@medeirosinacio
medeirosinacio / PHP command to List All Extension and Versions.md
Created November 27, 2023 20:15
PHP command to List All Extension and Versions

PHP Extension Versions Checker

Overview

This simple PHP command allows you to list all loaded PHP extensions along with their versions. It utilizes the ReflectionExtension class to provide detailed information about each extension.

Usage

php -r '$all = get_loaded_extensions(); foreach($all as $i) { $ext = new ReflectionExtension($i); $ver = $ext-&gt;getVersion(); echo "$i - $ver" . PHP_EOL;}'
@medeirosinacio
medeirosinacio / alternative to nilportugues php-backslasher.sh
Last active September 19, 2023 20:00
alternative to nilportugues/php-backslasher
php -d memory_limit=-1 vendor/bin/php-cs-fixer fix ./ --rules=native_function_invocation --allow-risky=yes
php -d memory_limit=-1 vendor/bin/php-cs-fixer fix ./vendor --rules=native_function_invocation --allow-risky=yes
@medeirosinacio
medeirosinacio / Error response from daemon: Get "https:...": tls: failed to verify certificate: x509: certificate signed by unknown authority.md
Last active September 4, 2023 19:28
Error response from daemon: Get "https://docker.elastic.co/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority
Error response from daemon: Get "https://docker.elastic.co/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority

mkdir -p ~/.docker/certs.d/docker.elastic.co
openssl s_client -showcerts -connect docker.elastic.co:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.docker/certs.d/docker.elastic.co/docker.elastic.co.crt

restart docker
@medeirosinacio
medeirosinacio / composer-graph.html
Last active August 31, 2023 17:23
test Composer-Graph
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JBZoo - Mermaid Graph</title>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
</script>
</head>