Skip to content

Instantly share code, notes, and snippets.

View jbartko's full-sized avatar

John Bartko jbartko

  • lol no
  • Austin, TX
View GitHub Profile
#!/bin/bash
OLDIFS=$IFS
export IFS=$'\n'
# Find all boxes which have updates
AVAILABLE_UPDATES=$(vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2 2>/dev/null)
if [[ ${#AVAILABLE_UPDATES[@]} -ne 0 ]]; then
@paoloantinori
paoloantinori / keycloak.sh
Created January 26, 2016 15:59
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@jangaraj
jangaraj / gist:64b88b6eed7f8d0221e6
Created April 22, 2015 13:40
Zenoss 4 - Chrome zooming issue
# dirty, not tested hack http://www.zenoss.org/forum/8806
# it will solve issue with Chrome, but question is what is broken after this hack?
sed -i -e "s# request.setHeader('Content-type', mimetype)# if mimetype == 'image/png':\n mimetype = 'application/javascript'\n request.setHeader('Content-type', mimetype)#g" /opt/zenoss/Products/ZenRRD/zenrender.py
# or edit /opt/zenoss/Products/ZenRRD/zenrender.py
original:
request.setHeader('Content-type', mimetype)
edited:
if mimetype == 'image/png':
mimetype = 'application/javascript'
@mattjbarlow
mattjbarlow / gist:242b66cdae6938d34419
Created December 22, 2014 15:40
Chef Shell in Test Kitchen
cd into /tmp/kitchen.
/opt/chef/embedded/bin/gem install chef-zero
/opt/chef/embedded/bin/chef-zero -d
knife cookbook upload -a -c client.rb
chef-shell -z -c client.rb -o '<YOUR RECIPE>'
@zuazo
zuazo / Chef-Rakefile.rb
Last active May 23, 2019 13:39
Rakefile template for a Chef Cookbook: YARD, RuboCop, foodcritic, ChefSpec, Test Kitchen
# encoding: UTF-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Available Rake tasks:
#
# $ rake -T
# rake clean # Clean some generated files
# rake default # Run doc, style, unit and integration tests
@scalp42
scalp42 / check_resource.rb
Created November 22, 2013 21:04
Figure if a resource exists or not in Chef before notifying it
resource_not_found = {}
begin
resources('ruby_block[my-resource-supposed-to-exist]')
rescue Chef::Exceptions::ResourceNotFound
resource_not_found['ruby_block[my-resource-supposed-to-exist]'] = true
end
template '/etc/my/template.conf' do
source 'template.conf.erb'
mode '640'
@fnichol
fnichol / README.md
Last active April 27, 2023 15:24
Auto-enable Local HTTP Caching in Test Kitchen

Auto-enable Local HTTP Caching in Test Kitchen

Note: total experiment and hack, looks nasty, could be awesome:

Setup

  • Drop the kitchen.local.yml into $HOME/.kitchen/config.yml
  • Install polipo (with Mac: brew install polipo, with Ubuntu: apt-get install polipo)
  • Drop polipo-start and polipo-console somewhere useful (perhaps $HOME/bin?)
@jbartko
jbartko / purgedirs.md
Created June 2, 2013 20:48
Example of r10k purging its basedir even though the purgedirs directive is commented out.
$ cat /etc/r10k.yaml
# The location to use for storing cached Git repos
:cachedir: '/var/cache/r10k'

# A list of git repositories to create
:sources:
 # This will clone the git repository and instantiate an environment per
@jhollinger
jhollinger / thin
Created November 4, 2012 14:51 — forked from sorah/thin
/etc/init.d/thin - thin init script with bundle exec
#!/bin/bash
DAEMON=/usr/local/bin/thin
BUNDLE=/usr/local/bin/bundle
CONFIG_PATH=/etc/thin
SCRIPT_NAME=/etc/init.d/thin
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
invoke()
@webjay
webjay / gh_hook.php
Last active January 7, 2023 11:54
Php hook script that can git pull, apc_clear_cache() etc
<?php
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w') // stderr