Usage:
az resource list | python sort_for_deletion_parallel.py '^resources-to-delete.*' | while read CMD; do bash -xc "$CMD"; done
f = lambda x: int(x)>0 and int(x[::-1]) or -int(x.strip("-")[::-1]); print f(str(sum([f(x) for x in raw_input().split()]))) |
#define _GNU_SOURCE | |
#include <sys/wait.h> | |
#include <sys/utsname.h> | |
#include <sched.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/sem.h> |
#define _GNU_SOURCE | |
#include <sys/wait.h> | |
#include <sys/utsname.h> | |
#include <sched.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> |
#!/bin/sh | |
M2DIR=~/.m2 | |
MAXAGE="864000" # 10 days in sec | |
NOW="`date +%s`" | |
MAXOLD="$(($NOW - $MAXAGE))" # files older than this will be removed. See further | |
# get list or artifact ID's prependede with group | |
find $M2DIR -iname "*.pom" \ | |
| xargs dirname | xargs dirname \ # dirname twice gives a directory 1 level up the version | |
| sort | uniq \ | |
| while read ARTIFACT; do |
#!/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 |
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 |
Usage:
az resource list | python sort_for_deletion_parallel.py '^resources-to-delete.*' | while read CMD; do bash -xc "$CMD"; done
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) |
GridU Azure capstone
#!/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:]: |