Skip to content

Instantly share code, notes, and snippets.

View alfredodeza's full-sized avatar
:octocat:

Alfredo Deza alfredodeza

:octocat:
View GitHub Profile
@alfredodeza
alfredodeza / decrypt_jenkins.rst
Created November 16, 2017 15:27
decrypt jenkins secret from xml

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
alfredodeza / prepare.sh
Created March 21, 2017 15:22
Customize a (rhel/centos) qcow2 image so that it can be used with Vagrant
#!/bin/bash -x
# Setup hostname vagrant-something.
FQDN="vagrant-rhel7"
if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then
sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network
else
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
fi
@alfredodeza
alfredodeza / process.sh
Created March 21, 2017 15:22
Process a qcow2 image so that it can be customized as a vagrant box (meant for rhel images mostly)
#!/bin/bash
# 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 `create_box.sh` script
# from the vagrant-libvirt project::
#
# https://github.com/vagrant-libvirt/vagrant-libvirt/blob/master/tools/create_box.sh
#
# Usage:
#
# bash process.sh rhel-guest-image-7.4-10.x86_64.qcow2 rhel7.qcow2
@alfredodeza
alfredodeza / dosini.vim
Created January 12, 2017 21:22
Syntax file for tox.ini
" 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
alfredodeza / generate.sh
Created July 14, 2016 18:56
Generate a self signed cert (spits out an ssl.key and ssl.cert) in one go
#!/bin/bash
# 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
@alfredodeza
alfredodeza / prepare-commit-msg
Last active October 13, 2021 10:39
Append a "Resolves: {tracker}#{ticket-id}" to commit messages based on branch names
#!/usr/bin/python
"""
This is a prepare-commit-msg hook that fill append commit messages with::
Resolves: {TRACKER}#{TICKET-ID}
For example a RedHat BZ 0001 would look like::
Correct the syntax error
@alfredodeza
alfredodeza / gist:3f6ee551a7898d639ec7afd76f727e21
Created May 20, 2016 17:40
Install m2crypto on OSX 10.10
env LDFLAGS="-L$(brew --prefix openssl)/lib" \
CFLAGS="-I$(brew --prefix openssl)/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" \
pip install m2crypto
@alfredodeza
alfredodeza / enable_tether.rst
Created April 29, 2016 12:36
tethering enabled for Nexus 5x

Steps to enable tethering on Android 6.0 Marshmallow update

Step 1: Ensure you have the correct OEM drivers installed for your handset on the computer

Step 2: Download and install the necessary ADB drivers (v1.4.2)

Step 3: Enable USB debugging on your Android handset:

Go to Settings > About Device, and tap the build number 7 times or until you see 'You're now a developer' message. Return to Settings > Developer options and use the toggle button to turn on USB debugging. Then tap OK button to accept the warning and continue.

@alfredodeza
alfredodeza / main.yml
Created April 28, 2016 12:07
ensure that the current `hostname` is defined in `/etc/hosts`
---
# Because not everything is correct in this world, we may end up with a host that doesn't have the reported
# hostname in the hosts file.
- name: ensure that the current host is in /etc/hosts. Yes this is a thing.
sudo: true
replace:
backup: yes
dest: /etc/hosts
regexp: '^(127\.0\.1\.1(?!.*\b{{ ansible_hostname }}\b).*)$'
@alfredodeza
alfredodeza / mp4togif.sh
Created March 16, 2016 11:40
convert an mp4 to a gif
mp4=$1
DEFAULT_GIF_NAME="output.gif"
OUTPUT=${2:-$DEFAULT_GIF_NAME}
# -delay is used to control the timing between frames, the scale sets the resolution
ffmpeg -i $mp4 -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 10 -loop 0 - $OUTPUT