Skip to content

Instantly share code, notes, and snippets.

View ncerny's full-sized avatar

Nathan Cerny ncerny

  • Overland Park, KS, USA
View GitHub Profile
@ipbastola
ipbastola / jq to filter by value.md
Last active May 29, 2025 00:52
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@irvingpop
irvingpop / advanced-chef-server-admin.md
Last active July 16, 2016 18:11
Messing around with Chef Server admin functions beyond knife-opc

Connecting to your Chef server as an admin, via the API

# launch pry
/opt/opscode/embedded/bin/pry 
[1] pry(main)> require 'chef/rest'
=> true

# create a Chef::REST object pointed at localhost with the pivotal user and pivotal.pem (required for admin operations)
[2] pry(main)> chef_rest = Chef::REST.new('https://localhost/', 'pivotal', '/etc/opscode/pivotal.pem')
@juliandunn
juliandunn / post-mortem-template.md
Created April 29, 2015 00:53
Post mortem template

INCIDENT DATE - INCIDENT TYPE

Meeting

Waiving meetings

In some cases the IC might determine that a PM meeting for the incident isn't needed. If the IC decides to waive the meeting please replace the Meeting section with a note indicating the meeting has been waived (example: Meeting waived: Paul Mooring)

@echohack
echohack / chef_windows_upgrade.ps1
Last active August 23, 2016 20:38
chef_windows_upgrade.ps1
# Execute this script in order to upgrade all the windows nodes in your fleet of servers to the desired version of chef-client.
# This script will requires the ChefDK to be installed and configured on your Windows machine.
$windows_nodes = knife search node 'platform:windows' -i
invoke-command -ComputerName $windows_nodes -filepath C:\Users\MyUser\invoke_upgrade.ps1 -Credential domain\user
Read-Host -Prompt Upgrade complete. Press Enter to exit.