All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login
's Avatar

anthony

Joined 1739410376

Recently created
Least recently created
Recently updated
Least recently updated
All gists 42
anthony's Avatar

anthony / Real-time PHP-FPM Status

0 likes
0 forks
1 files
Last active 1740032355
Taken from https://gist.github.com/shakahl/9dab7d1e49c5d8d6a57a4633a702d23c
php

Real-time PHP-FPM Status

This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Everybody knows the famous phpinfo() and the page it generates, right? Then the real-time PHP-FPM status page design is very similar.

image

Some informations from the top are not displayed to avoid security issues.

Enable PHP-FPM Status

anthony's Avatar

anthony / Get latest release from GitHub

0 likes
0 forks
1 files
Last active 1740032296
Taken from https://gist.github.com/shakahl/d629dbe9d41f57699dba597929582c9f
curl github shell
1 #!/bin/bash
2 get_latest_release() {
3 curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
4 grep '"tag_name":' | # Get tag line
5 sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
6 }
anthony's Avatar

anthony / Simple dotenv loader

0 likes
0 forks
1 files
Last active 1740032215
Taken from https://gist.github.com/shakahl/9933eb74b8a89d3e5f34c86ce1f0c840
env php
1 <?php
2
3 /**
4 * Loads an environment variable
5 *
6 * @param string $name
7 * @param mixed|null $def
8 * @param bool $local
9 * @return array|mixed|string|null
10 */
anthony's Avatar

anthony / Semver range validator in bash (using sed, grep, and bc)

0 likes
0 forks
1 files
Last active 1740032087
Taken from https://gist.github.com/lxe/b167d3ec4e4f94d246ebdc4bcfdfb6ac
bash grep sed shell
1 #!/bin/bash
2
3 # set -x
4
5 # Stupid Simple Semver range validator
6 # (no build metadata and no prereleases, and no multiple ranges (||))
7
8 # Prints a list of versions that match a semver range
9 # ./semver.sh "range" version version version...
anthony's Avatar

anthony / Argument parser for bash scripts without getopt or getopts

0 likes
0 forks
1 files
Last active 1740031897
Taken from b167d3ec4e4f94d246ebdc4bcfdfb6ac
shell
1 #!/usr/bin/env bash
2
3 # Argument parser for bash scripts
4 #
5 # Author: Anthony Axenov (Антон Аксенов)
6 # Version: 1.6
7 # License: MIT
8 # Description: https://git.axenov.dev/anthony/shell/src/branch/master/helpers/arg-parser
9
10 #purpose Little helper to check if string matches PCRE
anthony's Avatar

anthony / jq cheatsheet

0 likes
0 forks
1 files
Last active 1740030890
Taken from https://gist.github.com/olih/f7437fb6962fb3ee9fe95bda8d2c8fa4
jq

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Useful arguments

When running jq, the following arguments may become handy:

Argument Description
anthony's Avatar

anthony / Пример рекурсивного меню

0 likes
0 forks
1 files
Last active 1740030189
php
1 <?php
2 $nav = [
3 [
4 'name' => 'Home',
5 'title' => 'Homepage',
6 // ...something else...
7 'sub' => [
8 [
9 'name' => 'sub11',
10 'title' => null,
anthony's Avatar

anthony / Simple equivalents of Oracle functions

0 likes
0 forks
2 files
Last active 1740030098
For those who like perversions
php
1 <?php
2
3 /**
4 * Simple php equivalent of Oracle's decode()
5 *
6 * It can be used as simple oneline-alternative to switch or if operators in many
7 * cases without difficult logic. For example, get string mnemocode of some value:
8 *
9 * echo 'State: '.decode($state, 0, 'disabled', 1, 'enabled', 'unknown');
10 *
anthony's Avatar

anthony / Install zsh / oh-my-zsh / Powerlevel10k on Ubuntu 20.04

0 likes
0 forks
2 files
Last active 1740029852
omz shell ubuntu zsh
1 #!/bin/bash
2 # Based on:
3 # https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions
4 # https://github.com/ohmyzsh/ohmyzsh
5 # https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation
6 # https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95
7 # https://linuxhint.com/install_zsh_shell_ubuntu_1804/
8
9 echo "*********************************************"
10 echo " zsh fancifier"
anthony's Avatar

anthony / Функции для проверки php-синтаксиса

0 likes
0 forks
1 files
Last active 1740029617
php
1 <?php
2
3 /**
4 * Проверяет корректность синтаксиса php-файла
5 *
6 * @param string $filepath Путь к файлу
7 * @param int $exitcode Код выхода процесса php
8 * @return array Массив строк результата
9 */
10 function php_syntax_file(string $filepath, int &$exitcode = 0): array {
Newer Older

Powered by Opengist ⋅ Load: 1131ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文