Skip to content

Instantly share code, notes, and snippets.

View aviafelix's full-sized avatar

Alexander Okrugin aviafelix

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

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 12:32
RKN: Nothing personal
#!/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)
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 March 13, 2018 14:05
Launch browser from command line in Windows
:: 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 February 26, 2024 02:32
Patching binary files with Python
#/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 21:27 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# 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