Skip to content

Instantly share code, notes, and snippets.

View birkof's full-sized avatar
🤟

Daniel Stancu birkof

🤟
View GitHub Profile
@faizanakram99
faizanakram99 / PHP ADT coolness (pseudo code).md
Created June 24, 2024 23:06
PHP ADT coolness (pseudo code).md

PHP Examples: OOP vs ADT with Pattern Matching by ChatGPT

OOP Approach: Strategy Pattern

<?php

// OOP Approach with Interfaces and Classes
Sudo su
Install Node Exporter:
docker run -d --net="host" --pid="host" -v "/:/host:ro,rslave" quay.io/prometheus/node-exporter:latest --path.rootfs=/host
Create Prometheus Config:
nano prometheus.yml
@flaviut
flaviut / Setting up Emporia Vue 2 with ESPHome.md
Last active July 10, 2025 23:01
Setting up Emporia Vue 2 with ESPHome
@AlexVanderbist
AlexVanderbist / fn-live-template-phpstorm.xml
Created July 22, 2020 13:58
PhpStorm arrow function live template
<template name="fn" value="fn ($TYPE$ $INSTANCE$) =&gt; $INSTANCE$$END$" description="Arrow function" toReformat="false" toShortenFQNames="true">
<variable name="TYPE" expression="completeSmart()" defaultValue="" alwaysStopAt="true" />
<variable name="INSTANCE" expression="concat(&quot;$&quot;, camelCase(TYPE))" defaultValue="" alwaysStopAt="false" />
<context>
<option name="PHP Expression" value="true" />
<option name="PHP Statement" value="true" />
</context>
</template>
@PlugFox
PlugFox / dottedBorder.dart
Last active December 16, 2024 22:34
Flutter Web simple file upload
import 'package:flutter_web/material.dart';
import 'dart:math' as math;
class DottedBorder extends StatelessWidget {
final Color color;
final double strokeWidth;
final double gap;
final Widget child;
final EdgeInsets padding;
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@ivan-pinatti
ivan-pinatti / docker-configure-tls.sh
Last active January 13, 2024 19:32
Enable TLS in Docker service running in Ubuntu - #docker #docker-tls #tls #ubuntu
#!/usr/bin/env bash
: ' Script that enables TLS for Docker service in Ubuntu 16.x
This script is intended to be run as root
It;
- Generates the keys
- Creates the daemon.json Docker config file
@giansalex
giansalex / docker-php-ext-install.md
Last active October 13, 2024 20:15
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@soulmachine
soulmachine / jwt-expiration.md
Last active June 19, 2025 15:38
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active September 20, 2025 16:38
Docker Remote API with client verification via daemon.json

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files