Skip to content

Instantly share code, notes, and snippets.


Alfredo Deza alfredodeza

View GitHub Profile
alfredodeza /
Last active Jan 16, 2022
Remote k8s with docker-desktop using an SSH tunnel

Remote Kubernetes using SSH

My setup is using a Macmini with Docker for Desktop installed and with the Kubernetes option enabled. The main objective of the setup: use kubectl directly without any additional flags from my local computer, accessing/interacting the remote k8s instance

Ensure SSH is setup with key-based authentication

Copy public key to the remote authorized_keys file

cat ~/.ssh/ | ssh admin@macmini-server 'umask 0077; mkdir -p .ssh; cat >> .ssh/authorized_keys'
alfredodeza /
Created Jul 12, 2021
OSX fixing missing cmake executable
# Install cmake with homebrew, which prevents:
# AssertionError: Could not find "cmake" executable!
brew install cmake
# and then install protobuf which fixes:
# CMake Error at CMakeLists.txt:292 (message):
# Protobuf compiler not found
# Call Stack (most recent call first):
# CMakeLists.txt:323 (relative_protobuf_generate_cpp)
brew install protobuf
alfredodeza / Vagrantfile
Created Feb 26, 2020
Handy vagrantfile for local VMs with some custom IP/CPU/ram mappings
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.define 'node1' do |node1| = "ceph/ubuntu-bionic" :private_network, :ip => ""
View gist:f1ead105ba06e6c7ae24ddf2312849d3
$ minishift start --show-libmachine-logs -v5
-- minishift version: v1.30.0+186b034
-- Starting profile 'minishift'
Found binary path at /usr/local/bin/docker-machine-driver-xhyve
Launching plugin server for driver xhyve
Plugin server listening at address
() DBG | operation not supported by device
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
alfredodeza /
Created Apr 23, 2018
read an itermcolors export file and spit out Vim 8's ansi color var
#!/usr/bin/env python
# Convert .itermcolors files to hex colors
import sys
import xml.etree.ElementTree as ET
def rgb_to_hex(rgb):
return '#%02x%02x%02x' % rgb
alfredodeza / decrypt_jenkins.rst
Created Nov 16, 2017
decrypt jenkins secret from xml
View decrypt_jenkins.rst

Open your Jenkins' installation's script console by visiting http(s)://${JENKINS_ADDRESS}/script.

There, execute the following Groovy script:

println( hudson.util.Secret.decrypt("${ENCRYPTED_PASSPHRASE_OR_PASSWORD}") )

where ${ENCRYPTED_PASSPHRASE_OR_PASSWORD} is the encrypted content of the <password> or <passphrase> XML element that you are looking for.

alfredodeza /
Created Mar 21, 2017
Customize a (rhel/centos) qcow2 image so that it can be used with Vagrant
#!/bin/bash -x
# Setup hostname vagrant-something.
if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then
sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
alfredodeza /
Created Mar 21, 2017
Process a qcow2 image so that it can be customized as a vagrant box (meant for rhel images mostly)
# The input is a qcow2 image, that gets copied via virt-customize so that it
# can be modified to work as a vagrant box. It requires the `` script
# from the vagrant-libvirt project::
# Usage:
# bash rhel-guest-image-7.4-10.x86_64.qcow2 rhel7.qcow2
alfredodeza / dosini.vim
Created Jan 12, 2017
Syntax file for tox.ini
View dosini.vim
" Vim syntax file
" Language: Configuration File (ini file) for Python's tox
" Version: 0.1
" Original Author: Alfredo Deza
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
alfredodeza /
Created Jul 14, 2016
Generate a self signed cert (spits out an ssl.key and ssl.cert) in one go
# Easily generate a 10 year SSL certificate and key for development. It
# creates a configuration file for wild card domains, if no argument is passed
# in will fallback to "node.a" as the domain to use.
# Upon completion, these files should now exist::
# * openssl.cnf
# * ssl.key
# * ssl.crt