Skip to content

Instantly share code, notes, and snippets.

@MOZGIII
MOZGIII / docker-compose.yml
Created March 11, 2018 18:39
docker-compose nested values sample
version: '3.5'
x-env: &env-common
COMMON_VALUE: "my-common-value"
x-service: &service-common
network_mode: host
environment:
<<: *env-common
@MOZGIII
MOZGIII / policies.json
Created March 11, 2018 16:39
Terraform S3 backend IAM policies
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "s3",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:DeleteItem",
"dynamodb:GetItem"
@MOZGIII
MOZGIII / run.sh
Created January 2, 2018 01:07
iSCSI backport
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial python-rtslib-fb
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial python-configshell-fb
backportpackage -u ppa:mozgiii/iscsi -s bionic -d xenial targetcli-fb
@MOZGIII
MOZGIII / per_device_routing_tables.sh
Last active November 24, 2017 03:29
Multiple routing tables (per interface) table with NetworkManager
#!/bin/sh
# Run
# chown root:root per_device_routing_tables.sh
# chmod 700 per_device_routing_tables.sh
#
# or NM will refuse to run the script.
# Then move the script to /etc/NetworkManager/dispatcher.d
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
@MOZGIII
MOZGIII / kubeadm-cgroups-config.md
Last active November 19, 2017 04:30
Kubernetes Pro Tips (Free!)

Here's how to make sure docker and kubelet use same cgroups driver by explicitly configuring both:

Docker:

$ cat /etc/docker/daemon.json
{
    "exec-opts": ["native.cgroupdriver=cgroupfs"]
}
@MOZGIII
MOZGIII / debain-installer-armhf-pxe-boot
Last active October 1, 2017 16:16
Running debian installer via PXE boot (on cubox-i, but may help you on other platforms)
run findfdt
run bootcmd_dhcp
@MOZGIII
MOZGIII / extend.sh
Last active September 24, 2016 19:27
CAC disk size extension
#!/bin/bash
pvcreate /dev/sda3
vgextend localhost-vg /dev/sda3
lvextend /dev/localhost-vg/root -l +100%FREE
resize2fs /dev/mapper/localhost--vg-root
@MOZGIII
MOZGIII / gitlab.rb
Created June 26, 2016 17:34
Gitlab configuration in custom file
# ...
def load_file(file); eval(File.read(file), binding, file); end
load_file '/etc/gitlab/gitlab-custom.rb'
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
ENV["BUNDLE_IGNORE_CONFIG"] = 'true'
install_only = ARGV.to_a.map(&:to_sym)
install_only = [:host] if install_only.empty?
require 'bundler'
Bundler.configure
@MOZGIII
MOZGIII / twitch
Last active August 29, 2015 14:27
A tiny wrapper for livestreamer to watch twitch streams
#!/usr/bin/env python3
import sys
import os
if len(sys.argv) < 2:
print("Usage: %s [stream_name | http://stream_url]" % sys.argv[0])
sys.exit(2)
stream_url = sys.argv[1]
if not stream_url.startswith('http://') and not stream_url.startswith('https://'):