Skip to content

Instantly share code, notes, and snippets.

View RMuskovets's full-sized avatar
🏠
home

Roman RMuskovets

🏠
home
View GitHub Profile
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 / 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();
@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 / 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 / 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 / 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