Skip to content

Instantly share code, notes, and snippets.

@tsukanov-as
tsukanov-as / uia-sample.ps1
Created September 26, 2018 18:16 — forked from xiongjia/uia-sample.ps1
A simple sample for access the MS UIAutomation in PowerShell. #devsample #win
#REQUIRES -Version 3.0
# This is a simple sample for access the MS UIAutomation in PowerShell.
# In this sample:
# 1. Load the MS UIA via System.Reflection.Assembly
# 2. Launch the AUT ( calc.exe )
# 3. Find the AutomationElement via the AUT Process Id
# 4. Find buttons via 'ClassName' and 'Name' property
# 5. Click the '1', '+', '1', '=' buttons.
# At last, we will get '2' in the result of calc App.
@tsukanov-as
tsukanov-as / readme.md
Created September 27, 2018 20:11 — forked from artbear/readme.md
Как регулярными выражениями искать в Visual Studio Code многострочные строки - в т.ч. и пустые строки

В окне модуля - Ctrl+F

  • ^Процедура\s+[a-zA-Z0-9А-Яа-яёЁ_]+\(\)\s+Экспорт\s*\n\s*КонецПроцедуры
    • используем \n

В окне поиска файлов - Ctrl+Shift+F

  • ^Процедура\s+[a-zA-Z0-9А-Яа-яёЁ_]+\(\)\s+Экспорт\s*$[^\n]*\s*КонецПроцедуры
    • не используем \n
@tsukanov-as
tsukanov-as / truffle-material.md
Created June 2, 2019 17:00 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@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,
@tsukanov-as
tsukanov-as / mem2func.lua
Created May 21, 2021 14:20 — forked from Youka/mem2func.lua
Run machine code with LuaJIT (Windows x86)
-- Load foreign-function-interface handle
local ffi = require("ffi")
-- Shortcut FFI C namespace
local C = ffi.C
-- Load Windows kernel32 DLL
local kernel32 = ffi.load("kernel32")
-- Add C definitions to FFI for usage descriptions of components
ffi.cdef([[
// Redefinitions for WinAPI conventions
typedef void VOID;
@tsukanov-as
tsukanov-as / x86-assembly-notes.md
Created June 1, 2021 16:21 — forked from mikesmullin/x86-assembly-notes.md
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

@tsukanov-as
tsukanov-as / latency.txt
Created October 5, 2021 17:22 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@tsukanov-as
tsukanov-as / Quirks of C.md
Created November 20, 2022 15:13 — forked from fay59/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;