Skip to content

Instantly share code, notes, and snippets.

View daniilyar's full-sized avatar
💭
Build systems for people, not only for money

Daniil Yaroslavtsev daniilyar

💭
Build systems for people, not only for money
View GitHub Profile
@daniilyar
daniilyar / check_reserved_instances.sh
Created May 4, 2016 09:24
AWS: check if all reserved instances are in use by appropriate on-demand ones
#!/bin/bash
set -e
REGION="us-west-2"
RUNNING_INSTANCES=`aws ec2 describe-instances --region $REGION --filters Name=instance-state-name,Values=running --query Reservations[*].Instances[*].InstanceType --output text | sort | uniq -c | awk ' { t = $1; $1 = $2; $2 = t; print; } '`
# Example:
#m3.medium 11
#r3.large 3
@daniilyar
daniilyar / Dockerfile for Checkstyle master branch compilation
Last active May 14, 2016 15:31
Dockerfile for Checkstyle master branch compilation
FROM ubuntu:14.04
MAINTAINER Daniil Yaroslavtsev <Daniil.Yaroslavtsev@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV MAVEN_VERSION 3.3.9
# Java Version
ENV JAVA_VERSION_MAJOR 8
ENV JAVA_VERSION_MINOR 45
ENV JAVA_VERSION_BUILD 14
@daniilyar
daniilyar / gist:e433cab6c9d25ba600c4
Created March 18, 2016 21:32
logstash_calculate_message_charts_count
# Calculate message chars count
ruby {
code => "if !event['message'].nil?
message_chars_count = event['message'].length
event.to_hash.merge!('message_chars_count' => message_chars_count)
end"
}
@daniilyar
daniilyar / gelf_input_tcp
Last active July 15, 2016 07:14
Logstash GELF input with TCP support added
# encoding: utf-8
require "date"
require "logstash/inputs/base"
require "logstash/namespace"
require "socket"
# This input will read GELF messages as events over the network,
# making it a good choice if you already use Graylog2 today.
#
# The main use case for this input is to leverage existing GELF
@daniilyar
daniilyar / gist:6478af7683d25e664f96
Last active July 25, 2017 02:09
Packer config for provisioning AWS EBS AMIs
{
"variables": {
"vault_pass": "{{ env `VAULT_PASS` }}",
"aws_access_key": "{{ env `AWS_ACCESS_KEY` }}",
"aws_secret_key": "{{ env `AWS_SECRET_KEY` }}",
"source_ami_id": "{{ env `SOURCE_AMI_ID` }}",
"playbook": "{{ env `PLAYBOOK` }}",
"ami_description": "{{ env `AMI_DESCRIPTION` }}",
"roles_path": "{{ env `ROLES_PATH` }}"
},
@daniilyar
daniilyar / jenkins_total_build_status
Last active September 17, 2019 13:22
Script for Jenkins 'Total build status' job which displays all failed jobs with last changes, committers and links to job's console. It will fail if at least one other Jenkins job is failed. Usage: create Jenkins Freestyle job and add this script as "Execute system Groovy script" build step
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
import hudson.console.*
import groovy.time.*
import hudson.plugins.git.*
import java.text.SimpleDateFormat
import java.util.Date
@daniilyar
daniilyar / pgpool2_etc_init.d_debian
Created March 20, 2015 23:41
Debian /etc/init.d launch script for pgpool. Tested on Ubuntu 14.04 LTS (at Amazon EC2)
#! /bin/sh
### BEGIN INIT INFO
# Provides: pgpool2
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start pgpool-II
@daniilyar
daniilyar / eclipse.ini
Created February 28, 2015 20:53
eclipse.ini template for Scala developemnt
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
@daniilyar
daniilyar / gist:630bc6fe7723ed06f243
Created February 26, 2015 08:56
output of rs.status() from PRIMARY host
10.148.28.51:PRIMARY> rs.status()
{
"set" : "10.148.28.51",
"date" : ISODate("2015-02-25T18:35:38Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "ip-10-148-28-51:27118",
"health" : 1,
@daniilyar
daniilyar / gist:1c01da493747dc8dabd2
Created December 8, 2014 13:23
How to make camel redirect requests in a maximum
from(url).process(processor).choice()
.when(header("location").isNull()).endChoice()
.when(header("location").contains("?")).recipientList(simple("${header.location}&bridgeEndpoint=true")).endChoice()
.otherwise().recipientList(simple("${header.location}?bridgeEndpoint=true"));
and just modify location header in processor to any url you need to redirect based on input request content