Skip to content

Instantly share code, notes, and snippets.

@tsukanov-as
tsukanov-as / truffle-material.md
Created June 2, 2019 17:00 — forked from smarr/truffle-material.md
Truffle: Languages and Material
// MIT License
// Copyright (c) 2019 Tsukanov Alexander
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
&НаКлиенте
Процедура Test(Команда)
ПараметрыВидео = Новый Структура;
ПараметрыВидео.Вставить("ЗаписьВидеоAmazonPollyTTSЯзык", "en-US");
ПараметрыВидео.Вставить("ЗаписьВидеоAmazonPollyTTSГолос", "Aditi");
ПараметрыВидео.Вставить("ЗаписьВидеоAmazonPollyTTSДвижок", "standard");
КлючДоступа = "AKIAIOSFODNN7EXAMPLE";
@tsukanov-as
tsukanov-as / ComObject.ps1
Created October 18, 2019 09:03
Класс-обертка для упрощения работы с 1С через COM
class ComObject {
[__ComObject] $object
ComObject($object) {
$this.object = $object
}
[Object] Get($name) {
$res = [__ComObject].InvokeMember($name, 'GetProperty', $null, $this.object, $null)
@tsukanov-as
tsukanov-as / tree.py
Created October 18, 2019 21:21
Сравнение дерева разбора и AST в питоне
import parser
import symbol
import token
from pprint import pprint
print('parse tree:')
x = parser.expr('1 + 2 * 3')
y = x.tolist()
import pathlib
import concurrent.futures
def parse(path):
cnt = 0
with open(str(path), 'r', encoding='utf-8-sig') as f:
for line in f.readlines():
x = line.strip()
if x and not x.startswith('//'):
cnt += 1
func (p *Parser) parseExpression() ast.Expr {
expr := p.parseAndExpr()
for p.tok == tokens.OR {
op := p.tok
p.scan()
expr = &ast.BinaryExpr{
Left: expr,
Operator: op,
Right: p.parseAndExpr(),
}
@tsukanov-as
tsukanov-as / copy_tables.py
Created April 12, 2020 09:43
Копирование живых таблиц базы 1С из сломаной базы в бэкап
"""
Сначала надо поставить библиотеку командой pip install pyodbc
"""
import pyodbc
server = 'localhost'
database = 'db_damaged'
username = 'sa'
password = 'пароль'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password, autocommit=True)
cursor = cnxn.cursor()
@tsukanov-as
tsukanov-as / README.md
Created December 24, 2020 08:34 — forked from physacco/README.md
Python 3 extension example

Python 3 extension example

Build

python3 setup.py build

Output: build/lib.macosx-10.11-x86_64-3.5/hello.cpython-35m-darwin.so

Run

@tsukanov-as
tsukanov-as / lujlu.lua
Created May 5, 2021 23:06 — forked from meepen/lujlu.lua
LuaJit VM in Lua. Comes with fully operational bytecode interpreter. License is: contact me before using it commercially. - Now runs itself inside itself and itself inside itself inside itself
local bytecodes = {}
local BC, run_function = {}
local VARG_CONST = {}
local lujlu_mt_funcs
local lujlu_cache = setmetatable({}, {__mode = "k"})
local lujlu_identifier_mt = {
__tostring = function(self)
return tostring(lujlu_cache[self].data)
end,