Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@smoser
smoser / README.md
Last active November 28, 2018 15:56
maas dump image status: this is a very basic maas client that shows what images a maas has. Possibly useful as a start for other single purpose clients or a generic one.

maas-dump-image-status

This is a simple python client that shows succinct information on boot resources that you have available in your maas.

It uses the same login credenitals that the maas cli uses, and depends on that being set up.

The data output is is space delimited os/release, arch/subarch, build_serial, label, synced.

Usage

$ maas list

admin http://192.168.1.2/MAAS/api/1.0/ ABCDEFG:abcdefg:12345afjd

@rponte
rponte / get-latest-tag-on-git.sh
Last active December 9, 2024 00:27
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@gionn
gionn / tf_ssh_config_gen.rb
Last active December 18, 2018 17:34
Quick script to generate an ssh_config after a terraform apply on OpenStack, GCE, DigitalOcean
#!/usr/bin/env ruby
# NOTICE: GCE and OpenStack providers only.
require 'json'
require 'erb'
def get_template()
%{
<% hosts.each do |key, entry| %>
Host <%= key %>
@angstwad
angstwad / dict_merge.py
Last active December 22, 2024 16:02
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
@whiteinge
whiteinge / process_status_updates.sls
Last active October 3, 2021 21:49
POC for writing status updates to a sqlite db. Updates are written using an Orchestrate file. The Orchestrate file can be called via the Reactor.
{# Place this file in /srv/reactor/process_status_updates.sls
Call via sending a custom event on a minion as:
salt-call event.send myco/external_task/status_update task=foo status='Update number one!'
Requires reactor config such as:
reactor:
- 'myco/external_task/status_update':
- /srv/reactor/process_status_updates.sls
@ajayhn
ajayhn / contrail-all-in-one-in-vm.md
Last active November 18, 2016 10:01
contrail-all-in-one-in-vm
Following steps are needed in a VM environment for contrail all-in-one (assuming trusty r201)
sudo apt-get –y install curl
prep right hostname without this fab get_all_time fails
echo "127.0.0.1 $(hostname)" >>  /etc/hosts
prep keys WARNING do not do this if there is already id_rsa key.
@vsouza
vsouza / .bashrc
Last active April 20, 2025 21:15
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@matthieuprat
matthieuprat / git-rsync
Last active August 18, 2021 05:01
Sync a local Git work tree with a remote one
#!/bin/sh
#
# Author: Matthieu Prat <[email protected]>
# Date: 01/22/2015
#
# Sync a local work tree with a remote one.
# It's rsync on steroids within large Git repositories.
USAGE='<repository>'
LONG_USAGE='Sync a local work tree with a remote one.'
@edouard-lopez
edouard-lopez / libsass-install.bash
Last active October 17, 2019 17:17
Installing/Compiling libsass and sassc on Ubuntu 14.04+/Linux Mint 17+ (needed by node-sass)
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools
# Install dependencies
apt-get install automake libtool
# Fetch sources
git clone https://github.com/sass/libsass.git
git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
@maximilien
maximilien / tar_helper.go
Created October 31, 2014 16:53
Creating tarball in Golang
package tar_helper
import (
"archive/tar"
"compress/gzip"
"errors"
"fmt"
"io"
"io/ioutil"
"os"