Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Light My Fire!

Mikhail Kashkin xen

🔥
Light My Fire!
View GitHub Profile
@xen
xen / Audio Recorder.py
Created Jun 28, 2020 — forked from omz/Audio Recorder.py
Audio Recorder.py
View Audio Recorder.py
from ctypes import c_void_p, c_char_p, c_double, c_float, c_int, cdll, util, c_bool
import os
import time
# Load Objective-C runtime:
objc = cdll.LoadLibrary(util.find_library('objc'))
objc.sel_getName.restype = c_char_p
objc.sel_getName.argtypes = [c_void_p]
objc.sel_registerName.restype = c_void_p
objc.sel_registerName.argtypes = [c_char_p]
View snippet.py
# django shell console logging SQL queries
import logging
logger = logging.getLogger('django.db.backends')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
View morse.py
codes = {
"А": ".-",
"Б": "-...",
"В": ".--",
"Г": "--.",
"Д": "-..",
"Е": ".",
"Ж": "...-",
"З": "--..",
"И": "..",
View tos.md
title
Курс "Magic Python для начинающих"

Добро пожаловать на курс "Магия Python для начинающих"

Содержание лекций:

Вводная часть:

View 1-provider.py
from web3 import Web3, HTTPProvider, IPCProvider
web3 = Web3(IPCProvider('/Users/xen/Library/Ethereum/rinkeby/geth.ipc'))
# web3 = Web3(IPCProvider('/Users/xen/Library/Ethereum/geth.ipc'))
print(web3.eth.blockNumber)
print(web3.eth.accounts)
@xen
xen / check_hash.py
Last active Jul 7, 2020
telegram site auth
View check_hash.py
# implementation of Telegram site authorization checking algorithm
# for more information https://core.telegram.org/widgets/login#checking-authorization
import collections
import hmac
import hashlib
def check_string(d, token):
secret = hashlib.sha256()
secret.update(token.encode('utf-8'))
@xen
xen / jinja.json
Last active Jul 5, 2018
VS Code Jinja2 snippets
View jinja.json
{
"i18n": {
"prefix": "_",
"body": [
"{{ _('${TM_SELECTED_TEXT:${1:text}}') }}"
],
"description": "i18n"
},
"gt": {
"prefix": "gt",
@xen
xen / check_erdpou.py
Last active Aug 23, 2016
Алгоритм проверки ЕГРПОУ / Алгоритм перевіркі ЄДРПОУ
View check_erdpou.py
import operator
def check_erdpou(code):
""" Алгоритм проверки кода ЕРДПОУ """
code = int(code)
def check(sec, shift=False, step=0):
""" Генерация контрольного числа """
nums = list(range(1 + step, 8 + step))
if shift:
nums.insert(0, nums.pop(6))
@xen
xen / isretina.py
Last active Jun 22, 2016
isretina.py
View isretina.py
from objc_util import *
us = ObjCClass('UIScreen')
if us.mainScreen().scale() == 2.0:
print('Retina')
elif us.mainScreen().scale() == 3.0:
print('iPhone 6 Plus')
else:
print('Non retina')
View pip.conf
# cat ~/.pip/pip.conf
[global]
default-timeout = 60
respect-virtualenv = true
#download-cache = /home/xen/.pip/cache
log-file = /home/xen/.pip/pip.log
use-wheel = yes
find-links = /home/xen/.pip/wheels
[wheel]
You can’t perform that action at this time.