Skip to content

Instantly share code, notes, and snippets.

@scmrus
scmrus / docker-compose.base.yml
Created July 9, 2024 15:40 — forked from dimastbk/docker-compose.base.yml
traefik + portainer for docker swarm (and simple app with nginx)
version: "3.8"
services:
traefik:
image: traefik:v2.4.9
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
ports:
@scmrus
scmrus / traefik-compose.yml
Created July 9, 2024 15:38 — forked from Bmohsen/traefik-compose.yml
Traefik Compose file with http to https redirect enabled for all the routes for docker Swarm
version: "3.9"
services:
traefik:
# Use the latest v3.0.x Traefik image available
image: traefik:v3.0
ports:
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS
- target: 80
published: 80
@scmrus
scmrus / get-public-ip.md
Created December 2, 2022 16:22 — forked from rkalkani/get-public-ip.md
Get public IP address used by your machine to connect to the internet

Get Public IP

DNS

Google

dig o-o.myaddr.l.google.com txt @ns1.google.com +short
# OR
nslookup -type=txt o-o.myaddr.l.google.com ns1.google.com
@scmrus
scmrus / install-docker.md
Created March 8, 2021 01:26 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@scmrus
scmrus / schematest.php
Created January 24, 2020 20:14 — forked from hakre/schematest.php
Speeding up XML schema validations of a batch of XML files against the same XML schema (XSD)
<?php
/**
* @link http://stackoverflow.com/questions/13865149/speeding-up-xml-schema-validations-of-a-batch-of-xml-files-against-the-same-xml
*/
$mapping = [
'http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd' => 'schema/xhtml1-transitional.xsd',
'http://www.w3.org/2001/xml.xsd' => 'schema/xml.xsd',
];
@scmrus
scmrus / post-checkout
Created July 1, 2019 15:10 — forked from betorobson/post-checkout
git hook to run a command after `git pull` and `git checkout` if a specified file was change for example, package.json or bower.json
#!/usr/bin/env bash
# fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run package.json "npm prune && npm install"
@scmrus
scmrus / kubectl.md
Last active June 5, 2018 19:00 — forked from Baargav/kubectl.md
kubectl
@scmrus
scmrus / gcrgc.sh
Created March 4, 2018 17:26 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@scmrus
scmrus / debug_recipes.txt
Created August 8, 2017 07:28 — forked from tadas-s/debug_recipes.txt
Debug recipes for Linux
# Quick debug network traffic between nginx and php-fpm
# Got from:
# http://systembash.com/content/simple-sysadmin-trick-using-tcpdump-to-sniff-web-server-traffic/
# Just a flow of everything looking like a string
tcpdump -nl -w - -i eth0 -c 500 port 9090 | strings
# Request heads
sudo tcpdump -nl -w - -i eth0 -c 500 port 9090 | strings | grep -E -A5 "^(GET|PUT|POST) "
# strace processes/sub-processes
@scmrus
scmrus / docker-compose-coreos.sh
Last active April 7, 2017 07:21 — forked from sourcec0de/docker-compose-coreos.sh
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` >/opt/bin/docker-compose
chmod +x /opt/bin/docker-compose