Skip to content

Instantly share code, notes, and snippets.

Alexander Okrugin aviafelix

  • Yaroslavl
View GitHub Profile
@aviafelix
aviafelix / puzzle.py
Created Oct 31, 2018
mail.ru: birthday quest '18
View puzzle.py
#!/usr/bin/env python3
from pprint import pprint
REPLACERS = {
'А' : 'О',
'а' : 'о',
'Б' : 'П',
'б' : 'п',
'В' : 'Р',
'в' : 'р',
@aviafelix
aviafelix / compare_json_msgpack_python.md
Last active May 6, 2018
Compare json, simplejson, ujson, msgpack, umsgpack, cbor, cbor2, flunn on CPython 3.5.2, Ubuntu, VMware Player
View compare_json_msgpack_python.md

Compare json, simplejson, ujson, msgpack, umsgpack, cbor, cbor2, flunn performance on CPython 3.5.2

Tests were performed on Ubuntu 16.04 guest OS running on VMware Player

import timeit
timeit.timeit(
    'qwerty.dumps(data)',
    setup='import {lib} as qwerty\nfrom test_json import data\n',
    number=1000)
@aviafelix
aviafelix / rkn_business.py
Created May 5, 2018
RKN: Nothing personal
View rkn_business.py
#!/usr/bin/env python3
STRING_RKNZ = "Роскомнадзор запретил букву"
def gen_rualphabet_uppercase():
"""
"""
l = list(chr(l) for l in range(ord('А'), ord('Я')+1))
l.insert(ord('Е') - ord('А') + 1, 'Ё')
return "".join(l)
View .bash_history_ceph_aviafelix
sudo -i
su root
sudo -i
sudo shutdown -s
sudo shutdown -t 0
ip addr show
sudo yum install kbd
loadkeys sk
sudo loadkeys sk
localectl list=kezmaps
@aviafelix
aviafelix / start_browser_windows.cmd
Last active Mar 13, 2018
Launch browser from command line in Windows
View start_browser_windows.cmd
:: Launch browser for testing
@echo off
echo
set CHROME_BROWSER_PATH=C:\Program Files^ (x86)\Google\Chrome\Application\
set CHROME_EXEC=chrome.exe
set CHROME_USER_DATA="%~dp0%project_name_user_data"
set CHROME_PARAMS=--user-data-dir=%CHROME_USER_DATA% ^
--start-maximized ^
--no-first-run ^
--no-default-browser-check ^
@aviafelix
aviafelix / another_patcher.py
Last active Apr 6, 2020
Patching binary files with Python
View another_patcher.py
#/usr/bin/env python3
"""
Yet another simple binary patcher
"""
patches = [
{
# 1 Windows x64, version 3, build 1234
'file': 'file_1.bin',
'offset': 0x0BA950,
'original': b'\x00',
@aviafelix
aviafelix / site.conf
Created May 2, 2016 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
View site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
You can’t perform that action at this time.