Skip to content

Instantly share code, notes, and snippets.

View VladSem's full-sized avatar

Sevlan VladSem

View GitHub Profile
@VladSem
VladSem / bios_version.py
Last active October 1, 2015 05:44
selenium/webdriver wait for element and get text using python
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
browser = webdriver.Firefox()
browser.get("http://qa/")
t = browser.title
print t
bios_button = browser.find_element_by_xpath("html/body/div[2]/table/tbody/tr[1]/td[1]/a").click()
@VladSem
VladSem / tmux2_raspberry.sh
Created May 23, 2015 05:43
install tmux 2.0 on Raspberry Pi (Debian 7.8) Raspbian Wheezy
#!/bin/bash
wget "https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make verify
sudo make install
sudo ldconfig
@VladSem
VladSem / tmux_ubuntu14.04.sh
Last active July 7, 2020 21:12
install tmux 2.0 on Ubuntu 14.04
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux=2.0-1~ppa1~t
@VladSem
VladSem / tmux_ubuntu.sh
Last active August 29, 2015 14:21
install tmux 1.9 and 2.0 on Ubuntu 12.04, 13.10, 14.10, 15.04
ubuntu 12.04 (Precise Pangolin) шаг 5: sudo apt-get install -y tmux=1.9a-1~ppa1~p (пока только tmux 1.9)
ubuntu 13.10 (Saucy Salamander) шаг 5: sudo apt-get install -y tmux=1.9a-1~ppa1~s (пока только tmux 1.9)
ubuntu 14.10 (Utopic Unicorn) шаг 5: sudo apt-get install -y tmux=2.0-1~ppa1~u
ubuntu 15.04 (Vivid Vervet) шаг 5: sudo apt-get install -y tmux=2.0-1~ppa1~v
@VladSem
VladSem / find_firmware.py
Last active October 1, 2015 05:42
how to find text between two specific characters in Firefox XPath and Python
# Firefox XPath
# Full XPath = html/body/div[5]/form/table/tbody/tr/td[2]/table/tbody/tr/td/div/span[4]
# Result: SWI9X15C_05.05.16.02 r21040 carmd-fwbuild1 2014/03/17 23:49:48
# XPath: substring-before(substring-after(//span[4], 'C_'), ' r')
# Result: 05.05.16.02
# Python Selenium/Webdriver
@VladSem
VladSem / remove_all_whitespace.py
Last active October 1, 2015 05:41
(Python) How to remove all whitespace from string and how to capitalize the first letter of each word in a string?
#!/usr/bin/python
# -*- coding: utf-8 -*-
string_name = "hi Vlad, welcome to the California"
def mv_uppercase_rm_whitespaces(string_name):
a = string_name.title() # capitalize the first letter
b = a.replace(',', '') # remove comma
c = b.replace(' ', '') # remove whitespace
@VladSem
VladSem / elapsed_time.py
Last active October 1, 2015 05:36
Pyhon: elapsed time
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
modem_status = ''
start_time = time.time()
attempts_time = 0
@VladSem
VladSem / modem_conn_validator_and_timeout.py
Last active October 1, 2015 05:34
Python: Modem connection validator plus timeout...
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
from main_driver import driver
def check_modem_connection_status(path_to_modem_connection, path_to_reconnect_button):
modem_status = driver.find_element_by_xpath(path_to_modem_connection).text
start_time = time.time()
@VladSem
VladSem / main.py
Last active November 22, 2015 04:05
Python/Kivy. This code will create button with text "Hello World"
#!/usr/bin/kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.core.window import Window
class TestApp(App):
Window.size = (320, 240)
title = 'vswebschool.blogspot.com'
@VladSem
VladSem / screen.sh
Last active November 25, 2015 03:17
This script help you change the brightness on your laptop (tested on Asus and Intel chipset)
#!/bin/bash
VALUE="$(cat /sys/class/backlight/intel_backlight/brightness)"
echo "Your carrent brightness is: ${VALUE}"
echo "Input your value of brightness: "
read INPUT
echo $INPUT | tee /sys/class/backlight/intel_backlight/brightness