Skip to content

Instantly share code, notes, and snippets.

@dataday
dataday / Makefile
Created August 24, 2017 13:03
Makefile for RPMS built by MBT
.PHONY: clean prepare rpmbuild
#
# Author: dataday
#
# Description:
#
# Provides common make script functions for
# building RPM versioned packages
#
# Usage:
@dataday
dataday / influxdb_update.py
Last active August 24, 2017 13:46
Runs Influxdb updates to setup new users and databases, triggered on AWS
#!/usr/bin/env python
#
# Author: dataday (2015)
#
# Description: influxdb updates for new users and databases
#
# To remove influx data and meta
# rm -rf /var/opt/influxdb/meta/*; rm -rf /var/opt/influxdb/data/*; rm -rf /var/opt/influxdb/wal/*
# service influxdb restart
#
@dataday
dataday / make_request.rb
Last active August 24, 2017 13:47
Uses RestClient to make request to secured domain
#...
def make_request(url, secure = false)
url = url(url) # Make Addressable
opts = secure ? { verify_ssl: OpenSSL::SSL::VERIFY_PEER } : {}
opts.merge!(content_type: @config[:content_type], user_agent: @config[:agent])
cert = @config[:cert_path] || ''
pass = @config[:cert_password] || ''
@dataday
dataday / get_jsonp.rb
Last active August 24, 2017 13:47
Gets the response data from external JSONP data source
# Author: dataday
# http://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html
require 'json'
# https://github.com/sporkmonger/addressable
require 'addressable/uri'
# http://www.rubydoc.info/gems/activesupport/5.0.0
require 'active_support'
@dataday
dataday / Dockerfile.centos7
Created August 24, 2017 13:26
Dockerfile for CentOS7
FROM centos:centos7
MAINTAINER dataday <[email protected]>
COPY repositories/ /etc/yum.repos.d/
RUN yum update -y && yum install -y yum-utils
COPY bashrc /tmp/bashrc
RUN cat "/tmp/bashrc" >> ~/.bashrc && rm -f /tmp/bashrc
@dataday
dataday / release_pipeline.sh
Last active February 11, 2020 10:23
CI release script, uses Github API and internal release manager API to validate and release projects
#!/usr/bin/env bash
#
# Author: dataday
# created: 23/02/2016
#
# Description:
# Runs release tasks on CI (Delivery Pipeline)
# For input variables see $SCRIPT_ROOT/environment-ci
# debug: $0 2>&1 | tee $SCRIPT_ROOT/release.log
#
#!/usr/bin/env bash
#
# Author: dataday
# created: 23/02/2016
#
# Description:
# Runs release (delivery pipeline) or
# development tasks locally or on CI
#
# fail on error
@dataday
dataday / project-gruntfile.js
Created August 24, 2017 15:09
Gruntfile for use with Symfony webapp
module.exports = function (grunt) {
// passed environment via Makefile
var env = process.env.APP_TARGET_ENV;
// sets task type based on environment
var task_type = (['int', 'test', 'live'].indexOf(env) >= 0) ?
'dist' :
'dev';
@dataday
dataday / Dockerfile.CentOS6.php7
Created August 24, 2017 15:13
Dockerfile.Centos6.php7 for use on CI ahead of AWS release
FROM registry.ci.api.domain.co.uk/rmp/centos6:base
MAINTAINER dataday <[email protected]>
VOLUME /usr/share/webapp-base
WORKDIR /usr/share/webapp-base
# machine dependencies
RUN yum update -y && yum install -y epel-release
RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RUN rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
@dataday
dataday / manage-bucket.rb
Created November 27, 2017 11:44
Manages AWS hosted S3 bucket content via the aws-sdk for Ruby
#!/usr/bin/env ruby
# Manages AWS hosted S3 bucket content via the aws-sdk for Ruby.
# @author: dataday
# Example input:
# bundle exec ruby exe/bucket.rb bucket service-cookbook --create-bucket
# bundle exec ruby exe/bucket.rb bucket service-cookbook --delete-bucket
# bundle exec ruby exe/bucket.rb bucket service-cookbook --list-objects
# bundle exec ruby exe/bucket.rb bucket service-cookbook --upload-object local/file.suffix remote/path