Skip to content

Instantly share code, notes, and snippets.

@xiii
xiii / ruby-yaml-validate.sh
Last active April 20, 2020 06:10
Validate YAML in ruby - useful for hiera
#!/bin/bash
#
# Efstathios Xagoraris <sxagoraris@gmail.com>
# Validate YAML files using ruby
#
if [ $# -eq 0 ]
then
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please provide an ERB file as argument eg $0 file.erb"
exit 1
fi
erb -P -x -T '-' $1 | ruby -c
@xiii
xiii / gist:a399eb7ad82965544f40
Created April 29, 2014 23:37
Sample Vagrantfile version 2 for AWS
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.pty = true
config.vm.box_url = 'https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box'
config.vm.define "puppetmaster" do |zzz|
zzz.vm.box = "dummy"
zzz.vm.provider :aws do |aws, override|
@xiii
xiii / gist:175bf2e72664e9fad2a8
Created March 15, 2016 13:58
docker quickstart terminal
#!/bin/bash
VM=default
DOCKER_MACHINE=/usr/local/bin/docker-machine
VBOXMANAGE=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m'
@xiii
xiii / gist:2583ba17d3f105ecd6f7d74a7ae4849a
Created January 3, 2017 13:50
debug output from terraform plan
2017/01/03 13:46:41 [ERROR] root: eval: *terraform.EvalRefresh, err: postgresql_role.odin: Error reading role: pq: column "rolbypassrls" does not exist
2017/01/03 13:46:41 [ERROR] root: eval: *terraform.EvalSequence, err: postgresql_role.odin: Error reading role: pq: column "rolbypassrls" does not exist
2017/01/03 13:46:41 [ERROR] root: eval: *terraform.EvalOpFilter, err: postgresql_role.odin: Error reading role: pq: column "rolbypassrls" does not exist
@xiii
xiii / runGroovyRemote.sh
Created April 5, 2017 11:00
Post a groovy script to Jenkins
#
# Posts plugins.groovy to JENKINS_ENDPOINT and returns output
#
curl -s --data-urlencode "script=$(<./plugins.groovy)" JENKINS_ENDPOINT/scriptText
@xiii
xiii / gist:b29bd784d1e333144e249be0b3967f03
Created April 19, 2017 09:09
Shell function to update slack status
#
# I have this in my .zshrc and I call it from the terminal. Make sure you replace the SLACK_TOKEN part.
# $ slack-status afk train
#
function slack-status {
local SLACK_TOKEN=""
local STATUS=${1:-""}
@xiii
xiii / keybase.md
Last active August 7, 2017 11:01
Keybase

Keybase proof

I hereby claim:

  • I am xiii on github.
  • I am sxagoraris (https://keybase.io/sxagoraris) on keybase.
  • I have a public key ASCKvolwY3cWENSaAFV8Xuz2OAbMa7BcPFsVEnXxB4xD_Ao

To claim this, I am signing this object:

@xiii
xiii / efstxago.zsh-theme
Created January 21, 2018 16:04
efstxago zsh theme
# ZSH
# Uncomment the PROMPT you fancy. This is mainly a prompt for users switching between python/ruby venvs/ruby versions
# download the file here $HOME/.oh-my-zsh/themes
# [p3.6/r2.3.1] infra/pewpew-infra (master*) $
#PROMPT='[p$(basename $VIRTUAL_ENV)/r$RUBY_VERSION] %{$fg[green]%}%2~%{$reset_color%}$(git_prompt_info) %(!.#.$) '
# p3.6|r2.3.1|/h/e/i/i/pewpew-infra|master*$
#PROMPT='p$(basename $VIRTUAL_ENV)|r$RUBY_VERSION|%{$fg[green]%}$(echo "${PWD%/*}" | sed -e "s;\(/.\)[^/]*;\1;g")/${PWD##*/}%{$reset_color%}%{$fg[green]%}%{$reset_color%}$(git_prompt_info)%(!.#.$)'
#
# Curl with report
#
get () {
curl -w "\
response_code: %{response_code}\n\
time_namelookup: %{time_namelookup}\n\
time_connect: %{time_connect}\n\