Skip to content

Instantly share code, notes, and snippets.

View vadorovsky's full-sized avatar
🐧

Michal Rostecki vadorovsky

🐧
View GitHub Profile
@vadorovsky
vadorovsky / gist:dd8c20edae2a8971e3a1a7ce8dd3d2c1
Created December 8, 2023 10:11
ChatGPT - features in JS/TS
In JavaScript/TypeScript projects that use build systems like npm or pnpm, feature toggling is typically not handled directly by the package managers themselves. Instead, it's usually achieved through a combination of environment variables and conditional logic within the code. There isn't a direct equivalent to the feature flags as seen in C/autotools, CMake, or Rust/Cargo, but you can achieve similar functionality in a few ways:
1. **Environment Variables**: You can define environment variables in your system or through a `.env` file using libraries like `dotenv`. Your JavaScript/TypeScript code can then check these variables to enable or disable certain features.
Example:
```javascript
if (process.env.ENABLE_FEATURE === 'true') {
// Code for the feature
}
+ [ -f /.dockerenv ]
+ PID=23758
+ trap kill 23758 EXIT
+ sleep 7
+ solana-test-validator --reset --limit-ledger-size=500000000 --quiet --bpf-program noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV /home/node/.local/light-protocol/lib/solana-program-library/spl_noop.so --bpf-program JA5cjkRJ1euVi9xLWsCJVzsRzEkT8vcC4rqw9sVAo5d6 ./target/deploy/merkle_tree_program.so --bpf-program J1RRetZ4ujphU75LP8RadjXMf3sA12yC2R44CF7PmU7i ./target/deploy/verifier_program_zero.so --bpf-program DJpbogMSrK94E1zvvJydtkqoE4sknuzmMRoutd6B7TKj ./target/deploy/verifier_program_storage.so --bpf-program 3KS2k14CmtnuVv2fvYcvdrNgC94Y11WETBpMUGgXyWZL ./target/deploy/verifier_program_one.so --account-dir ../accounts
Waiting for fees to stabilize 1...
+ ts-mocha -t 2000000 tests/user-merge.tests.ts --exit
Test User merge 1 sol utxo and one spl utxo in sequence
#!/usr/bin/env bash
#
# Run a minimal Solana cluster. Ctrl-C to exit.
#
# Before running this script ensure standard Solana programs are available
# in the PATH, or that `cargo build` ran successfully
#
set -e
# Prefer possible `cargo build` binaries over PATH binaries
@vadorovsky
vadorovsky / gist:c9a3892a85ea4425082d91a729ffcfb2
Created January 13, 2023 05:10
rustc core::sync::atomic failure on bpfel-unknown-none
Building stage1 library artifacts (x86_64-unknown-linux-gnu -> bpfel-unknown-none)
Compiling core v0.0.0 (/home/vadorovsky/repos/rust/library/core)
Compiling compiler_builtins v0.1.85
error: cannot find macro `atomic_int` in this scope
--> library/core/src/sync/atomic.rs:2821:1
|
2821 | atomic_int! {
| ^^^^^^^^^^
error: cannot find macro `atomic_int` in this scope
@vadorovsky
vadorovsky / gist:7aaf1bbbb78ab0c0371fe65d90105007
Created January 11, 2023 08:01
nightly ebpf error 11-01-2023
vadorovsky  …/aya-examples/uprobe   main ?   v1.66.1  ♥ 16:00  cargo xtask build-ebpf
Blocking waiting for file lock on package cache
Compiling version_check v0.9.4
Compiling proc-macro2 v1.0.49
Compiling unicode-ident v1.0.6
Compiling quote v1.0.23
Compiling libc v0.2.139
Compiling syn v1.0.107
Compiling io-lifetimes v1.0.3
Compiling rustix v0.36.6
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-6c205a15ba5644a0/d5451c8/aya/src/obj/btf/btf.rs:482] [DATASEC] .maps: fixup size to 288
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-6c205a15ba5644a0/d5451c8/aya/src/obj/btf/btf.rs:518] [DATASEC] .maps: [VAR] runtimes: fixup offset 0
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-6c205a15ba5644a0/d5451c8/aya/src/obj/btf/btf.rs:518] [DATASEC] .maps: [VAR] containers: fixup offset 32
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-6c205a15ba5644a0/d5451c8/aya/src/obj/btf/btf.rs:518] [DATASEC] .maps: [VAR] processes: fixup offset 64
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-6c205a15ba5644a0/d5451c8/aya/src/obj/btf/btf.rs:518] [DATASEC] .maps: [VAR] allowed_paths_mount_restricted: fixup offset 96
20:33:12 [DEBUG] (1) aya::obj::btf::btf: [/home/vadorovsky/.cargo/git/checkouts/aya-
This file has been truncated, but you can view the full file.
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
//
// THIS FILE IS AUTOGENERATED BY CARGO-LIBBPF-GEN!
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(clippy::transmute_ptr_to_ref)]
use libbpf_rs::libbpf_sys;
@vadorovsky
vadorovsky / crash.log
Created July 14, 2021 17:40
packer vagrant-libvirt post-processor error
This file has been truncated, but you can view the full file.
2021/07/14 19:13:05 [INFO] Packer version: 1.7.3 [go1.16.5 linux amd64]
2021/07/14 19:13:05 [TRACE] discovering plugins in /home/vadorovsky/bin
2021/07/14 19:13:05 [TRACE] discovering plugins in /home/vadorovsky/.packer.d/plugins
2021/07/14 19:13:05 [TRACE] discovering plugins in .
2021/07/14 19:13:05 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/14 19:13:05 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/vadorovsky/.packerconfig
2021/07/14 19:13:05 [WARN] Config file doesn't exist: /home/vadorovsky/.packerconfig
2021/07/14 19:13:05 [INFO] Setting cache directory: /home/vadorovsky/repos/enclave/contrib/packer/packer_cache
2021/07/14 19:13:05 [TRACE] Starting internal plugin packer-builder-vagrant
2021/07/14 19:13:05 Starting plugin: /home/vadorovsky/bin/packer []string{"/home/vadorovsky/bin/packer", "plugin", "packer-builder-vagrant"}
# URL of the libvirt server
# EXAMPLE:
# libvirt_uri = "qemu:///system"
libvirt_uri = "qemu:///system"
# Path of the key file used to connect to the libvirt server
# Note this value will be appended to the libvirt_uri as a 'keyfile' query: <libvirt_uri>?keyfile=<libvirt_keyfile>
# EXAMPLE:
# libvirt_keyfile = "~/.ssh/custom_id"
libvirt_keyfile = ""
@vadorovsky
vadorovsky / gist:b6c248a9e36143750682878b160b9056
Created January 9, 2020 13:13
cilium-log-20200109-140027
2020-01-09T13:57:28.334076081+01:00 level=info msg="Skipped reading configuration file" reason="Config File \"ciliumd\" Not Found in \"[/root]\"" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --access-log=''" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --agent-labels=''" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --allow-localhost='auto'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --annotate-k8s-node='true'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --auto-create-cilium-node-resource='true'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --auto-direct-node-routes='false'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --blacklist-conflicting-routes='true'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --bpf-compile-debug='false'" subsys=daemon
2020-01-09T13:57:28.334142876+01:00 level=info msg=" --bpf-ct-global-any-max='26214