Skip to content

Instantly share code, notes, and snippets.

View basilevs's full-sized avatar

Vasili Gulevich basilevs

View GitHub Profile
@basilevs
basilevs / LeakDetector.java
Created April 25, 2025 17:22
A helper class to detect unclosed resources that were garbage collected
/*******************************************************************************
* Copyright (c) 2025 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
@basilevs
basilevs / CharacterSkippingReader.java
Created April 23, 2025 12:37
Untested java.io.Reader decorator that filters out a set of characters
/*******************************************************************************
* Copyright (c) 2025 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.basilevs.example.flush;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
final Display display = Display.getDefault();
final Image captureImage = new Image(display, display.getBounds().width, display.getBounds().height);
GC gc = new GC(display);
gc.copyArea(captureImage, display.getBounds().x, display.getBounds().y);
gc.dispose();
Imagewriter.write(...)
@basilevs
basilevs / jenkins-autologin.user.js
Created October 23, 2024 10:27
Jenkins auto-login
// ==UserScript==
// @name Jenkins auto-login
// @version 1
// @match https://jenkins-itest.spirenteng.com/jenkins/*
// @match https://ci.eclipse.org/*
// @grant none
// ==/UserScript==
function findSingleNode(query) {
const buttons = document.evaluate(query, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE);
@basilevs
basilevs / Jenkinsfile
Last active October 11, 2024 09:58
Minimal declarative Jenkins pipeline definition
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '2', daysToKeepStr: '7', removeLastBuild: true))
}
stages {
stage("test") {
steps {
echo "q"
@basilevs
basilevs / hide_pipeline_success.user.js
Last active October 20, 2024 17:11
Hide successful Jenkins Pipeline steps
// ==UserScript==
// @name Hide successful pipeline steps
// @version 5
// @grant GM.setValue
// @grant GM.getValue
// @match https://jenkins-itest.spirenteng.com/jenkins*/job/*/flowGraphTable/
// @match https://ci.eclipse.org/*/job/*/flowGraphTable/
// ==/UserScript==
@basilevs
basilevs / rcptt_artifact_links.user.js
Last active September 3, 2024 13:18
Add useful artifact links to RCPTT build page.
@basilevs
basilevs / cleanupJenkinsWorkspaces.groovy
Last active January 31, 2023 20:06 — forked from EvilBeaver/cleanupJenkinsWorkspaces.groovy
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 50 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
@basilevs
basilevs / gist:9645529d4738e8d6b363ac475af6f297
Last active November 17, 2022 18:33
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
import org.jenkinsci.plugins.workflow.job.WorkflowRun
import org.jenkinsci.plugins.workflow.flow.FlowExecution;