Skip to content

Instantly share code, notes, and snippets.

View hqhs's full-sized avatar

Dima hqhs

View GitHub Profile
@hqhs
hqhs / .lldbinit
Created June 23, 2024 12:03
LLDB config
settings set stop-line-count-before 10
settings set stop-line-count-after 10
settings set term-width 120
@hqhs
hqhs / bugreport.md
Created June 22, 2024 15:23
Dawn cmake build bug

I'm trying to compile Dawn with cmake & ninja using clang installed via homebrew on macos.

/opt/homebrew/opt/llvm/bin/clang++ --version
Homebrew clang version 18.1.7
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
@hqhs
hqhs / .clang-format
Last active November 16, 2023 08:47
BasedOnStyle: WebKit
AlignAfterOpenBracket: BlockAlign
AlignConsecutiveMacros: AcrossEmptyLines
AlignEscapedNewlines: DontAlign
AlignOperands: Align
AllowShortEnumsOnASingleLine: false
AlwaysBreakAfterReturnType: All
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25 CC BY
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
@hqhs
hqhs / main.c
Last active May 3, 2021 12:11
wait child process to receive signal
/**
Author: Dmitry Afanasyev
Compiler version:
gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Compile:
gcc main.c -o test && ./test
PHP version:
php --version
import asyncio
import aiohttp
from time import monotonic
from random import randrange
async def send_request_to_expona(session):
i = (randrange(1000) + 50)/1000
print('waiting: {}', i)
await asyncio.sleep(i)

попробовать можно так:

import aiohttp
import asyncio
import sys
from aiohttp import web
from aiojobs.aiohttp import setup, spawn

async def handle(request):
 response = web.StreamResponse()
@hqhs
hqhs / Expected.hpp
Created December 8, 2019 14:18
Updated "expected" version from Andrei Alexandrescu
template <class T, class E> class expected
{
union {
T yay;
E nay;
};
bool ok = true;
public:
expected() { new (&yay) T(); }
#include <exception>
#include <stdexcept>
#include <utility>
#include <typeinfo>
template <class T> class Expected
{
union
{
T ham;
set-option -sg escape-time 10
set-option -g default-terminal "screen-256color"
# set allow-rename off
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# better prefixes
bind-key ` last-window