Skip to content

Instantly share code, notes, and snippets.

View dimzak's full-sized avatar

Dimitrios Zakas dimzak

  • Disney Streaming Services
  • Manchester, UK
View GitHub Profile
@dimzak
dimzak / experiment.json
Last active June 4, 2020 16:05
Sample chaostoolkit experiment
{
"version": "1.0",
"title": "Experiment evaluating serviceA operability without its database",
"description": "If serviceA database is down, serviceA continues to operate as usual",
"configuration": {},
"steady-state-hypothesis": {
"probes": [
{
"type": "probe",
"name": "Perform some read and writes to database through serviceA"
@dimzak
dimzak / add_file_s3.py
Created July 18, 2018 07:31
Boto3 helpers
#!/usr/bin/env python
import sys
import boto3
s3 = boto3.client("s3")
client = boto3.client(
's3',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
aws_session_token=SESSION_TOKEN,
@dimzak
dimzak / lxc_lxd_cheatsheet.md
Last active December 19, 2017 22:18
LXC / LXD cheatsheet

Delete lxd lxc completely to re run lxd init

  • Remove containers
    lxc list
    lxc stop CONTAINER_NAME
    lxc delete CONTAINER_NAME

  • Remove images
    lxc image list
    lxc image delete FINGERPRINT

# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "sloth" do |sloth|
# set to false, if you do NOT want to check the correct VirtualBox Guest Additions version when booting this box
@dimzak
dimzak / setup.sh
Last active November 5, 2015 09:59
Restore development machine
#!/bin/bash
apt-get update
apt-get -y upgrade
# Google Chrome
echo 'Installing Google Chrome'
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
@dimzak
dimzak / create_kibana_from_file.sh
Last active October 27, 2016 12:18
ElasticSearch-Python usable queries
#!/bin/sh
count="$(cat $1 | jq '.hits.hits | length')"
es_host=$2
i=0
while [ "$i" -lt $count ]; do
body=$(cat $1 | jq -r --arg v "${i}" '.hits.hits[$v|tonumber]._source');
type=$(cat $1 | jq -r --arg v "${i}" '.hits.hits[$v|tonumber]._type');
id=$(cat $1 | jq -r --arg v "${i}" '.hits.hits[$v|tonumber]._id');
@dimzak
dimzak / batch-config.xml
Created July 7, 2014 13:15
h2 in mem configuration for spring batch(useful for partitioning testing)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd">
<bean id="jobRepository"
@dimzak
dimzak / main.sql
Last active September 12, 2019 23:36
Useful SQL queries for spring-batch metadata(MySql)
-- select job-time of the last 4 COMPLETED jobs
SELECT TIMESTAMPDIFF(SECOND,START_TIME,END_TIME),batch_job_execution.JOB_INSTANCE_ID from batch_job_execution
where(STATUS='COMPLETED')
order by JOB_EXECUTION_ID DESC LIMIT 4;
--select job-time from COMPLETED jobs named 'csvtoxml' limit:last 4
SELECT TIMESTAMPDIFF(SECOND,START_TIME,END_TIME),
batch_job_execution.JOB_INSTANCE_ID, batch_job_execution.END_TIME
from batch_job_execution
@dimzak
dimzak / settings.xml
Last active December 24, 2015 02:29
settings.xml for jboss quickstarts
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at