Skip to content

Instantly share code, notes, and snippets.

Avatar

José Riguera Lopez jriguera

View GitHub Profile
@jriguera
jriguera / anyconnect.sh
Created Sep 21, 2020
AnyConnect VPN up/down single command + service cleanup
View anyconnect.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
readonly _CISCO_VPN="/opt/cisco/anyconnect/bin/vpn"
readonly _GREEN='\033[0;32m'
readonly _RED='\033[0;31m'
readonly _NC='\033[0m'
@jriguera
jriguera / app_instance_identity_intro_to_envoy.md
Created Sep 21, 2020 — forked from nikhilsuvarna/app_instance_identity_intro_to_envoy.md
Application Instance Identity and Intro to Envoy in PCF
View app_instance_identity_intro_to_envoy.md
@jriguera
jriguera / delete-dockerhub-images.sh
Last active May 26, 2022
Delete Docker images on DockerHub
View delete-dockerhub-images.sh
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@jriguera
jriguera / list-dockerhub-images.sh
Last active Apr 12, 2017
Listing Docker images in DockerHub
View list-dockerhub-images.sh
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@jriguera
jriguera / cf_org.py
Created Oct 14, 2016
Ansibe cf organizations
View cf_org.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Program to create an ansible inventory from all the deployments, jobs and
instances managed by a BOSH Director.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@jriguera
jriguera / haproxy.cfg
Created Oct 10, 2016
Haproxy for Multimaster MySQL cluster
View haproxy.cfg
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
@jriguera
jriguera / segurity_group_rules.sh
Created Feb 24, 2016
Neutron cmd to add security group rules
View segurity_group_rules.sh
# Add Neutron security groups for ping and ssh
neutron security-group-rule-create \
--protocol icmp \
--direction ingress \
--remote-ip-prefix 0.0.0.0/0 \
default
neutron security-group-rule-create \
--protocol tcp \
@jriguera
jriguera / email_notify.py
Last active Jan 14, 2022
Email from Python with Jinja2
View email_notify.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python 3 and compatibility with Python 2
from __future__ import unicode_literals, print_function
import os
import sys
import re
import logging
@jriguera
jriguera / interfaces.cfg
Created Feb 3, 2016
Debian/Ubuntu interfaces with routing tables
View interfaces.cfg
auto bond0.502
# Static interface with an address, will be brought up directly on boot.
iface bond0.502 inet static
address 10.10.11.10
netmask 255.255.248.0
#gateway 10.10.8.1
vlan-raw-device bond0
post-up grep -q " live" /etc/iproute2/rt_tables || echo "202 live" >> /etc/iproute2/rt_tables
post-up ip rule add from 10.10.11.10 table live
post-up ip route add table live default via 10.10.8.1
@jriguera
jriguera / notify_slack_hipchat.sh
Created Jan 6, 2016
how to notify slack and hipchat
View notify_slack_hipchat.sh
# Define those variables according to hipchar of slack (in this case is for slack)
ROOM_ID="XXXXX"
ROOM_TOKEN="XXXXXX/XXXXXXX/XXXXXXXXXXXXXXXXXXXX"
notify_hipchat() {
local msg="[$(hostname)] microBOSH/CF $ENVIRONMET $BKPLEVEL backup $BKPSTATUS"
local notify="0"
[ "$STATUS" != "1" ] && notify="1"
curl -H "Content-type: application/json" \