Skip to content

Instantly share code, notes, and snippets.

View miketheman's full-sized avatar
🌴
On vacation

Mike Fiedler miketheman

🌴
On vacation
View GitHub Profile
@miketheman
miketheman / wrapper_example.erb
Created March 10, 2015 16:39
Chef Bootstrap Partial Wrapper Example
bash -x -c -e '
echo $(date +%s) > /etc/created
apt-get update
'
<%
def import(fname)
eruby = Erubis::Eruby.new
@miketheman
miketheman / console.sh-session
Created February 1, 2015 15:07
nginx 1.6.2 from nginx.org defaults
# dpkg -l nginx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================-==============-==============-==========================================
ii nginx 1.6.2-1~trusty amd64 high performance web server
# dpkg --status nginx
Package: nginx
@miketheman
miketheman / 1_notes.md
Created November 21, 2014 22:18
Benchmark of using different methods to convert complex Mash to Hash

Using the following Gem versions:

  • benchmark-ips (2.1.0)
  • chef (11.16.4), which includes:
    • erubis (2.7.0)
    • json (1.8.1)

Ruby 1.9.3:

Calculating -------------------------------------
@miketheman
miketheman / check_cert.sh-session
Created September 30, 2014 22:16
openssl get certs
$ openssl s_client -showcerts -connect www.datadoghq.com:443 </dev/null
CONNECTED(00000003)
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/serialNumber=dzc7avuEuqhZCEL82HF5aqoCQMgtwixa/OU=GT41552380/OU=See www.rapidssl.com/resources/cps (c)14/OU=Domain Control Validated - RapidSSL(R)/CN=*.wpengine.com
i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
-----BEGIN CERTIFICATE-----
@miketheman
miketheman / agent_version.sh-session
Last active May 22, 2017 13:57
Retrieve metadata about systems from Datadog
# Ensure you have `jq` installed - http://stedolan.github.io/jq/
$ brew install jq
...
/usr/local/Cellar/jq/1.4: 15 files, 748K, built in 9 seconds
# Grab your API_KEY and create an APPLICATION_KEY from https://app.datadoghq.com/account/settings#api
$ export API_KEY=aaabbbccc
$ export APPLICATION_KEY=111222333
$ curl -s "https://app.datadoghq.com/reports/v1/overview?with_meta=true&api_key=$API_KEY&application_key=$APPLICATION_KEY" \
@miketheman
miketheman / dpkg.sh-session
Created September 16, 2014 13:51
packages with epochs
$ dpkg -l | grep '1:'
ii acpid 1:2.0.10-1ubuntu3 Advanced Configuration and Power Interface event daemon
ii automake 1:1.11.3-1ubuntu2 Tool for generating GNU Standards-compliant Makefiles
ii bash-completion 1:1.3-1ubuntu8.1 programmable completion for the bash shell
ii bind9-host 1:9.8.1.dfsg.P1-4ubuntu0.8 Version of 'host' bundled with BIND 9.X
ii bison 1:2.5.dfsg-2.1 YACC-compatible parser generator
ii bsdutils 1:2.20.1-1ubuntu3.1 Basic utilities from 4.4BSD-Lite
ii busybox-initramfs 1:1.18.5-1ubuntu4.1 Standalone shell setup for initramfs
ii busybox-static 1:1.18.5-1ubuntu4.1 Standalone rescue shell with tons of builtin utilities
ii datadog-agent 1:5.0.0-496 Datadog Moni
@miketheman
miketheman / user.sh-session
Last active March 22, 2018 11:43
Show direct URL to a pacakge without the repo being enabled, using `repoquery` - http://linux.die.net/man/1/repoquery
$ sudo yum install yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.ash.fastserv.com
* extras: mirror.lug.udel.edu
* updates: mirrors.seas.harvard.edu
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.30-17.el6_5 will be installed
@miketheman
miketheman / .kitchen.yml
Created August 27, 2014 21:20
kitchen setup with docker
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: centos-6.5
- name: ubuntu-10.04
- name: ubuntu-12.04
@miketheman
miketheman / run1.log
Created June 30, 2014 19:55
Chef remote_file resource against a Raw GitHub file
INFO: remote_file[/usr/local/bin/ps_mem] created file /usr/local/bin/ps_mem
DEBUG: remote_file[/usr/local/bin/ps_mem] checking for changes
DEBUG: Cache control headers: {}
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
DEBUG: Initiating GET to https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py
DEBUG: ---- HTTP Request Header Data: ----
DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
DEBUG: ---- End HTTP Request Header Data ----
require "statsd"
# Create a stats instance.
statsd = Statsd.new("localhost", 8125)
# Increment a counter for 5 minutes, 1 point per second
(1...300).each { statsd.count("dev.mike.dogstatsd", 1) ; sleep 1 }