Skip to content

Instantly share code, notes, and snippets.

@scyto
scyto / npm-template.md
Last active May 2, 2024 22:21
Nginx Proxy Manager swarm template

Description

This template runs my experimental NPM service as part of evaluating if i should stop using my hand crafted nginx reverse proxy. Note change your passwords and don't use the examples bellow :-) )

State Considerations for SWARM

This container has a database, as such I store the data on the gluster volume. I am currenlty using a mount point to store the voume data on glusterfs. I restrict to 1 instance of each container to avoid database corruption from having two instances. Change example usernames and passwords as needed. leave hostname as db (name resolution works fine using the method)

<?php
namespace Drupal\drupalsouth\EventSubscriber;
namespace Drupal\drupalsouth\EventSubscriber;
use Drupal\alexa\AlexaEvent;
use Drupal\views\Views;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\Core\Entity\EntityTypeManager;
@aloyr
aloyr / svg-font-family-fix.js
Created January 31, 2020 23:16
use proper font family inside svgs
(function() {
document.querySelectorAll('svg tspan, svg text').forEach(e => {
var currentFont = e.getAttribute('font-family');
if (!currentFont) {
return;
}
currentFont = currentFont.replace(/'/g, '');
var modes = {
'Thin': 100,
'ExtraLight': 200,
@shanecowherd
shanecowherd / Unifi Controller Docker.md
Last active May 12, 2023 15:28
Install the Unifi Controller software in a Docker container on Mac.
@malcolmgreaves
malcolmgreaves / git-largest-files
Last active January 10, 2024 12:44 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Updated to use Python 3 by Malcolm Greaves.
#
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
@alexanderilyin
alexanderilyin / README.md
Created November 15, 2018 00:58
Auto-increment Minor Semantic Version using Docker Hub API v2

For example your latest image with semantic versioning looks like this:

${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:v1.20.0

Example provided above will do the folowing:

  1. Generate token using your github username and password.
  2. Get list of all tags from repository.
@ismailyenigul
ismailyenigul / docker-traefik-label.txt
Last active May 30, 2023 04:46
docker labels for traefik reverse proxy multiple ports in a single container with different domain names
--label "traefik.enable=true" \
--label "traefik.protocol=http" \
--label "traefik.first.port=80" \
--label "traefik.first.frontend.rule=Host:web1.example.com" \
--label "traefik.second.port=8080" \
--label "traefik.second.frontend.rule=Host:web2.example.com" \
Above labels will allow us to forward web1.example.com to docker container port 80 and web2.example.com to same container's port 8080
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@keopx
keopx / settings.local.php
Last active March 25, 2024 12:22
Drupal 8 Redis settings.local.php
<?php
/**
* Set redis configuration.
*/
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
// $settings['cache']['default'] = 'cache.backend.redis';
@BretFisher
BretFisher / docker-for-mac.md
Last active May 7, 2024 08:34
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1