Skip to content

Instantly share code, notes, and snippets.

Dani Comnea DanyC97

  • Synamedia
  • UK
Block or report user

Report or block DanyC97

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DanyC97
DanyC97 / Ansible CloudFormation Macros.md
Created Apr 17, 2019 — forked from jheller/Ansible CloudFormation Macros.md
Using Ansible/Jinja macros to generate CloudFormation templates
View Ansible CloudFormation Macros.md

Generating CloudFormation Templates from YAML Dictionaries

The security group and Network ACLs parts of CloudFormation templates can be difficult to read. This template containing Jinja macros converts easier-to-read YAML dictionaries of security group and NACL rules into JSON.

Here ais a generic macro template and some example files showing how to use it.

  • cloudformation.macros.j2 - the macros
  • cf_vars.yml - YAML dictionaly of security groups and NACLs, including some complex rules for both
  • test.template.j2 - a simple CloudFormation template that uses the macro file
  • cf_test.yml - a simple Ansible playbook that generates CloudFormation JSON from thr previous file.
@DanyC97
DanyC97 / iterm2.md
Created Sep 27, 2018 — forked from squarism/iterm2.md
iterm2 cheatsheet
View iterm2.md

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
@DanyC97
DanyC97 / README.md
Created Sep 24, 2018 — forked from kmassada/README.md
Vagrant and KVM(QEMU) on Centos7
View README.md

Libvirt

yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
@DanyC97
DanyC97 / README.md
Created Sep 18, 2018 — forked from magnetikonline/README.md
AWS CloudFormation YAML template - appending to list parameter types.
View README.md

AWS CloudFormation YAML template - appending to list parameter types

Documenting this here, as I often forget (what I have found) is the best way to do this at the moment.

For example, you have a list of two existing security groups given to a stack and wish to create (and use) a third - attaching all to an ALB:

AWSTemplateFormatVersion: "2010-09-09"
Description: "Example template"

Parameters:
@DanyC97
DanyC97 / ca.md
Created Aug 21, 2018 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

View GlusterFS-Deployment.yml
oc get po glusterblock-storage-provisioner-dc-1-864g5 -o yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
kubernetes.io/created-by: |
{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"glusterfs","name":"glusterblock-storage-provisioner-dc-1","uid":"4a94ebd4-4402-11e8-8ea9-005056a2d8cc","apiVersion":"v1","resourceVersion":"18370005"}}
openshift.io/deployment-config.latest-version: "1"
openshift.io/deployment-config.name: glusterblock-storage-provisioner-dc
openshift.io/deployment.name: glusterblock-storage-provisioner-dc-1
View Foo-SCC.yml
apiVersion: v1
kind: ServiceAccount
metadata:
name: foo-sa
namespace: foo
---
kind: SecurityContextConstraints
apiVersion: v1
metadata:
annotations:
@DanyC97
DanyC97 / .docker-alias.bash
Created Mar 21, 2018 — forked from jverdeyen/.docker-alias.bash
A set of docker aliases
View .docker-alias.bash
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
@DanyC97
DanyC97 / ansible-role-test.sh
Created Jan 8, 2018 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
View ansible-role-test.sh
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)
View vm_hw_version.py
#!/usr/bin/python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim
import ssl
import atexit
if __name__ == '__main__':
# 接続情報
host = 'vCenter IP or Host Name'
username = 'administrator@vsphere.local'
You can’t perform that action at this time.