Skip to content

Instantly share code, notes, and snippets.

@ju2wheels
ju2wheels / my_action_plugin.py
Created February 9, 2018 15:09
Ansible 2.4 Action Plugin Template
# For a high level over see video at https://www.ansible.com/blog/how-to-extend-ansible-through-plugins
# Standard base includes and define this as a metaclass of type
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
# Important contants
from ansible import constants as C
# Common error handlers
from ansible.errors import AnsibleError
@ju2wheels
ju2wheels / my_module.py
Last active June 9, 2018 01:51
Ansible 2.4 Custom Module Template
#!/usr/bin/python
# Copyright (c) 2018 Julio Lajara
# Copyright (c) 2017 Ansible Project
# GNU General Public License v2.0 (see COPYING or https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
# Last Updated: 02/05/2018 Ansible Version: 2.4
#
# All modules must have the following sections defined in this order:
#
# 1. Copyright (When adding a copyright line after completing a significant feature or rewrite, add the newer line above
@ju2wheels
ju2wheels / Dockerfile
Last active August 26, 2024 11:36
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
@ju2wheels
ju2wheels / docker-compose.yml
Created June 10, 2015 20:11
docker-compose reference YAML file with comments
# https://docs.docker.com/compose/yml/
# Each service defined in docker-compose.yml must specify exactly one of
# image or build. Other keys are optional, and are analogous to their
# docker run command-line counterparts.
#
# As with docker run, options specified in the Dockerfile (e.g., CMD,
# EXPOSE, VOLUME, ENV) are respected by default - you don't need to
# specify them again in docker-compose.yml.
#
service_name:
@ju2wheels
ju2wheels / package.json
Created June 4, 2015 03:49
npm package.json template for quickly creating a Node.js package with all options visible at a glance with comments
{
// WARNING: This file needs to be pure JSON, be sure to remove all comments
//
//====================================
// The "author" is one person. A "person" is an object with a "name" field and optionally
// "url" and "email" (both email and url are optional).
//
// This field can also be shortened to a single string that npm will parse.
//
//"author": "FirstName LastName <[email protected]> (http://www.company.com)",
@ju2wheels
ju2wheels / template.gemspec
Last active August 29, 2015 14:21
Rubygems gemspec template
#!/usr/bin/env gem build
# -*- coding: utf-8 -*-
module Gem::Specification::SpecificationHelpers
def self.find_executables(executable_dir = 'bin', options = {})
raise ArgumentError, "options must be a Hash" unless options.kind_of?(Hash)
exclude_executables = options['exclude_executables'] || []
executable_files = []
@ju2wheels
ju2wheels / setup.py
Last active August 29, 2015 14:21
Python 2.6 or greater setuptools template
"""
Python setup.py setuptools template for Python 2.6 or greater.
Python Packaging Guide: https://packaging.python.org/en/latest/index.html
"""
# pylint: disable=line-too-long
from __future__ import print_function
import os
@ju2wheels
ju2wheels / winrm_quickconfig_test.bat
Created February 16, 2015 18:42
WinRM QuickConfig post install script
powershell -command "& {set-executionpolicy -force unrestricted; $wget = New-Object System.Net.WebClient; New-Item -ItemType directory -Path 'c:/post_install'; $wget.DownloadFile('https://gist.githubusercontent.com/ju2wheels/6c231004f09ef232ea73/raw/4bd93da9f3db3700721583a9bbf015b452d8c941/winrm_quickconfig_test.ps1','c:/post_install/post_install.ps1'); c:\post_install\post_install.ps1}"
@ju2wheels
ju2wheels / sl_prod_pkg_list.rb
Last active August 29, 2015 14:08
SoftLayer Product Package Listing
require 'softlayer_api'
sl_client = SoftLayer::Client.new(:api_key => ENV["SL_API_KEY"], :username => ENV["SL_API_USERNAME"], :timeout => 240)
pkgs = [SoftLayer::ProductPackage.bare_metal_instance_package(sl_client),SoftLayer::ProductPackage.virtual_server_package(sl_client),SoftLayer::ProductPackage.additional_products_package(sl_client)].concat(SoftLayer::ProductPackage.bare_metal_server_packages(sl_client))
File.open("/tmp/sl_product_package_catagories.txt", "w") do |fout|
pkgs.each do |pkg|
fout.write "================#{pkg.name}===================\n"
pkg.categories.each do |item_cat|
fout.write "#{item_cat.categoryCode}\n"