Skip to content

Instantly share code, notes, and snippets.

View johnbuhay's full-sized avatar
📺
Working from New York

John Buhay johnbuhay

📺
Working from New York
View GitHub Profile
@johnbuhay
johnbuhay / one-liners
Last active August 29, 2015 14:23
Particularly fond of these useful one liners:
# Get a version from a json:
REMOTE_VERSION=$(curl -s URL_THAT_RETURNS_JSON|python -c 'import json,sys;obj=json.load(sys.stdin);print obj["version"]')
# Get latest version from Artifactory:
REMOTE_VERSION=$(curl -s http://{{artifactory_integration_host}}:8081/artifactory/api/npm/libs-npm-virtual/ww-node-configs/latest|python -c 'import json,sys;obj=json.load(sys.stdin);version = "0.0.0" if obj.get("version") is None else obj["version"];print version')
# To stop a job in jenkins if this build is not for a newer version:
python -c 'import sys; exit(0) if sys.argv[1] > sys.argv[2] else exit(1)' $LOCAL_VERSION $REMOTE_VERSION
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
log_not_found off;
proxy_cache_valid any 1m;
proxy_pass http://local_backend$uri$is_args$args;
add_header X-Proxy-Cache $upstream_cache_status;
}
FROM golang
WORKDIR /go
RUN go get github.com/BurntSushi/toml && \
go get github.com/kelseyhightower/confd && \
cd $GOPATH/src/github.com/kelseyhightower/confd && \
git remote add sort https://github.com/HeavyHorst/confd.git && \
git pull sort sort && git checkout sort && \
find / -type f -name "*confd" -exec rm {} \; && \
@johnbuhay
johnbuhay / docker-compose.yml
Last active April 3, 2016 21:14
Further testing confd with json values
---
confd:
build: .
links:
- etcd
volumes:
- ${PWD}/example.tmpl:/etc/confd/templates/example.tmpl
environment:
10:44:13 sh: 1: modprobe: not found
10:44:13 Warning: current kernel is not supported by the linux-image-extra-virtual
10:44:13 package. We have no AUFS support. Consider installing the packages
10:44:13 linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.
10:44:13 + sleep 10
10:44:23 + sudo -E sh -c apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
10:44:28 Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.Hr5DxDRlw3 --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debia
@johnbuhay
johnbuhay / update-version.sh | FreeBSD | OSX
Last active July 21, 2016 15:32
shell scripts for versioning
#!/usr/bin/env bash
#set -x # for debugging
function print_help(){
read -r -d '' HELP_MSG << EOM
#
# See semver.org for details
# Commands look like
#
@johnbuhay
johnbuhay / 0-netflix-security-monkey
Last active August 12, 2016 22:19
netflix-skunkworks/zero-to-docker/security_monkey/0.3.4 | aws
Docs:
- https://github.com/Netflix-Skunkworks/zerotodocker/wiki/Security-Monkey
- http://securitymonkey.readthedocs.io/en/latest/quickstart.html#setup-iam-roles
- https://hub.docker.com/r/netflixoss/security_monkey-nginx/
tl;dr
```bash
docker-compose up -d postgres
docker-compose up -d init # initializes database
docker-compose up -d nginx # will start api and nginx
@johnbuhay
johnbuhay / Bash Cheatsheet
Last active January 17, 2017 18:49
Cheatsheet
---
Resources:
- https://google.github.io/styleguide/shell.xml
- http://tldp.org/guides.html
@johnbuhay
johnbuhay / Curl_commands.md
Last active January 30, 2017 15:14
useful curl commands

Design pattern for how gists are labelled.

@johnbuhay
johnbuhay / DocLinksPublisher - Jenkins jobdsl
Last active February 1, 2017 22:49
Jenkins configuration snippets | Job DSL
#!/usr/bin/env groovy
# this is technically Jenkins Job Dsl
version = 1
job('example') {
publishers {
configure { node ->
node / 'publishers' << 'hudson.plugins.doclinks.DocLinksPublisher' {}
node / 'publishers' / 'hudson.plugins.doclinks.DocLinksPublisher' << 'documents' {}
node / 'publishers' / 'hudson.plugins.doclinks.DocLinksPublisher' / 'documents' << 'hudson.plugins.doclinks.Document' {