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 / 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 / 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 / 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: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 / 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 / check_reserved_instances.sh
Created May 4, 2016
AWS: check if all reserved instances are in use by appropriate on-demand ones
View check_reserved_instances.sh
#!/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 / check-aws-snapshots-not-attached-to-any-ami.sh
Last active Nov 16, 2019
AWS: check if there is no orphaned EBS snapshots (orphaned == not attached to any 'available' AMI)
View check-aws-snapshots-not-attached-to-any-ami.sh
#!/bin/bash
set -e
AWS_ACCOUNT_ID=<ENTER_YOUR_ACCOUNT_ID_HERE>
REGION=us-west-2
ORPHANED_SNAPSHOTS_COUNT_LIMIT=10
WORK_DIR=/tmp
View ES template for Spark metrics
{
"order": 0,
"template": "metrics-spark-*",
"settings": {
"index": {
"number_of_shards": "3",
"number_of_replicas": "1",
"refresh_interval": "15s"
}
},
View public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeh9PfEk8w+uEfw5Om4vkGVAaYG8G1NSDCwi13i8XYY8xlMFPHMtu+Wo9hmndvJmZAGEa2nMdhRZL0HxL+YQUWlScWnfz5CSh30di3vdojWBHPGbb4aTQm3UuxJHUuwoPeN79UUshW2RPcX7Mv+9RIU1sCc0YDYAsmbtpOrZ3YZMtQXxp87lv865voAbkoA+/SEDf6hVRFvOM8+qVajIrkCRGkXe2yEsJFNn2enTcxb3MveLGPZZeqiXGohDmn7JKl4NpMpmAGDeugeSWdJuzRtN/c8wKvxLZ6sPqp1sCctIvfsq85vKx3G5zcfjNvQ1xRyXDgtpfIngtkTmt5XZvV
@daniilyar
daniilyar / give-ssh.txt
Last active May 7, 2019
How to give me an SSH access to your Debian machine
View give-ssh.txt
sudo -i
apt-get -y install curl
useradd dyaroslavtsev -m -d /home/dyaroslavtsev -s /bin/bash
echo "dyaroslavtsev ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
mkdir -p /home/dyaroslavtsev/.ssh
curl -sL https://goo.gl/jS8729 > /home/dyaroslavtsev/.ssh/authorized_keys
chown -R dyaroslavtsev:dyaroslavtsev /home/dyaroslavtsev
You can’t perform that action at this time.