Skip to content

Instantly share code, notes, and snippets.

@r7vme
r7vme / monitor.sh
Created February 2, 2017 20:58
Script to switch between high and low dpi displays
#!/bin/bash
LAPTOP_DISP="eDP-1"
LAPTOP_DISP_DPI=120
# Get first active display
EXTERN_DISP=$(xrandr -q | grep ' connected' | cut -f1 -d' ' | grep -v $LAPTOP_DISP | tail -1)
EXTERN_DISP_DPI=96
if [ $EXTERN_DISP ]; then
@r7vme
r7vme / collect_info_script.sh
Last active February 10, 2017 13:23
Script to collect configuration from OpenStack nodes (Only for Fuel 9.X+)
#!/bin/bash
# This script used to gather info about cloud. You should provide gathered info to support team.
INFO_PATH=nodes_info
CLEAN_DIR=true
NODES_ADDRESSES=$(fuel node|awk -F'|' '$2~/ready/ && $9~/1/ {gsub(/[ \\t]+/, "", $5); print $5;}')
if [ -d "${INFO_PATH}" ]; then
echo "Deleting old info from ${INFO_PATH} directory..."
rm -rf ${INFO_PATH}
fi
#!/bin/bash
NODE_NAME=$(hostname -f)
FORMULA_PATH=/usr/share/salt-formulas
FORMULA_BRANCH=master
# Sanity checks
test -d /srv/salt/reclass || (echo "Please put relass model in /srv/salt/reclass"; exit 1)
# Redirect all outputs
#!/bin/bash
NODE_NAME=$(hostname -f)
CONFIG_HOST=10.8.0.4
echo "Preparing base OS ..."
which wget >/dev/null || (apt-get update; apt-get install -y wget)
echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ xenial main security extra tcp tcp-salt" > /etc/apt/sources.list
@r7vme
r7vme / blueprint-matchbox-machine-list.md
Last active April 19, 2017 16:14
blueprint-matchbox-machine-list.md

Matchbox machine registry

TBD

Problem description

Currenly Matchbox doesn't provide any machine discovery mechanism. Matchbox operators should manually create groups with appropriate mac address selectors.

[Unit]
Description=DataDog monitoring agent
After=network.target
[Service]
ExecStart=/root/.datadog-agent/bin/agent
[Install]
WantedBy=default.target

Keybase proof

I hereby claim:

  • I am r7vme on github.
  • I am r7vme (https://keybase.io/r7vme) on keybase.
  • I have a public key whose fingerprint is 2EA9 731D DF60 0EF5 2A53 AD48 2A56 2388 20F5 F22E

To claim this, I am signing this object:

@r7vme
r7vme / haproxy.service
Last active June 16, 2017 07:09
systemd unit for haproxy running in docker container
[Unit]
Description=Haproxy container
After=docker.service
Requires=docker.service
ConditionFileNotEmpty=/etc/haproxy/haproxy.cfg
[Service]
TimeoutStartSec=0
Restart=always
Environment=CONFIG_DIR=/etc/haproxy
@r7vme
r7vme / gist:bcba3380fd33694906c4f63faa607e41
Created August 7, 2017 20:40
etcd v3 dump restore keys
#!/bin/bash
# Script to restore keys to etcd
#
# To dump keys use:
# etcdctl get "" --prefix=true > kv
etcdctl="ETCDCTL_API=3 etcdctl --endpoints=http://127.0.0.1:2379"
# Input filename
F=${1:-'kv'}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: nginx-for-ingress-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: nginx