Skip to content

Instantly share code, notes, and snippets.

View sashka's full-sized avatar
🧭
Exploring Zig

sashka

🧭
Exploring Zig
View GitHub Profile
@sashka
sashka / mac-keycodes
Created March 14, 2024 18:17 — forked from eegrok/mac-keycodes
Mac virtual keycodes
from: http://www.meandmark.com/keycodes.html
Virtual Keycodes for the Mac QWERTY Layout
Keycodes are in hexadecimal. A blank entry means either there is no key assigned to that keycode or I was unable to find the assigned key.
Keycode Key
0x00 A
0x01 S
0x02 D
0x03 F
@sashka
sashka / go.txt
Last active January 1, 2021 23:12
gggrrpc
asd@Kanto ~/P/r/gggrrpc:master> ghz --proto=go/helloworld/hello.proto --insecure --call=helloworld.Greeter/SayHello -d '{"name":"GHZ"}' -n20000 [::1]:50051
Summary:
Count: 20000
Total: 371.59 ms
Slowest: 3.25 ms
Fastest: 0.11 ms
Average: 0.74 ms
Requests/sec: 53822.06
/// The `iota_const!` macro constructs a sequence of constants of a given type, starting with `1 << 0`.
/// Usage:
/// `iota_const!(u8, A, B, C);
/// Will generate:
/// pub const A: u8 = 1 << 0; // 1 << 0
/// pub const B: u8 = 1 << 0+1; // 1 << 1
/// pub const C: u8 = 1 << 0+1+1; // 1 << 2
macro_rules! iota_const {
// There's no way to iterate over the args, so I need to run private macro recirsively
// to accumulate a counter expression like `(0+1+...+1)`.

Keybase proof

I hereby claim:

  • I am sashka on github.
  • I am asd (https://keybase.io/asd) on keybase.
  • I have a public key whose fingerprint is 284D C5E4 04B9 3F9F A5A4 FF1A AA9E 07CB FB8D 19AE

To claim this, I am signing this object:

#!/usr/bin/env bash
# http://alloytools.org
# https://habr.com/ru/company/yandex/blog/457810/
# https://www.hillelwayne.com/post/formally-specifying-uis/
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
libdir="$scriptdir"/lib
alloyjar=""
#!/usr/bin/python
# encoding: utf-8
from __future__ import print_function
import argparse
import gzip
import io
import os
package main
import (
"flag"
"fmt"
"log"
"net"
"net/http"
"os"
@0xa43f2b7624cae18b;
using Common = import "common.capnp";
# Общий контейнер для любого типа запроса.
struct Request(T) {
# ID запроса для диагностики.
id @0 :Text;
CREATE FUNCTION count_estimate(query text) RETURNS INTEGER AS
$func$
DECLARE
rec record;
ROWS INTEGER;
BEGIN
FOR rec IN EXECUTE 'EXPLAIN ' || query LOOP
ROWS := SUBSTRING(rec."QUERY PLAN" FROM ' rows=([[:digit:]]+)');
EXIT WHEN ROWS IS NOT NULL;
END LOOP;
jq -c '.[] | select(.name == "Сокольническая").stations | .[] | [1, 1, .order+1, .name, .status, .lat, .lng]' ~/Downloads/metro.msk.json > 1