Skip to content

Instantly share code, notes, and snippets.

💭
Build systems for people, not for fun

Daniil Yaroslavtsev daniilyar

💭
Build systems for people, not for fun
Block or report user

Report or block daniilyar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daniilyar
daniilyar / Dockerfile for Checkstyle master branch compilation
Last active May 14, 2016
Dockerfile for Checkstyle master branch compilation
View 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 Mar 18, 2016
logstash_calculate_message_charts_count
View gist:e433cab6c9d25ba600c4
# 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 Jul 15, 2016
Logstash GELF input with TCP support added
View gelf_input_tcp
# 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 Jul 25, 2017
Packer config for provisioning AWS EBS AMIs
View gist:6478af7683d25e664f96
{
"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 Sep 17, 2019
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
View jenkins_total_build_status
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 Mar 20, 2015
Debian /etc/init.d launch script for pgpool. Tested on Ubuntu 14.04 LTS (at Amazon EC2)
View pgpool2_etc_init.d_debian
#! /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 Feb 28, 2015
eclipse.ini template for Scala developemnt
View eclipse.ini
-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 Feb 26, 2015
output of rs.status() from PRIMARY host
View gist:630bc6fe7723ed06f243
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 Dec 8, 2014
How to make camel redirect requests in a maximum
View gist:1c01da493747dc8dabd2
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
@daniilyar
daniilyar / gist:cf07a850939970ddde74
Created Nov 30, 2014
Example code of how NOT to use redundant Map whenr generating ast tree JSON
View gist:cf07a850939970ddde74
public static String toJson(DetailAST ast) throws IOException {
int nodeId = ROOT_NODE_ID;
Stack<Integer> parentNodeIdStack = new Stack<>();
parentNodeIdStack.push(nodeId); // root node id
DetailAST currentNode = ast;
StringWriter writer = new StringWriter();
JsonGenerator jsonGenerator = JSON_FACTORY.createJsonGenerator(writer).useDefaultPrettyPrinter();
You can’t perform that action at this time.