Skip to content

Instantly share code, notes, and snippets.

@scmrus
scmrus / docker-compose.base.yml
Created July 9, 2024 15:40 — forked from dimastbk/docker-compose.base.yml
traefik + portainer for docker swarm (and simple app with nginx)
version: "3.8"
services:
traefik:
image: traefik:v2.4.9
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
ports:
@scmrus
scmrus / traefik-compose.yml
Created July 9, 2024 15:38 — forked from Bmohsen/traefik-compose.yml
Traefik Compose file with http to https redirect enabled for all the routes for docker Swarm
version: "3.9"
services:
traefik:
# Use the latest v3.0.x Traefik image available
image: traefik:v3.0
ports:
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS
- target: 80
published: 80
@scmrus
scmrus / md5_file_large.php
Created May 6, 2023 15:12
MD5 hash for a large file in PHP
<?php
function md5_file_large($file_path) {
if (!file_exists($file_path)) {
return false;
}
$chunk_size = 1024 * 1024; // 1MB
$md5_hash = hash_init('md5');
$file = fopen($file_path, 'rb');
@scmrus
scmrus / get-public-ip.md
Created December 2, 2022 16:22 — forked from rkalkani/get-public-ip.md
Get public IP address used by your machine to connect to the internet

Get Public IP

DNS

Google

dig o-o.myaddr.l.google.com txt @ns1.google.com +short
# OR
nslookup -type=txt o-o.myaddr.l.google.com ns1.google.com
@scmrus
scmrus / xdebug-code-coverage.php
Last active December 9, 2021 19:38
xdebug-code-coverage (global)
<?php
$_xdebug_code_coverage = new class {
private $coverage;
private $covFile;
public function __construct()
{
require_once __DIR__ . '/../vendor/autoload.php';
$uid = uniqid();
$ composer licenses -f summary
-------------- ------------------------
License Number of dependencies
-------------- ------------------------
MIT 113
BSD-3-Clause 30
Apache-2.0 5
LGPL-3.0 2
LGPL-2.1 1
BSD-2-Clause 1
netsh wlan show profiles
netsh wlan show profile "name=wifiname" key=clear
@scmrus
scmrus / install-docker.md
Created March 8, 2021 01:26 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
Saving output from 'text to speech' to a file on Mac OS X
```
say -o hello.flac -v 'Alex' 'Hello, my name is Alex'
```
<?php
/**
* @mixin \Illuminate\Support\Collection
*
* @psalm-suppress UndefinedMethod
* @psalm-suppress UndefinedThisPropertyFetch
* @psalm-suppress UndefinedThisPropertyAssignment
*/
class CollectionMixin