Skip to content

Instantly share code, notes, and snippets.

View RMuskovets's full-sized avatar
🏠
home

Roman RMuskovets

🏠
home
View GitHub Profile
@RMuskovets
RMuskovets / pages.py
Created November 6, 2017 18:43
A Python 3.6 program that splits one file to some .txt documents with specified length in lines
#!/usr/bin/env python3
from urllib.request import urlopen
def slicefile(data, start, end):
import itertools
lines = data.splitlines()
return itertools.islice(lines, start, end)
def pages(data, lines):
count = 0
start, end = 0, lines
@RMuskovets
RMuskovets / pages-web.py
Created November 7, 2017 17:47
An utility that converts document to some .txt pages and can convert them to single HTML page
from urllib.request import urlopen
def slicefile(data, start, end):
import itertools
lines = data.splitlines()
return itertools.islice(lines, start, end)
def pages(data, lines):
count = 0
start, end = 0, lines
import os
@RMuskovets
RMuskovets / iDict.py
Last active June 28, 2018 12:19
A Python module that includes extended dict
class iDict(dict):
def __setitem__(self, key, item):
self.__dict__[key] = item
def __getitem__(self, key):
return self.__dict__[key]
def __repr__(self):
return repr(self.__dict__)
@RMuskovets
RMuskovets / morse.py
Created February 23, 2018 13:21 — forked from Saluev/morse.py
Morse code with Python unary + and - operators
# -*- coding: utf-8 -*-
morse_alphabet = {
"А" : ".-",
"Б" : "-...",
"В" : ".--",
"Г" : "--.",
"Д" : "-..",
"Е" : ".",
"Ж" : "...-",
@RMuskovets
RMuskovets / Bean2JSON.java
Last active August 6, 2018 06:35
JSON Serializer/Deserializer.
import javax.json.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
public class Bean2JSON {
public static void main(String[] args) throws Exception {
Object inst;
String json;
Class clazz = Class.forName(args[0]);
inst = clazz.newInstance();
A Python web framework with embedded HTTP server on port 8888.
You can connect Python method with server.bind(func, name), where
server is serverlib.WebServer object, func is function to bind (
it must return str object), and name is URI for newly created page.
When you call run() method, the web server starts, and really binds functions
with URIs.
@RMuskovets
RMuskovets / timeteller.py
Created December 13, 2018 16:29
Скажи мені час по-українськи
Ukrainian_Time = {
'minute': 'хвилина',
'hour': 'година',
'second': 'секунда',
'minutes': 'хвилин',
'hours': 'годин',
'seconds': 'секунд',
}
Ukrainian_Time_Numbers = [
return (n<2) ? n : (fibonacci(n-1) + fibonacci(n-2));
@RMuskovets
RMuskovets / sinoptik.py
Created March 10, 2019 18:33
Get weather data from the Sinoptik site!
import requests
from bs4 import BeautifulSoup as Parser
FILE = open('WEATHER', 'w') # Our output file
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Firefox/45.0' # Mozilla Firefox (to avoid blocking)
}
def get_data(date):
@RMuskovets
RMuskovets / fontawesome.txt
Created July 20, 2019 08:09
Font Awesome 5.9.0 Pro
https://kit-pro.fontawesome.com/releases/v5.9.0/css/pro.min.css