Skip to content

Instantly share code, notes, and snippets.

View sergeyfarin's full-sized avatar

Sergey Farin sergeyfarin

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergeyfarin
sergeyfarin / initial.sh
Last active August 26, 2018 13:34
VPS Ubuntu 18.04 setup via SSH
echo -e "This script will do \e[1minitial setup of VPS with Ubuntu 18.04\e[22m (from OVH, but will also work with many others)"
echo ""
echo -e "\e[1mDefining required parameters\e[22m"
echo -ne "Please enter \e[1mIP address\e[22m of new VPS: " && read vps_ip
echo -ne "Please enter \e[1musername\e[22m to create main user in your new VPS:" && read username
echo -e "'\e[38;2;255;127;0mNot asking for passwords, you will be prompted as required\e[39m"
echo ""
echo -e "Connecting to new VPS as \e[1mroot\e[22m first time"
echo -e "You will need to enter password that you should have received by e-mail from OVH"
ssh root@$vps_ip username='$username' /bin/bash <<'EOT'
@sergeyfarin
sergeyfarin / pyqt5_qwebengineview.py
Last active March 6, 2024 07:24
Example of using Python, PyQt5 and QtWebEngineView to open local html file (+js, css). test.html and test.js should be in html subfolder
# coding: utf-8
import sys
import os
# import site
# site.addsitedir('/usr/local/lib/python2.7/site-packages')
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
app = QtWidgets.QApplication(sys.argv)
view = QtWebEngineWidgets.QWebEngineView()
@sergeyfarin
sergeyfarin / currency_exchange.py
Last active December 29, 2015 04:59
Get currency exchange rate in python
import json
import urllib2
json.loads(urllib2.urlopen("http://rate-exchange.appspot.com/currency?from=EUR&to=RUB").read())['rate']