Skip to content

Instantly share code, notes, and snippets.

View andyshinn's full-sized avatar
🖥️
don't put computers in your mouth

Andy Shinn andyshinn

🖥️
don't put computers in your mouth
View GitHub Profile
from datadog_checks.utils.subprocess_output import get_subprocess_output
from datadog_checks.checks import AgentCheck
class AptCheck(AgentCheck):
def check(self, instance):
metric_prefix = 'package.updates'
package_updates = self.get_update_count()
self.gauge('%s.security' % metric_prefix, package_updates['security'])
self.gauge('%s.regular' % metric_prefix, package_updates['regular'])
1540503241102 geckodriver INFO geckodriver 0.19.1
1540503241106 geckodriver INFO geckodriver 0.19.1
1540503241112 geckodriver INFO Listening on 127.0.0.1:35169
1540503241115 geckodriver INFO Listening on 127.0.0.1:51405
1540503242449 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-headless" "-profile" "/tmp/rust_mozprofile.LuNcVSKdWkZh"
1540503242452 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-headless" "-profile" "/tmp/rust_mozprofile.NVkuSVAjuWm4"
1540503242453 geckodriver::marionette TRACE connection attempt 0/600
1540503242455 geckodriver::marionette TRACE connection attempt 0/600
*** You are running in headless mode.
*** You are running in headless mode.
@andyshinn
andyshinn / backend_service_health.py
Created April 12, 2018 20:07
Google Compute Engine backend service health check to Datadog
from datadog import statsd
import googleapiclient.discovery
PROJECT = 'myproj-153506'
SERVICES = [
'internal',
'www',
'backend'
]
METRIC = 'gcp.gce.backend.health'

Keybase proof

I hereby claim:

  • I am andyshinn on github.
  • I am andyshinn (https://keybase.io/andyshinn) on keybase.
  • I have a public key whose fingerprint is 45DF 685F CD42 D902 BE71 06E3 05E6 1E54 BDCC 55B0

To claim this, I am signing this object:

@andyshinn
andyshinn / Dockerfile
Created August 19, 2017 20:59
Building Riak 1.4.x CentOS 6 RPMs
FROM centos:6
RUN yum -y groupinstall "Development Tools" "Development Libraries"
RUN yum -y install wget git rpm-build
RUN yum -y install https://packages.erlang-solutions.com/rpm/centos/6/x86_64/esl-erlang-R15B03-2.x86_64.rpm
ubuntu@maasnode7:~$ ps fauxw
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         2  0.0  0.0      0     0 ?        S    04:16   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    04:16   0:00  \_ [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   04:16   0:00  \_ [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    04:16   0:00  \_ [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    04:16   0:00  \_ [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    04:16   0:00  \_ [migration/0]
root        10  0.0  0.0      0     0 ?        S    04:16   0:00  \_ [watchdog/0]
@andyshinn
andyshinn / Dockerfile
Created July 2, 2017 17:58
nginx serving Angular 4 application built as Docker multi-stage image
FROM node:8.1.2-onbuild as builder
ARG TARGET=production
RUN npm install @angular/cli
RUN node_modules/.bin/ng build -aot --target ${TARGET}
FROM nginx:1.13-alpine
COPY nginx.conf /etc/nginx/conf.d/
COPY --from=builder /usr/src/app/dist /usr/src/app
version: "3"
services:
test:
env_file: ./myenv
image: alpine
command: env
@andyshinn
andyshinn / GCLOUD-EXAMPLE.md
Last active August 20, 2018 19:29
Postal on Google Container Engine

Postal on Kubernetes in Google Cloud Platform

Requirements

  1. Google Cloud Platform (GCP) account.
  2. A project in the account (we're using postal-165921 in our example commands).

Infrastructure

  1. Set the defailt zone to use with our gcloud commands: gcloud config set compute/zone us-central1-a
@andyshinn
andyshinn / Dockerfile
Last active August 8, 2023 08:39
Postal on Docker
FROM ruby:2.3-onbuild
VOLUME /opt/postal/config
ENV LOG_TO_STDOUT 1
ENV AM_CONFIG_ROOT /opt/postal/config
RUN gem install procodile
RUN apt-get update -qq && apt-get install -yqq nodejs