Skip to content

Instantly share code, notes, and snippets.

View movax01h's full-sized avatar

Anton Okhontsev movax01h

View GitHub Profile
@movax01h
movax01h / low_rights_command_wrapper.bat
Last active October 19, 2018 13:41
How to run command as user from cmd with admin rights
// These sripts are very useful for testing desktop apllications with UAC requests.
// Run this command in cmd with admin rights.
// Run another cmd as user via powershell.
// cmd(admin) -> powershell(admin) -> cmd(user)
powershell -noprofile -command "&{"^
"$username = 'admin';"^
"$password = 'admin';"^
"$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;"^
"$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword;"^
@movax01h
movax01h / folder_cleaner.groovy
Last active July 1, 2017 07:49
Jenkins Groovy Folder Cleaner script
import hudson.model.*
import com.cloudbees.hudson.plugins.folder.*
NOT_REMOVED_FOLDERS = ['custom-builds', 'nightly-builds', 'tests-builds', 'current_beta_mac', 'current_beta_win', 'master_beta_mac', 'master_beta_win', 'master_canary_mac', 'master_canary_win', 'next_beta_mac', 'next_beta_win']
NOT_REMOVED_JOBS = ['_flag_', '_results_', '_runner_', 'nightly-trigger', 'complex-launcher', '_simple-launcher']
UNUSED_DAYS_FOR_FOLDER = 30
UNUSED_DAYS_FOR_JOB = 14
CURRENT_DATE = new Date(System.currentTimeMillis())
enum CleanTypes{
@movax01h
movax01h / proxy.py
Last active March 29, 2019 16:32
Enable proxy via ctypes on Windows
# -*- coding: utf-8 -*-
from ctypes import *
from ctypes.wintypes import *
# stick to unicode version
LPWSTR = POINTER(WCHAR)
HINTERNET = LPVOID
INTERNET_PER_CONN_FLAGS = 1
@movax01h
movax01h / QAStartJobInJenkins
Created January 23, 2015 13:17
Jira 6.3.8. Groovy
import com.atlassian.jira.ComponentManager
import groovyx.net.http.HTTPBuilder
componentManager = ComponentManager.getInstance()
issueService = componentManager.getIssueService()
customFieldManager = componentManager.getCustomFieldManager()
authenticationContext = componentManager.getJiraAuthenticationContext()
println 'QA. Start preformance loading for release issue.'
@movax01h
movax01h / QAChangeStatusReleaseLinksIssues.py
Created September 19, 2014 12:45
Jira 4.4. Change statuses from linked into tickets. Language Jython
import sys
from com.atlassian.jira.util import ImportUtils
from com.atlassian.jira import ComponentManager
from com.atlassian.jira.issue import IssueInputParametersImpl
issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext()
issueService = ComponentManager.getInstance().getIssueService()
workflowManager = ComponentManager.getInstance().getWorkflowManager()
@movax01h
movax01h / TMSCrateTestRunSubTasks.py
Created September 18, 2014 10:16
Jira 4.4. Create sub-task. Language Jython
import sys
from com.atlassian.jira.util import ImportUtils
from com.atlassian.jira import ComponentManager
issueManager = ComponentManager.getInstance().getIssueManager()
customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
issueFactory = ComponentManager.getInstance().getIssueFactory()
authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext()
@movax01h
movax01h / QAUpdateReleaseScope.py
Last active August 29, 2015 14:06
Jira 4.4. Change custom field (Release Scope) with linked issues. Language Jython
import sys
import re
import unicodedata
from com.atlassian.jira.util import ImportUtils
from com.atlassian.jira import ComponentManager
issueManager = ComponentManager.getInstance().getIssueManager()
customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
@movax01h
movax01h / multiprocessing_shared_dict
Created August 28, 2014 13:27
Хранения данных, собираемой из нескольких процессов python
from multiprocessing import Pool, Manager, Lock, RLock
lock = RLock()
manager = Manager()
stats_dict = manager.dict()
def save_stats(x):
lock.acquire()
if not 'test' in stats_dict: