Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / Plugins.md
Created November 13, 2015 09:11 — forked from derekstavis/Plugins.md

Oh My Fish Plugins

ansible: Ansible development package for Oh My Fish

apt: Short and friendly command wrapper for APT

battery: OS X and Linux compatible battery utilities

brew: Oh My Fish plugin to integrate Homebrew paths into shell.

@epcim
epcim / gist:7dd20a2e6c62bbe6a9fe
Created December 1, 2015 19:58 — forked from seungjin/gist:1546284
zabbix api connection
#curl -i -X POST -H 'Content-Type: application/json' -d '{"params": {"password": "mypassword", "user": "myuser"}, "jsonrpc": "2.0", "method": "user.authenticate"}' http://0.0.0.0/zabbix/api_jsonrpc.php
require 'net/http'
require 'json'
def post
host = '0.0.0.0'
port = '80'
@epcim
epcim / handler-ntpd-restart.sh
Created February 8, 2016 15:12 — forked from vkhatri/handler-ntpd-restart.sh
consul event ntpd service restart
response=$(cat -)
payload=$(echo $response | sed -e 's/^.*"Payload":"\([^"]*\)".*$/\1/')
# action string "runme" == byte "cnVubWU=" , replace "runme" with your payload data
if [ "$payload" == "cnVubWU=" ]; then
logger restarting ntpd, consul triggered by payload $payload
# /usr/bin/sudo /sbin/service ntpd restart
else
logger skipping ntpd restart, consul triggered by payload $payload
fi
@epcim
epcim / certgen.rb
Last active April 22, 2016 12:25 — forked from sheerun/certgen.rb
Docker TLS certificate generator
#!/usr/bin/env ruby
# Generates necessary certificates to ~/.docker
#
# Prereq:
# bundle install
# OR
# gem install certificate_authority
# gem install fileutils
# Usage:
# ruby certgen.rb <domain>
@epcim
epcim / create-multi-host-swarm-digitalocean.sh
Created April 26, 2016 19:58 — forked from jmshal/create-multi-host-swarm-digitalocean.sh
Setup a Docker Swarm multi-host cluster on DigitalOcean
docker-machine create \
--driver=digitalocean \
--digitalocean-access-token=$DO_TOKEN \
--digitalocean-size=512mb \
--digitalocean-region=nyc3 \
--digitalocean-private-networking=true \
--digitalocean-image=ubuntu-15-04-x64 \
docker-swarm-kv-store
docker $(docker-machine config docker-swarm-kv-store) run -d \
@epcim
epcim / var-file-subst.sh
Created June 14, 2016 05:23 — forked from caruccio/var-file-subst.sh
Shell variable substitution from within a file.
##
# Just found the amazing builtin 'mapfile', perfect
# for substitution variable inside a file by its values.
##
mateus@mateus:/tmp$ cat input.txt
a = $a
b = $b
mateus@mateus:/tmp$ echo a=$a, b=$b
a=1, b=2
@epcim
epcim / fabfile.py
Created June 14, 2016 21:16 — forked from tony/fabfile.py
Can saltstack states and modules play with pure python / fabric? https://github.com/saltstack/salt/issues/22842
# -*- coding: utf-8 -*-
"""Proof of concept to use saltstack's pure modules and states with fabric::
fab list_packages print_specs -H <ip> --user=<user>
On my vagrant environment:
fab list_packages print_specs -H <ip> --password=vagrant --user=vagrant
"""
@epcim
epcim / clexec.py
Created June 16, 2016 15:48 — forked from fpytloun/clexec.py
Cluster execution tool
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tool for commands execution over clusters
"""
import os, sys, logging, urllib
import argparse
import threading
With Release 3.0, contrail-heat resources/templates are being auto-generated from the Schema.
The generated resources/templates are part of the python-contrail package and located in
/usr/lib/python2.7/dist-packages/vnc_api/gen/heat/ directory. This directory has three sub-directories
1. resources/
This sub-directory contains all the resources for the contrail-heat plugin. It runs in the context
of the heat-engine service.
2. templates/
This sub-directory contains template for each resource. They are sample templates with every possible
@epcim
epcim / tmux.md
Created November 12, 2016 17:09 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a