Skip to content

Instantly share code, notes, and snippets.


Sokratis Galiatsis sokratisg

View GitHub Profile
dschaaff / notifySlack.groovy
Created Feb 9, 2018
jenkins pipeline library for slack notifications with nice formatting
View notifySlack.groovy
#!/usr/bin/env groovy
* notify slack and set message based on build status
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.model.Actionable;
lesovsky / bgwr-ckpt-report.sql
Created Mar 27, 2017
Report query for PostgreSQL' bgwriter/checkpointer.
View bgwr-ckpt-report.sql
now()-pg_postmaster_start_time() "Uptime", now()-stats_reset "Since stats reset",
round(100.0*checkpoints_req/total_checkpoints,1) "Forced checkpoint ratio (%)",
round(np.min_since_reset/total_checkpoints,2) "Minutes between checkpoints",
round(checkpoint_write_time::numeric/(total_checkpoints*1000),2) "Average write time per checkpoint (s)",
round(checkpoint_sync_time::numeric/(total_checkpoints*1000),2) "Average sync time per checkpoint (s)",
round(total_buffers/,1) "Total MB written",
round(buffers_checkpoint/(*total_checkpoints),2) "MB per checkpoint",
round(buffers_checkpoint/(*np.min_since_reset*60),2) "Checkpoint MBps",
round(buffers_clean/(*np.min_since_reset*60),2) "Bgwriter MBps",
lukeplausin /
Last active Aug 2, 2020
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
pbabics /
Created Nov 11, 2016
Manual garbage collector for gitlab registry, it removes old revisions that are not referenced by any tag
GITLAB_CTL_COMMAND=`which gitlab-ctl`
Eyjafjallajokull /
Last active Jul 29, 2020
AWS EBS - Find unused snapshots

This script can help you find and remove unused AWS snapshots and volumes.

There is hardcoded list of regions that it searches, adjust the value to suit your needs.

Use snapshot-report to generate report.csv containing information about all snapshots. snapshot-cleanup lets you interactively delete snapshot if it finds it is referencing unexisting resources.

./ --help
mrw34 / gist:b12531d1a8df25f6c170
Last active Jul 29, 2019
Trello JSON to CSV conversion using jq
View gist:b12531d1a8df25f6c170
jq -r '["List", "Card"], ((reduce .lists[] as $list ({}; .[$] = $ as $lists | .cards[] | select(.closed != true) | [$lists[.idList],.name]) | @csv' <nw3RUeLl.json
ndemengel /
Last active Aug 24, 2016 — forked from jjmaestro/
Add weeks support to jjmaestro's script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def archive_to_bytes(archive):
def to_seconds(s):
's': 1,
'm': 1 * 60,
'h': 1 * 60 * 60,

G1GC v.s. CMS for Cassandra 2.0

Many people have asked me about using the G1 garbage collector with Cassandra. Since most of my customers are running 2.0 in production the test is with 2.0 for now. Once I script it up I'll re-run the numbers with 2.1.

I also need to re-test with Java 7 and the Oracle JDKs.


Gromph / gist:5f4db73b0f38775bc2f0
Last active Sep 9, 2019
Install Cabot on CentOS7 using uwsgi, nginx, and mysql
View gist:5f4db73b0f38775bc2f0
The Cabot quick start instructions are for auto installing on ubuntu using fabric, gunicorn, postgres.
I wanted to install manually on CentOS 7 running with uwsgi, nginx, mysql, and use our own mail server for
alerts instead of Amazon SES
These are my notes on how I did that.
These notes aren't a complete walkthrough, and a few steps may be missing or wrong, but I thought they might
be helpful anyways.
1. adduser www
passwd www
zmwangx / Postfix: sender-dependent SASL
Last active Jul 1, 2020
Postfix: sender-dependent SASL authentication — relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)
View Postfix: sender-dependent SASL

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes
    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
You can’t perform that action at this time.