Skip to content

Instantly share code, notes, and snippets.

@akomakom
akomakom / SemVer.groovy
Last active February 1, 2024 19:58 — forked from michaellihs/SemVer.groovy
Semantic Versioning class for Groovy
/**
* This evolved from pure SemVer to any-length version with optional -suffix
* accepts any of:
* 1
* 1.2
* 1.2.3
* 1.2.3.4 (etc, no limit)
* 1.2.3-SNAPSHOT
*
* bump() also accepts index values, eg -1 (last component), -2 (second from end), etc:
#!/usr/bin/env python3
from subprocess import check_output
from re import findall, DOTALL, MULTILINE
import psutil
def log(s):
check_output(['logger', '-t', __file__, s])
inputs = findall(r'.*?index: (\d+).*?sink: (\d+).*?application\.process\.id = "(\d+)"',
@akomakom
akomakom / git_svn_bash_prompt.sh
Last active September 19, 2018 18:15 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
@akomakom
akomakom / init.gradle
Last active March 29, 2018 15:27 — forked from mosabua/init.gradle
init.gradle file for proxying all repositories with Sonatype Nexus, with blacklisting feature for excluded projects. also adds plugin repository handling and a disable flag
/**
* init.gradle file for development using Nexus as proxy repository
*
* @author Manfred Moser <manfred@simpligility.com
* akom added blacklisting feature to leave certain projects alone.
*/
apply plugin: NexusRepositoryPlugin
class NexusRepositoryPlugin implements Plugin<Gradle> {
@akomakom
akomakom / russian-phonetic-like-linux.klc
Last active April 16, 2017 20:36 — forked from max630/gist:2872656
Russian phonetic layout for MS Keyboard Layout Creator 1.4 (Windows 7). Layout is the same as the standard Russian-Phonetic keyboard in Ubuntu. (Ч on +, Ю on `, Э on \). Layout Creator 1.4 would not load https://gist.github.com/max630/2872656, so I rebuilt it from scratch.
KBD RU_P "Russian - Phonetic Akom"
COPYRIGHT "(c) 2017 Akom"
COMPANY "Akom"
LOCALENAME "ru-RU"
LOCALEID "00000419"
@akomakom
akomakom / jenkins-groovy-system-script.groovy
Last active October 21, 2022 17:32 — forked from rb2k/gist:8372402
A jenkins script to clean up workspaces on slaves. On all slaves with less than X free GB, this script removes /slaves/workspace/* if slave is idle. If not idle, it removes /full/job/workspace/path for each job that isn't currently running. There are two versions: a "System Groovy Script" and a Jenkinsfile (Pipeline script)
/**
Jenkins System Groovy script to clean up workspaces on all slaves.
Check if a slave has < X GB of free space, perform cleanup if it's less.
If slave is idle, wipe out everything in the workspace directory as well any extra configured directories.
If slave is busy, wipe out individual job workspace directories for jobs that aren't running.
Either way, remove custom workspaces also if they aren't in use.
**/
import hudson.model.*;