Skip to content

Instantly share code, notes, and snippets.

@chx
chx / PauseRedirectRequestSubscriber.php
Created September 17, 2022 20:14
Pause redirect module
<?php
namespace Drupal\pause_redirect\EventSubscriber;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\pause_redirect\Form\PauseRedirectSettingsForm;
use Drupal\redirect\EventSubscriber\RedirectRequestSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\RequestEvent;
#!/usr/bin/env rc
# Assume all packages given are already installed
if(test $#* -lt 2) exit 1
module=$1
shift
for(pkg in $*) {
# Get all go binaries by checking for 'Go BuildID='
for(bin in `{apk info -q -L $pkg \
| grep -v '^usr/share' \
@andypost
andypost / Makefile
Created September 1, 2021 13:18
Alpinelinux docker CI images for each arch
.PHONY: run
all: x86_64
IMAGE_ALP=alpinelinux/alpine-gitlab-ci:latest-
builder = docker run --rm -it --network host \
--cap-add=SYS_PTRACE --privileged \
--platform=linux/$(or ${2}, ${1}) \
-v $(shell pwd):/mnt -e APORTSDIR=/mnt -w /mnt \
@andypost
andypost / docker-compose.yaml
Last active August 8, 2022 05:49
Drupal 8 template for core dev + chromium
version: "2.1"
services:
php:
image: skilldlabs/php:8-fpm
container_name: core8
restart: always
working_dir: /var/www/html/web
volumes:
@LionsAd
LionsAd / CFAwareApcuBackend.php
Last active November 21, 2018 20:37
CFAwareApcuBackend -- ChainedFastAware APCu Cache backend
<?php
namespace Drupal\Core\Cache;
use Drupal\Component\Assertion\Inspector;
/**
* Stores cache items in the Alternative PHP Cache User Cache (APCu).
*/
class CFAwareApcuBackend extends ApcuBackend {
@andypost
andypost / Makefile
Last active December 17, 2023 18:43
drupal 10 core contributor docker kickstarter
.PHONY: up upx log down exec exec0 h t
CUID := $(shell id -u)
CGID := $(shell id -g)
IMAGEPHP := skilldlabs/php:8
all: | exec
up:
docker run --rm --name core9 \
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@zviryatko
zviryatko / README.md
Last active July 22, 2021 10:40
Nginx config to catch all .devel sites

This little gist help you to catch all *.devel domain and open localhost for it.

First you need to set up local DNS server and add it to resolv conf.

sudo apt-get install bind9 dnsutils resolvconf

bind9 - DNS server

resolvconf - help you to manage you /etc/resolv.conf file automatically independs on network configuration

@andypost
andypost / .gitconfig
Last active December 21, 2021 10:42
My git config
[color]
ui = auto
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[core]
whitespace=fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol