Skip to content

Instantly share code, notes, and snippets.

View k-popov's full-sized avatar

Kirill Popov k-popov

  • Saint-Peterburg, Russia
View GitHub Profile
resource "yandex_compute_instance" "bastion" {
name = "bastion"
hostname = "bastion"
platform_id = "standard-v1"
zone = "ru-central1-c"
labels = {
group = "bastion-hosts"
vds = "bastion"
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
from __future__ import print_function
import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.operators.dagrun_operator import TriggerDagRunOperator
@k-popov
k-popov / foreign_xcom_DAG.py
Created March 25, 2020 15:28
foreign_xcom_DAG.py
#!/usr/bin/env python
from __future__ import print_function
import pytz
import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
#!/usr/bin/env python2
source = [1,5,7,3,2,1,4]
median = sum(source)/float(len(source))
mindelta = abs(source[0] - median)
closest = source[0]
for item in source[1:]:
@k-popov
k-popov / README.md
Last active September 7, 2018 11:35
GridU Azure capstone

GridU Azure capstone

@k-popov
k-popov / add_allure.groovy
Created June 15, 2018 12:44
add allure installation
import ru.yandex.qatools.allure.jenkins.tools.*
import hudson.tools.InstallSourceProperty
import hudson.tools.ToolProperty
import hudson.tools.ToolPropertyDescriptor
import hudson.util.DescribableList
def isp = new InstallSourceProperty()
def autoInstaller = new AllureCommandlineInstaller("2.6.0")
isp.installers.add(autoInstaller)

Usage:

az resource list | python sort_for_deletion_parallel.py '^resources-to-delete.*' | while read CMD; do bash -xc "$CMD"; done
find /opt/jenkins_home/workspace/ -mindepth 1 -maxdepth 1 -type d -mtime +180 | while read WS; do [[ -z `find $WS -mtime -180` ]] && { echo $WS; echo $WS 1>&2; }; done | xargs -L 1 rm -rf
@k-popov
k-popov / check_node_old.sh
Created December 24, 2013 15:53
Tiny script that looks for CI nodes and outputs their uptime in minutes It's unable to cope with nodes running more than an day (separate output) and those which run less than hour (0 is printed)
#!/bin/bash
check_node() {
local ID="$1"
local NODE="$2"
UPTIME_LINE="$(ssh -q -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null $NODE uptime < /dev/null)"
if echo "${UPTIME_LINE}" | grep -q 'days'; then
echo "${ID}:${NODE}:OLDERTHANADAY"
return 0
fi