Skip to content

Instantly share code, notes, and snippets.

View listochkin's full-sized avatar

Andrei Listochkin (Андрей Листочкин) listochkin

View GitHub Profile
@listochkin
listochkin / rust-analyzer-settings.md
Created August 7, 2024 00:28
Rust Analyzer settings

Andrei's VSCode settings for Rust Analyzer

Custom hints, these options come straight from the Rust Analyzer manual. Check it out for more hints and for other things R-A can do for you!

"rust-analyzer.hover.actions.references.enable": true,
"rust-analyzer.diagnostics.experimental.enable": false,
// can show you if you get references or owned data when you match
"rust-analyzer.inlayHints.bindingModeHints.enable": true,
"rust-analyzer.inlayHints.closingBraceHints.minLines": 25,
@listochkin
listochkin / objdump-to-c-string.pl
Created August 9, 2023 21:21
objdump to C-string of opcodes
#!/usr/bin/env perl
# SPDX-License-Identifier: CC0 OR 0BSD OR MIT OR Apache-2.0
# 2023 Andrei Listochkin
# Usage: objdump -d program | ./objdump-to-c-string.pl <address_ranges>
# where <address_ranges> can be individual addresses or ranges
# (e.g., `1131-1137 114c 10d8 1171`)
#
# This script parses the output of 'objdump -d program' and generates formatted
@listochkin
listochkin / rust-custom-data-exercise.md
Last active June 29, 2023 10:45
Exercise: custom data for a plugin system

Custom Data for a Plugin System

This exercise is inspired by a real-world scenario encountered by one of Ferrous Systems' customers.

Imagine that we are building the next version of the best code editor out there, and for it we want to introduce a system of plugins that require configuration. Some configuration options are common: every plugin has a name, for example. Other settings can be absolutely unique.

We want to design a type that would allow us to store arbitrary custom data. It should play nicely with the rest of our code base. We want to be able to:

  • Debug-print our plugin configuration
  • compare different configs
@listochkin
listochkin / Cargo.toml
Created June 19, 2023 22:44
Fetcher test for pnpm
[package]
name = "fetch_test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.release]
debug = true
@listochkin
listochkin / rust-traits-tcp-server-exercise.md
Created June 9, 2023 21:53
Exercise: an interactive TCP echo server

Implement an interactive TCP echo server.

Here's how an interaction with it would look like from a client point of view. You connect to it using netcat, for example:

nc localhost 7878

and type in one line of text. As soon as you hit enter, the server sends the line back but keeps the connection opened. You can type another line and get it back, and so on.

Here's a bit of code to get you started:

@listochkin
listochkin / emoji-regex.js
Created December 1, 2021 10:43
Emoji Regular Expression for JavaScript
// adapted from https://unicode.org/reports/tr51/#EBNF_and_Regex
export const emojiRegex =
/(?<emoji>\p{RI}\p{RI}|\p{Emoji}(\p{EMod}|\uFE0F\u20E3?|[\uE0020-\uE007E]+\uE007F)?(\u200D\p{Emoji}(\p{EMod}|\uFE0F\u20E3?|[\uE0020-\uE007E]+\uE007F)?)*)/u;

Примечание от Андрея: Это не моя вакансия, но я хочу помочь Павлу найти себе инженера в команду. Оригинальный текст ниже. Хочешь узнать больше - приходи в чат Frontend UA Jobs.

Привіт, хотів нагадати що ми все ще шукаємо Middle React Native розробника на класний продукт)

Хто ми шо ми:

Uniform Teeth - американська компанія котра вирівнює зуби за допомогою алайнерів (такі прозорі штуки на зубах, майже як Invisalign тільки ми кращі ;) Загалом людей тут під 150 чоловік, але конкренто інжинірингу близько 10 і ми зараз активно працюємо щоб це виправити. Це все ще стартап, в лютому підняли другий раунд інвестицій майже весь планють пустити на посилення команд з розробки.

Бізнес модель проста як двері: ви нам гроші - ми вам рівненькі зуби і чарівну усмішку через рік-два. Кешфлоу позитивний, ростемо як на дріжджах.

@listochkin
listochkin / 2018.js
Last active March 24, 2022 03:15 — forked from Jack-Works/2018.js
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@listochkin
listochkin / README.md
Created October 17, 2018 15:27
No root prompt for Turbo Boost Switcher on TouchID Macs

No root prompt for Turbo Boost Switcher on TouchID Macs

Installation:

  1. Enable TouchID for sudo. Open /etc/pam.d/sudo and add auth sufficient pam_tid.so before other rules.
  2. Remove Turbo Boost Switcher from login items
  3. Put turbo-boost-switcher-as-root.sh to /usr/local/bin/
  4. chmod +x /usr/local/bin/turbo-boost-switcher-as-root.sh
  5. Put turboboostswitcher.asroot.plist to ~/Library/LaunchAgents
  6. Run launchctl load ~/Library/LaunchAgents/turboboostswitcher.asroot.plist
@listochkin
listochkin / README.md
Created July 9, 2018 12:24 — forked from andyshinn/README.md
pbcopy over SSH

Install

  • Add pbcopy.plist to your ~/Library/LaunchAgents/ folder.
  • Launch the listener with launchctl load ~/Library/LaunchAgents/pbcopy.plist.
  • Add RemoteForward 2224 127.0.0.1:2224 in your ~/.ssh/config file under your Host * or specific hosts sections.
  • Add [ -n "$SSH_CLIENT" ] && alias pbcopy="nc localhost 2224" to your remote ~/.bash_profile or other shell profile.
  • Enjoy pbcopy remotely!