Skip to content

Instantly share code, notes, and snippets.

View strategy's full-sized avatar

Daniel Popa strategy

  • 18:39 (UTC +03:00)
View GitHub Profile
@flaviu-chelaru
flaviu-chelaru / ExceptionHandler.php
Created October 1, 2019 06:44
Retry exception handler
<?php
class ExceptionHandler {
public static function retry(\Closure $main, ?\Closure $onFailure = null, $tries = 10) {
$throwable = null;
try {
call_user_func($main);
} catch(\Throwable $throwable) {
// i would advise catching only specfic exceptions here
@stokito
stokito / create_patch.sh
Last active July 23, 2024 19:26
git: create a single patch file with multiple commits
# last three commits
git format-patch -3 --stdout > multi_commit.patch
# all commits that are in your branch and not in master into a single patch file multi_commit.patch
git format-patch --signoff master --stdout > multi_commit.patch
# create patches in the folder ~/output/directory/ for all commits that are in your branch and not in master
git format-patch -o ~/output/directory/ --signoff master
@loru88
loru88 / php-cli-xdebug-docker-phpstorm.md
Last active November 29, 2023 09:44
Manually debug PHP CLI inside a Docker container using PHPStorm

to debug a PHP cli script running inside a specific Docker container, you need to find out the the Gateway IP of the docker network your container is attached to.

grab the network name of the running container

$ docker inspect my_container | grep NetworkMode

than grab the gateway IP

Backup crons

These can be used to setup backups in a shared hosting with CPANEL (for example)

Backup a public web directory to a ftp directory

cd ~/public_html && tar -zcvf ~/public_ftp/bkp$(date +\%F).tar.gz .

Dump a database to a ftp directory

@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/ 
@vdparikh
vdparikh / main.go
Created November 9, 2017 19:06
GoLang Verify/Generate JWT Token
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"time"
@alirezaomidi
alirezaomidi / openconnect.sh
Last active November 28, 2023 12:04
Script to connect and disconnect to/from openconnect without pain
#!/bin/bash
# This script connects the computer to a vpn server using openconnect without pain
prog_name=$(basename $0)
# CHANGE YOUR_VPN_SERVER_DOMAIN to the VPN server you know like example.com
domain=YOUR_VPN_SERVER_DOMAIN
function help {
@KostyaEsmukov
KostyaEsmukov / _nginx_docker_config.md
Last active July 14, 2024 04:52
Nginx configuration sample for docker

Nginx production configuration sample

This config assumes that nginx is run from docker image _/nginx.

docker commands

docker network create nginx

mkdir -p /etc/myproject/nginx

cd /etc/myproject/nginx

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 27, 2025 19:52
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@knownasilya
knownasilya / testing-resources.md
Last active May 12, 2016 20:21
Testing Resources

Testing Resources

This is a collection of tools and articles about testing Web Applications. The focus will be towards Ember apps, but also includes server side and articles that can apply to all kinds of testing.

General Tools/Libraries