Skip to content

Instantly share code, notes, and snippets.

View arsenlosenko's full-sized avatar

Arsen Losenko arsenlosenko

  • Ukraine
View GitHub Profile
@arsenlosenko
arsenlosenko / print10.py
Created March 10, 2018 12:24
implementation of 10PRINT using python
import sys
import random
PROBABILITY = 40
def print10():
symbols_per_line = 150
symbol_num = 0
while True:
if symbol_num == symbols_per_line:
/* Created with info from here:
* https://learnxinyminutes.com/docs/scala/
*/
object SandBox {
def main(args: Array[String]): Unit = {
val str: String = "hello world C"
println("------------------------------------------")
println(">string methods")
#!/usr/bin/env python3
import sys
import random
import threading
from time import perf_counter
def gen_lists(n):
v1 = [i + random.randint(1, 9) for i in range(n)]
@arsenlosenko
arsenlosenko / transfer_sh_uploader.py
Created August 22, 2017 08:40
Script for uploading files to transfer.sh (https://transfer.sh/)
#!/usr/bin/env python3
"""
Author: Arsen Losenko (github: arsenlosenko)
Short description: Script that uploads files in entered directory as an archive to transfer.sh, for easy downloading.
"""
import os
import sys
import zipfile
@arsenlosenko
arsenlosenko / xvfb_wrapper_test_demo.py
Created August 13, 2017 11:48
Example of unittest test suite which is running in the save Xvfb session
#!/usr/bin/env python3
"""
Checked xvfbwrapper execution on three tests: positive, negative, and failed
"""
import unittest
import time
from selenium import webdriver
from xvfbwrapper import Xvfb
@arsenlosenko
arsenlosenko / pyautogui_demo.py
Created August 13, 2017 11:45
Example of PyAutoGUI framework for work automation outside of the browser
#!/usr/bin/env python3
"""
Example of PyAutoGUI framework for work automation outside of the browser
"""
import pyautogui
# get width and height of the display
width, height = pyautogui.size()
@arsenlosenko
arsenlosenko / unusual_unitttest_usecases.py
Created August 11, 2017 13:45
Unusual fixes or usecase for python unittest library
#!/usr/bin/env python3
import unittest
"""
Example test for running similar test
with parameters in a loop
"""
@arsenlosenko
arsenlosenko / gcd.py
Created August 9, 2017 09:21
Find GCD of two numbers in python
#!/usr/bin/env python3
def gcd():
m = int(input("Please enter first number:\n"))
n = int(input("Please enter second number:\n"))
if m > n:
num_list = range(m)
else:
num_list = range(n)
@arsenlosenko
arsenlosenko / json_import.py
Last active July 4, 2017 12:31
Script for import of json data into database
import subprocess
import json
import sys
#from imp import reload
#reload(sys)
#sys.setdefaultencoding('utf-8')
with open('country_codes.json', encoding='utf-8', ) as data_file:
data = json.load(data_file)
var mainArr = [ // основний массив
[5, 4, 1, 4],
[2, 6, 1, 6],
[3, 8, 2, 3]
];
var needs = [10, 6, 8]; //масив потреб
var stocks = [2, 4, 6, 7]; // масив запасів