Skip to content

Instantly share code, notes, and snippets.

View docwhat's full-sized avatar

Christian Höltje docwhat

View GitHub Profile
@docwhat
docwhat / redesign.md
Last active August 29, 2015 14:03
Chef Data Bag redesign thoughts

Redesigning Data Bags

The current Chef data bag has many problems. Chef provides no help when dealing with encrypted data. It can be confusing when things are missing or don't work correctly. Some cookbooks assume various mechanisms for encryption or assume none.

Altogether it is confusing and hard to use and maintain.

require 'benchmark'
hash = {}
(1..5_000_000)
.map { |x| format '%020d', x }
.each { |k| hash["header#{k}"] = "value#{k.reverse}" }
Benchmark.bm(50) do |x|
puts "RUBY: #{RUBY_VERSION}"
x.report('map w/split join') { hash.map { |k, v| [k, v].join(':') } }
@docwhat
docwhat / .kitchen.yml
Created October 15, 2014 20:07
Chef Zero setting the environment for the node.
---
driver:
name: vagrant
provisioner:
name: chef_zero
environments_path: test/environments
client_rb:
# solo_rb: # Was used for solo
environment: kitchen
@docwhat
docwhat / gist:a2df518e46c78a771d75
Created October 31, 2014 19:51
Debugging HTTPS connections to fedoraproject.org
# OS X Mavericks
$ openssl s_client -state -msg -debug -connect fedoraproject.org:443
CONNECTED(00000003)
SSL_connect:before/connect initialization
write to 0x7fe6a2600000 [0x7fe6a3001000] (130 bytes => 130 (0x82))
0000 - 80 80 01 03 01 00 57 00-00 00 20 00 00 39 00 00 ......W... ..9..
0010 - 38 00 00 35 00 00 16 00-00 13 00 00 0a 07 00 c0 8..5............
0020 - 00 00 33 00 00 32 00 00-2f 00 00 9a 00 00 99 00 ..3..2../.......
0030 - 00 96 03 00 80 00 00 05-00 00 04 01 00 80 00 00 ................
0040 - 15 00 00 12 00 00 09 06-00 40 00 00 14 00 00 11 .........@......
@docwhat
docwhat / .rubocop.yml
Last active September 15, 2015 14:41 — forked from kwk/remove-orphan-images.sh
A script to remove orphaned docker images in a docker registry. Ported to Ruby for easy of understanding.
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Style/FileName:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/LineLength:
We couldn’t find that file to show.
Fork this and add your example
@docwhat
docwhat / source_me.bash
Created December 3, 2010 00:19
A simple thingy for Andrew
# This sets up the functions needed to make this work.
DG_DIR="${HOME}/.drewgo"
# Shows the list of saved directories.
function dg_show {
if [[ -r "${DG_DIR}/directories" ]]; then
cat "${DG_DIR}/directories"
else
echo "You haven't added anything yet."
@HEAD
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response HEAD(@PathParam("token") String token,
@DefaultValue("0") @FormParam("id") Number id)
throws JsonGenerationException, JsonMappingException, IOException {
EditSession session = AppState.INSTANCE.getEditSession(token);
Number change_id = session.getChangeId();
boolean has_changed = change_id != id;
org.ofbiz.core.entity.GenericDataSourceException: Generic Entity Exception occurred in deleteByAnd (SQL Exception while executing the following:DELETE FROM label WHERE FIELDID IS NULL AND ISSUE=? (Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'))