Skip to content

Instantly share code, notes, and snippets.

View macbre's full-sized avatar
🏠
Working from home

Maciej Brencz macbre

🏠
Working from home
View GitHub Profile
@macbre
macbre / multiformat-wp-api-response.php
Created May 30, 2024 11:36 — forked from petenelson/multiformat-wp-api-response.php
WordPress: Example of returning non-JSON results from the WP-API
<?php
// reference https://github.com/WP-API/WP-API/blob/develop/lib/infrastructure/class-wp-rest-server.php
// serve_request() function
add_filter( 'rest_pre_serve_request', 'multiformat_rest_pre_serve_request', 10, 4 );
function multiformat_rest_pre_serve_request( $served, $result, $request, $server ) {
// assumes 'format' was passed into the intial API route
// example: https://baconipsum.com/wp-json/baconipsum/test-response?format=text
@macbre
macbre / docker-compose.yml
Created May 1, 2024 19:37 — forked from lfache/docker-compose.yml
Mattermost docker-compose.yml with Traefik
version: "3"
services:
db:
build: db
read_only: true
restart: unless-stopped
volumes:
- ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
@macbre
macbre / 2019-https-localhost.md
Created April 4, 2020 09:54 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@macbre
macbre / nginx-tls.conf
Created April 1, 2020 17:20 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
@macbre
macbre / slack_nagios.sh
Last active March 23, 2018 10:43 — forked from matt448/slack_nagios.sh
Script to post Nagios notifications into a Slack channel // SUS-4340
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@macbre
macbre / gist:f52aa0c19d8b046b278584a88585bb0d
Created November 25, 2017 19:04 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@macbre
macbre / tcpdump.txt
Created October 26, 2017 18:42 — forked from gstark/tcpdump.txt
Use tcpdump to monitor mysql
Use tcpdump to monitor mysql
# Capture the packets
sudo tcpdump -i eth0 port 3306 -s 65535 -x -n -q -tttt > tcpdump.out
# analyze all the requests from a given host
pt-query-digest --type=tcpdump --filter '($event->{host} || $event->{ip} || "") =~ m/192.168.248.64/' tcpdump.out
src/searchdha.cpp | 3 +++
src/sphinx.cpp | 4 ++--
src/sphinxstd.cpp | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/searchdha.cpp b/src/searchdha.cpp
index 27bc01e..2af933d 100644
--- a/src/searchdha.cpp
+++ b/src/searchdha.cpp
@@ -21,6 +21,9 @@
# php7-fpm - The PHP FastCGI Process Manager
# Original script by Ondřej Surý. Adapted to php7-fpm by @bjornjohansen
description "The PHP FastCGI Process Manager"
author "Ondřej Surý <[email protected]>"
start on runlevel [2345]
stop on runlevel [016]
# Precise upstart does not support reload signal, and thus rejects the