Get a list of nodes and their runlists matching a given recipe
knife exec -E 'nodes.find("recipe:*elasticsearch*") { |n| puts "hostname: #{n.name} runlist: #{n.run_list}" }'
Get a list of nodes and their runlists matching a given recipe
knife exec -E 'nodes.find("recipe:*elasticsearch*") { |n| puts "hostname: #{n.name} runlist: #{n.run_list}" }'
| #!/usr/bin/env python | |
| # | |
| # Harsh translation from C to Python, with minimal python idioms. | |
| # Original code by Brian Kernighan in chapter 1 of Beautiful Code | |
| # | |
| def match(regstr, s): | |
| '''match: search for regexp anywhere in text''' | |
| if regstr.startswith('^'): | |
| return matchhere(regstr[1:], s) |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <errno.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <sys/mman.h> | |
| #include <elf.h> |
| #!/usr/bin/python | |
| # I used this script to scan pictures in a 15 year old | |
| # windows hard-drive and copy them to a specific folder with a name | |
| # based on an increasing sequence. It also seemed to pick multiple | |
| # formats that weren't exactly the type of pictures I would care about, | |
| # so I filtered for those (icons, bitmaps, etc) | |
| # | |
| import sys | |
| import os |
| #!/bin/bash | |
| set -ex | |
| source credentials.sh | |
| export JENKINS_URL=http://127.0.0.1:8080 | |
| export NODE_NAME=foobar3 | |
| export JENKINS_CRUMB=$(curl --cookie-jar jenkins-cookies -s -X GET $JENKINS_URL/crumbIssuer/api/json --user ${JENKINS_USERNAME}:${JENKINS_PASSWORD} | jq -r '.crumb') |
def container_id(pid)
cgroup_file = "/proc/#{pid}/cgroup"
return nil unless File.exist?(cgroup_file)
container_id = File.foreach(cgroup_file)
.map(&:strip)
.select { |cg| cg.match?(/docker/) }.first
container_id.split('/').last
end| #!/usr/bin/env python3 | |
| import sys | |
| import argparse | |
| from collections import defaultdict | |
| from datetime import datetime,timedelta | |
| import requests | |
| import logging | |
| import traceback | |
| class JenkinsJobProfiler(object): |