Skip to content

Instantly share code, notes, and snippets.

@op-ct
op-ct / catalog_dump_from_spec_test.rb
Last active January 13, 2016 10:04 — forked from spiette/gist:5280394
Dumping the catalog from within a Puppet spec test
# WARNING: massive screen scroll
$stdout.puts self.catalogue.to_yaml
# Save to file
File.open( '_catalog.yaml', 'w'){ |f| f.puts self.catalogue.to_yaml }
@op-ct
op-ct / 0_reuse_code.js
Created October 21, 2015 00:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@op-ct
op-ct / install-gradle-centos.sh
Last active February 17, 2016 23:23 — forked from parzonka/install-gradle-centos.sh
Install gradle on redhat/centos linux
# Originally from:
# https://gist.github.com/parzonka/9371885
# ------------------------------------------------------------------------------
# - required packages: unzip, java
# - installs to /opt/gradle
# - existing versions are not overwritten/deleted
# - seamless upgrades/downgrades
# - $GRADLE_HOME points to latest *installed* (not released)
# ------------------------------------------------------------------------------
#!/usr/bin/env ruby
verbose = ARGV[0] == '-v'
def colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
def red(text); colorize(text, 31); end
def green(text); colorize(text, 32); end
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
require 'em-ssh'
require 'amqp'
EM.run do
Signal.trap("INT") do
EM.stop
@op-ct
op-ct / gerrit_munge.rb
Created November 18, 2016 20:21 — forked from trevor-vaughan/gerrit_munge.rb
Script for Importing things from GitHub into GerritHub
#!/usr/bin/env ruby
require 'json'
require 'yaml'
require 'tmpdir'
# Your GitHub Username
USERNAME='trevor-vaughan'
gerrit_url = %(ssh://#{USERNAME}@review.gerrithub.io:29418/)
@op-ct
op-ct / Vagrantfile
Created July 30, 2017 19:13 — forked from tknerr/Vagrantfile
Sample Vagrantfile that works with all providers (virtualbox, aws, managed) and in combination with the vagrant-omnibus plugin
#
# Vagrantfile for testing
#
Vagrant::configure("2") do |config|
# the Chef version to use
config.omnibus.chef_version = "11.4.4"
def configure_vbox_provider(config, name, ip, memory = 384)
config.vm.provider :virtualbox do |vbox, override|
@op-ct
op-ct / manual_code_deploy.sh
Created August 7, 2017 14:08 — forked from natemccurdy/manual_code_deploy.sh
Manually trigger code-manager and file-sync
#!/bin/bash
# GIST_URL: https://gist.github.com/natemccurdy/797fa9128b7eef1f07be
# This script can be run to manually trigger Code Manager to deploy code from your control-repo. This sort of
# thing is neccesary when, for example:
# - You've turned on Code Manager but have not yet made an RBAC token.
# - You want to pull down the latest version of a Puppetfile module without pushing to your GMS.
# - Something has broken the post-receive hook on your GMS that would've triggered Code Manager.
# - Syntax errors in your Puppetfile prevent you from retrieving those fixes to that Puppetfile.
# - Puppetserver has crashed due to file-sync issues between code and code-staging.
@op-ct
op-ct / codesign.sh
Created May 9, 2018 14:07 — forked from vszakats/codesign.sh
Code-signing PE executables using OpenSSL, osslsigncode (and more)
#!/bin/sh -e
# To the extent possible under law, Viktor Szakats (vszakats.net)
# has waived all copyright and related or neighboring rights to this
# script.
# CC0 - https://creativecommons.org/publicdomain/zero/1.0/
# This script will create a self-signed root certificate, along with a code
# signing certificate in various formats, trying to use the best available
# crypto/practice all along. Then, it will create a test executable and code
@op-ct
op-ct / README.md
Created March 18, 2019 17:01 — forked from openscript/README.md
This bash script can be used to encrypt secrets for a Travis CI configuration (`.travis.yml`) with the project specific public key.

Usage

  • Download script travis-encrypt.sh
  • Make it executable chmod +x travis-encrypt.sh
  • Run the script with ./travis-encrypt.sh -r username/repositoryname -e example
    • It will return something like O+woVD9K+PeFrcyu5GCjKSFvfcSPwDW0kyDYEQnNbwt/iSkqjpl2OPA9W//KEKEB9UUSZD+XmQ3Ij0gnvJnOowcWY5sSeJlVEVTrSer0kW6uWpa/uWzDHCBz2YhBnI6u9SfYfMkhDl22pcaCEwaUkmK2gjcVo+v0bS8vAQFz0Na5/WiKj0GkSX50iIGgfaXheuC8KgIC25T0h+czpap7vb13OlblMnClfyTH9+TmAwTlcV7ljXpv1QY+K72L8jK1/CQVZ8quBYrBwwxO2V6cpXRMMCIw4m4lqxUyN4FBGnq7cJ7BWLzeqSMpFBoP+ZxAqS5yem8KLh1VkEo7PVjCkZE6M+2meFf2VJEVUs/KJY9xnH3eDzipWkwXon2qVpCkT7FDEzGFs/DapYsSo7eCO6pUYYhcpaYpWeYV9DSSV0QcrOeZp664iJMHWPSmrs/lESbbHpKWsM/AFVB9X75q/OB+QU0tQxpReZmKw3ZHbDVMlmlwhP8VSiQ05LV2W6gYzADGiUiL6n1X8teeHEVDSZnD7nrxMD/FchnWI5La3tZeFovRMf6hH3NItW+QZaGaGNftJrP488J/F2hCycPJk3+YrxbBCGHE2X379QbkMz3S0B5UiAcJKmwuTstF6X3CCurZVYIkUGGXhnmalPtVpEqxeTiLw5RU6C9z2qSwhhw=
  • Use the encrypted secret in your .travis.yml according to https://docs.travis-ci.com/user/encryption-keys/#Usage