Skip to content

Instantly share code, notes, and snippets.

View EvAlex's full-sized avatar

Alexander Pavlyuk EvAlex

  • Qoollo
  • Moscow, The Russian Federation
View GitHub Profile
EvAlex / print-jira-users-status.js
Last active December 26, 2017 11:38
Jira - users remaining till license limit
View print-jira-users-status.js
* Useful when you have more users in Jira than your license limit allows and some of them are inactive.
* Say, you have 89 users, while your license allows only 50. Some of current users are inactive.
* You hired 2 people and want to find out whether there's enough room for them. And if not - which users
* are candidates for removal. Problem is there's no "only active" filter and no sorting by last login date
* on users page in Jira. This script helps solve these problems.
* To use this script:
* - go to Administration in your Jira
* - go to Users page
EvAlex / event-debouncer.ts
Last active July 20, 2017 20:25
EventDebounvcer for Angular
View event-debouncer.ts
import { Renderer2, NgZone } from '@angular/core';
import { Subject } from 'rxjs/Subject';
export class EventDebouncer {
constructor(private _zone: NgZone, private _renderer: Renderer2) {
target: 'window' | 'document' | 'body' | any,
eventName: string,
EvAlex /
Created July 8, 2017 06:49
Shell script to perform git feature branch merge with squash preserving author
set -e
function select_branch() {
echo "Not merged branches on origin:"
branches=`git branch --list -r --no-merged`
IFS=$'\n' read -d '' -r -a branches_arr <<< "$branches" || true # dunno why, IFS raises error code
if [ ${#branches_arr[@]} -eq 0 ]; then
echo "\e[93mNo unmerged remote branches found\e[0m"
EvAlex / stateful-observer.ts
Created May 12, 2017 09:10
View stateful-observer.ts
import { Observer, Observable, ReplaySubject, Subscriber } from 'rxjs/Rx';
interface IObserver<T> {
next(value?: T): void;
error(err: any): void;
complete(): void;
* Provides Observer interface implementation that is handy for use in data-binding
EvAlex / color.ts
Created April 20, 2017 06:52
TypeScript Color class, useful to manipulate rgba components and convert to rga/rgba/hex
View color.ts
export const RGB_COLOR_REGEX = /\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d*.\d*))?\)/;
export class Color {
public r: number;
public g: number;
public b: number;
public a: number;
constructor(colorStr?: string)
EvAlex / timer.ts
Last active April 20, 2017 00:26
TypeScript Timer based on requestAnimationFrame()
View timer.ts
class Timer {
private _tasks: ITimerTask[] = [];
private _enabled = false;
register(fn: Function, period: number, dueTime = 0): number {
const id = =>, c) => p > c ? p : c, 0) + 1;
id: id,
registerTime: new Date(),
EvAlex / process_ram_usage_windows.rb
Last active April 20, 2017 11:37
Get Process RAM usage in Windows - Ruby
View process_ram_usage_windows.rb
require 'CSV';
def get_ram_usage(pid)
output = CSV.parse(`tasklist /FO CSV /V /FI "PID eq #{pid}"`)
# Column name is "Mem Usage". Usually it's 5-th column (index 4)
col_index = output[0] { |i| output[0][i] =~ /mem/i }.first || 4
parse_usage_str output[1][col_index]
def parse_usage_str(str)