Skip to content

Instantly share code, notes, and snippets.

View victory-sokolov's full-sized avatar
🎯
Focusing

Viktor Sokolov victory-sokolov

🎯
Focusing
View GitHub Profile
.image {
position: relative;
background: #f5f5f5;
max-width: 100%;
max-height: 100%;
overflow: hidden;
}
.image:after {
@victory-sokolov
victory-sokolov / equal_height.css
Last active January 21, 2019 09:23
Equal Height
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.row > [class*='col-'] {
display: flex;
@victory-sokolov
victory-sokolov / driver_options.py
Last active November 23, 2023 14:39
Selenium Driver options
''' Firefox Driver options '''
options = webdriver.FirefoxOptions()
# disable push notifications
options.set_preference("dom.push.enabled", False)
# maximize window size
driver.maximize_window()
@victory-sokolov
victory-sokolov / bash_tips.sh
Last active November 23, 2023 14:39
Bash Tips/Tricks
# find folder location by folder name
dir=$(sudo find $HOME -type d -name folderName)
cd $dir
# print file data that starts from specific text
cat .flake8 | sed -n -e '/exclude = /,$p'
@victory-sokolov
victory-sokolov / getCssStyle.js
Last active November 23, 2023 14:39
return css property font-size
const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName];
getStyle(document.querySelector('p'), 'font-size'); // '16px'
@victory-sokolov
victory-sokolov / ExecuteScritpAsAdmin.ps1
Created March 13, 2019 17:16
Execute PowerShell script as admin
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
@victory-sokolov
victory-sokolov / regex_patterns.js
Last active November 23, 2023 14:38
JS Regex Patterns
/* Common Regular Expressions */
// Match domain (com,net,ru)
let url = "https://www.youtube.com/watch?v=vEPOU_fKmR8";
url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
let site = matches && matches[1];
@victory-sokolov
victory-sokolov / excel-to-pdf.py
Created December 31, 2019 09:26
Converts xlsx,csv to PDF file
# Note Microsoft Excel must be installed
from openpyxl import Workbook, load_workbook
from win32com.client import Dispatch
path = os.path.dirname(os.path.abspath(__file__))
o = Dispatch("Excel.Application")
o.Visible = False
o.DisplayAlerts = False
@victory-sokolov
victory-sokolov / io-json.java
Created December 31, 2019 09:28
Read/Write JSON
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public static JSONObject readJSON(String file) throws IOException, ParseException {
JSONParser parser = new JSONParser();
FileReader config = new FileReader(file);
Object obj = parser.parse(config);
return (JSONObject) obj;
@victory-sokolov
victory-sokolov / split_list_n_parts.py
Created January 6, 2020 12:41
Split list into n parts
def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n]
lst = [1,3,5,6,7,9,5,4,2,3,5,6,7,4,3]
res = list(chunks(lst, 3))
print(res) # [[1, 3, 5], [6, 7, 9], [5, 4, 2], [3, 5, 6], [7, 4, 3]]