Skip to content

Instantly share code, notes, and snippets.

View sky-code's full-sized avatar
😱
Kernel panic: …

Ihor Aleksandrov sky-code

😱
Kernel panic: …
View GitHub Profile
@sky-code
sky-code / README.md
Created July 4, 2017 01:22
Chrome blank new tab extension

Save the files in empty directory, which should not be deleted while this extension in use (eg. directory "Empty new tab page" in Documents ) and:

  • Go to Chrome Extensions page (chrome://extensions/)
  • Check "Developer mode" (upper right)
  • Click "Load unpacked extension..." and point to the directory where two files was saved Developer mode now could be turned off.

Now we've got absolutely blank new tab with absolutely blank URL field.

Note: newtab.html could be customized in a suitable way.

def clean_mongo_field_names(dict_object: Dict) -> List[Tuple[str, str]]:
"""
Patch a field names (keys) in dict for MongoDB, replace dot (.) symbol to uFF0E unicode symbol
and dollar ($) symbol to FF04 unicode symbol if they first symbol of field name
Args:
dict_object: dict object that will be patched
See Also:
https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names
http://www.fileformat.info/info/unicode/char/ff04/index.htm
http://www.fileformat.info/info/unicode/char/ff0e/index.htm
@sky-code
sky-code / CORS.rst
Created October 2, 2017 15:16
Cross-origin resource sharing and Same-origin policy introduction

Same-origin policy

Web security model is tightly connected to `Same-origin policy (SOP) <sop_>`__. In short: web pages cannot Read resources which origin doesn't match origin of requested page, but can Embed (or Execute) resources and have limited ability to Write resources.

Origin of a page is defined in the `Standard <cors_>`__ as tuple

@sky-code
sky-code / converters.py
Created April 25, 2018 21:57
django bson ObjectID url path validator
from bson.objectid import ObjectId
class ObjectIDConverter:
regex = '[0-9A-Fa-f]{24}'
def to_python(self, value):
if ObjectId.is_valid(value):
return value
raise ValueError()
"""
Exports Issues from a specified repository to a json files
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import json
import requests
@sky-code
sky-code / setup.py
Created August 30, 2018 15:19
setup.py install_requires from pipfile
from setuptools import setup
from pipenv.project import Project
from pipenv.utils import convert_deps_to_pip
def get_packages_from_Pipfile():
pipfile = Project(chdir=False).parsed_pipfile
return convert_deps_to_pip(pipfile['packages'], r=False)
000.0x1f4b0.com
001.0x1f4b0.com
002.0x1f4b0.com
003.0x1f4b0.com
004.0x1f4b0.com
005.0x1f4b0.com
006.0x1f4b0.com
007.0x1f4b0.com
008.0x1f4b0.com
009.0x1f4b0.com
@sky-code
sky-code / __init__.py
Created November 24, 2018 13:14
electrum plugin for get_tx_height rpc command
from electrum.commands import command, Commands
fullname = 'Get tx height'
description = 'Provides get_tx_height command for rpc daemon'
@command('')
def get_tx_height(self, tx_hash):
tx_mined_status = self.wallet.get_tx_height(tx_hash)
# noinspection PyProtectedMember
@sky-code
sky-code / __init__.py
Created November 24, 2018 13:15
electron-cash
from electroncash.commands import command, Commands
fullname = 'Get tx height'
description = 'Provides get_tx_height command for rpc daemon'
@command('')
def get_tx_height(self, tx_hash):
height, conf, timestamp = self.wallet.get_tx_height(tx_hash)
# noinspection PyProtectedMember
@sky-code
sky-code / README.md
Created June 24, 2019 00:38
Github export import issue labels