Skip to content

Instantly share code, notes, and snippets.

View Jimilian's full-sized avatar

Akbashev Alexander Jimilian

View GitHub Profile
@Jimilian
Jimilian / test_jenkins_api.py
Last active July 23, 2017 21:12
Compare performance of basic use cases for two the most popular python libraries for Jenkins
#!/usr/bin/python
from __future__ import absolute_import
import time
import jenkinsapi # python -m pip install jenkinsapi
import jenkins # python -m pip install python-jenkins
jenksins_url= # i.e. "http://myjenkins"
login=
@Jimilian
Jimilian / check_file_exists.py
Created August 17, 2016 06:41
In some cases exception-way could be much faster
from __future__ import print_function
import os
import timeit
test1="""
def check_file_classic():
if os.path.exists("asdfas"):
return 1
return 2
from __future__ import print_function
import pickle
try:
import cPickle
test_cPickle = True
except:
test_cPickle = False
import json
import marshal
import timeit
@Jimilian
Jimilian / key_value_pipe_to_json.sh
Last active January 20, 2023 08:11
Returns json created from pipe
#!/bin/bash
# Example:
# > echo "key1 value1 key2 value2" | ./key_value_pipe_to_json.sh
# {'key1': value1, 'key2': value2}
arr=();
while read x y;
do
@Jimilian
Jimilian / .vimrc
Last active December 30, 2016 12:56
Vim settings
" Standard configuration
filetype plugin indent on
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
" Enables paste mode
set pastetoggle=<F2>