Skip to content

Instantly share code, notes, and snippets.

View KenDUemura's full-sized avatar

Ken D: Uemura KenDUemura

View GitHub Profile
/*
* Copyright (c) 2002-2004
* All rights reserved.
*/
package com.atlassian.jira.mail;
import java.util.HashMap;
import java.util.Map;
@KenDUemura
KenDUemura / UpdateAssigneeOnComponentChangeListener.groovy
Last active June 25, 2020 15:39
Script Runner Listener for Re-assigning to Component Lead when Component is changed
/**
* Created by Ken D: Uemura <kenduemura@gmail.com> on 6/1/2016.
*
* On Issue Update Event
* If Component is changed and only one component is assigned
* then re-assigns the issue to the Component Lead
*
* Tested with JIRA 6.4.11
* Set this in Add-On -> Script Lisner -> Custom Listener
*
@KenDUemura
KenDUemura / getTableByXpath.gs
Last active October 19, 2020 03:39
Google Apps Script for parse table element from HTML string parsed with XmlService and returns 2D array
/*
PARAMS:
text XML (In this gist, namespace needs to be 'http://www.w3.org/1999/xhtml')
path XPATH (So far tested with simple indexed lookup /html/body/table[3])
RETURNS:
Array[][] (Table data)
Missing th/thead/tfoot support
*/
@KenDUemura
KenDUemura / update_assignee_onComponentChange.groovy
Created July 19, 2016 23:52
Scriptrunner server for assigning to Component owner when Component is updated.
/**
* Created by kuemura on 6/1/2016.
*
* On Issue Update Event
* If Component is changed and only one component is assigned
* then re-assigns the issue to the Component Lead
*/
import com.atlassian.crowd.embedded.api.User
@KenDUemura
KenDUemura / AssignIssueToComponentOwnerListener.groovy
Last active April 18, 2024 09:43
Set this in Scriptrunner's Script Listeners, listen to issue update event to automatically re-assign issue to the Component Owner when Component changed.
/**
* On Issue Update Event
* If Component is changed and only one component is assigned
* then re-assigns the issue to the Component Lead
*/
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.component.ComponentAccessor
@KenDUemura
KenDUemura / add_comment_gerrit_multiline.py
Last active October 14, 2022 10:51
Multiline review message with python gerritlib
import logging
import gerritlib.gerrit as gerrit
logging.basicConfig(level=logging.DEBUG)
message = """Gerrit review message
Links automatically becomes link http://www.google.com
But newlines need to be doubled
@KenDUemura
KenDUemura / gist:48856cc1e9cd1aedf041b602ce89bf15
Created September 29, 2016 23:31
Jenkins Pipeline, Get current Job's Folder Name
def getFolderName() {
def array = pwd().split("/")
return array[array.length - 2];
}
node(){
stage 'Get Folder Name'
def foldername = getFolderName()
print "${foldername}"
import shlex
from subprocess import Popen, PIPE
def run_shell(cmd):
"""
Execute the external command and get its exitcode, stdout and stderr.
"""
args = shlex.split(cmd)
proc = Popen(args, stdout=PIPE, stderr=PIPE)
<html>
<h1>Hello world</h1>
</html>
@KenDUemura
KenDUemura / bulk_install.sh
Last active November 21, 2022 18:08
Bulk install amazing tools with Rust
#!/bin/bash
LIST="cargo-edit \
bat \
zoxide \
xcp \
choose \
dua-cli \
exa \
fd-find \