Skip to content

Instantly share code, notes, and snippets.

import jenkins
import os
jenkins = os.environ['JENKINS_IP']
password = os.environ['PASSWORD']
user = os.environ['JENKINS_USER']
server = jenkins.Jenkins(jenkins, username=user, password=password)
user = server.get_whoami()
version = server.get_version()
print('Hello %s from Jenkins %s' % (user['fullName'], version))
@pavelch
pavelch / access_log_analysis.sh
Last active June 23, 2018 15:29
Please provide source file and destination path
#!/usr/bin/env bash
# Execute script example ./log_to_list.sh ~/Downloads/NASA_access_log_Jul95 ~/temp
# prevent Illegal characters in sort
export LC_CTYPE=C
input_file=$1
output_path=$2
@pavelch
pavelch / print_duplicated.py
Last active June 14, 2018 10:04
List directory, print duplicated files names
#!/usr/bin/env python
"""List directory, print duplicated files names
"""
from __future__ import print_function
import os
import argparse
import hashlib
import sys
@pavelch
pavelch / famous.py
Created May 16, 2017 11:22
python famous test
def knows(person1, person2):
#if person1 knows person2
return True
def famous(persons):
famous = []
for person in persons:
if all(map(lambda x: knows(x, person), persons)) and not all(map(lambda x: knows(person, x), persons)):
famous.add(person)
return famous
@pavelch
pavelch / keybase.md
Created June 20, 2016 10:22
Identity prove

Keybase proof

I hereby claim:

  • I am pavelch on github.
  • I am pavelch (https://keybase.io/pavelch) on keybase.
  • I have a public key ASBCijLW8I5KwtVuQ7rvN5cUXZTgG03X_dJRGZzR3QTbHgo

To claim this, I am signing this object:

$ServicesAll = @('Verne Config', 'VerneController', 'VerneIndexer','Tomcat8', 'OM_Configuration_Service', 'OM_Application_Server', 'OM_Robot_Store_Service', 'OM_Steam_Manager_Service', 'OM_Task_Manager_Service', 'OMCrawlerAdapter0', 'OMCrawlerAdapter1', 'OMCrawlerAdapterWatchDog', 'CodeCrawlerAdapter')
foreach ($service in $ServicesAll) {
$Srv = Get-Service -Name $service -ErrorAction SilentlyContinue
$stat = $Srv.Status
if ($stat) {
Write-Output "$service IS: $stat"
}
}
@pavelch
pavelch / updateIp.ps1
Last active April 11, 2016 20:44
PowerShell update IP
$path = 'C:\Verne\Data\Config\VerneConfig.omcfg'
$ip = ''
$out = Get-CFNStackResourceSummary -StackName "AWSCloudFormer" | Out-String
$sums = [regex]::split($out, "LastUpdatedTimestamp.*\r\n")
foreach ($sum in $sums) {
if ($sum -Match "LogicalResourceId\s*:\s*InvestigatorFarm") {
$ip = $sum | sls '(?<=PhysicalResourceId\s*:\s*)(.*)(?=\r\n)' | select -expa matches | select -expa value | % { $_.trim() }
}