Skip to content

Instantly share code, notes, and snippets.

@folex
folex / gas.sol
Created January 30, 2019 17:14
gas.sol
pragma solidity ^0.4.24;
contract Gas {
struct App {
uint256 id;
bytes32 something;
bytes32 andmore;
uint8 someSize;
address owner;
bytes32[] someArray;
admin.addPeer("enode://31cc50f97458f97610ea5a367b5921a8e3edb12989356a281da250689d922d98a2ab7ffa8c86c7e8c80c51ceccd768a5e3b5caafd999b6c46438c32a68aa95cc@199.229.249.180:52200");
admin.addPeer("enode://550a783e27ad52c477688029a0295fc211dd6fa2b2c2d7a562553d3a275bf8133ffda4814469361125a7d88bb68636a89b5a21f33f1540a7e8fb8c84c6b25eae@18.209.226.225:30303");
admin.addPeer("enode://3afdfd40713a8b188a94e4c7a9ddc61bc6ef176c3abbb13d1dd35eb367725b95329a7570039044dbffa49c50d4aa65f0a1f99ee68e46b8e2f09100d11d4fc85a@31.17.177.157:30303");
admin.addPeer("enode://95176fe178be55d40aae49a5c11f21aa58968e13c681a6b1f571b2bb3e45927a7fb3888361bef85c0e28a52ea0e4afa17dcaa9d6c61baf504b3559f056f78581@163.172.145.241:30303");
admin.addPeer("enode://cc4906afde16c0690ea60516224eb1c4ea974a52bae74a0c72b5b8961a7b16485c797a0bdbb722be828770cefcb29c4dd6bbae35bb6f047bdda98e63771d1498@79.64.14.152:30303");
admin.addPeer("enode://1d70e87a2ee28a2762f1b2cd56f1b9134824a84264030539bba297f67a5bc9ec7ae3016b5f900dc59b1c27b4e258a63fc282a37b2dd6e25a8377473530
@folex
folex / sax_advices.md
Last active January 4, 2025 02:35
How to hear harmony better (from awesome Saxophone community https://discord.gg/HbmZnXX)

How to hear harmony better

  • Listen to the bass & drums before other instruments (btw, that's what Ben Levin also suggests https://www.youtube.com/watch?v=bFilqih6WAY)
  • Play along with backing tracks and metronome
  • Since rhythm section in jazz usually has accents on 2 and 4, set metronome half tempo, so it sounds on 2 and 4
  • Play tune's chords progressions on the piano (transpose accordingly, i.e. G major on tenor => F major on piano)
  • Listen to the tune A LOT, and sing along
  • Listen to other tunes a lot, so you ear becomes naturally attuned to the songs
  • Play whole notes over the changes: tonic, 3rd, 5th, 7th. When first playing-listening through the tune, play tonic, next time – 3rd, etc.
  • [10] J. Cates, “Robust and Efficient Data Management for a Distributed Hash Table,” pp. 1– 64, Jul. 2016.

  • [11] “Architecture and Evaluation of an Unplanned 802.11b Mesh Network,” pp. 1–12, Jul. 2016.

  • [16] M. J. Freedman, I. Stoica, S. Rhea, and K. Lakshminarayanan, “Non-Transitive Connectivity and DHTs,” pp. 1–6, Jul. 2016.

  • [21] “SPROUT: P2P Routing with Social Networks,” pp. 1–12, Jul. 2016.

  • [22] “A Study of Gossip as a Routing Mechanism in Mobile Ad Hoc Networks,” pp. 1–12, Jul. 2016.

@folex
folex / DHT.md
Created November 21, 2019 09:04
Notes on DHT

DHT

Terms

Performance

Graphs

  • Hops & Bandwidth on 10k node network with variable churn rate (specified by lifetime) Hops & Bandwidth on 10k node network with variable churn rate (specified by lifetime)
@folex
folex / local-first.md
Last active December 20, 2019 10:21
How I understand local-first software (https://www.inkandswitch.com/local-first.html)

Вот как я понимаю каждый из пунктов:

1. No spinners: your work at your fingertips.

  • Работа приложения асинхронна относительно сети. Другими словами, если ты нажал кнопку, то результат (по возможности*) отображается сразу же, не ожидая ответа по сети. Добавил заметку – визуально она сразу добавилась, сервера ждать не нужно. *Про "по возможности": стоит проектировать UI/UX приложения так, чтобы основные пользовательские флоу не были завязаны на ожидание сети.

2. Your work is not trapped on one device.

  • Возможность синхронизировать данные с другими девайсами, другими платформами. Есть релевантный термин – continuity.

3. The network is optional.

  • По сути и есть offline-first – приложение хорошо (gracefully) работает без наличия сети, функционал может беднеть очевидным образом, но возможность использовать (ключевые?) функции остается. Упрощенно: пользователь успешно пользуется приложением как на супер быстром WiFi, так и в самолете без сети. Also: local-first apps keep their data in local stora
@folex
folex / spanish_tu_usted.md
Last active February 18, 2020 19:12
Spanish: Tú y Usted

Tú y Usted

En español, como en otras lenguas, existen dos formas de tratamiento: "" y "usted".

"Usted" se utiliza con los verbos y los pronombres en tercera persona del singular y "ustedes" con la tercera persona del plural. En español la forma de tratamiento "usted" se utiliza menos que en otras lenguas. El plural de "usted" es "ustedes" y el de "", "vosotros". Pero en Latinoamérica no se usa la forma "vosotros": se usa "ustedes". Además, en muchas regiones del Cono Sur y de Centroamérica, para la segunda persona del singular, se usa "vos".

En España, en el mundo del trabajo, por ejemplo, entre colegas de igual o similar categoría, normalmente se utiliza "". Entre personas jóvenes siempre se utiliza "" y muchas personas mayores se dirigen a los jóvenes hablándoles de "", pero los jóvenes tienen que utilizar en muchos casos la forma "usted" (con médicos, policías, funcionarios personas mayores...). En las escuelas y en las univers

@folex
folex / address.rs
Created April 23, 2020 13:30
address.rs
use std::iter::Peekable;
use std::str::Split;
use url::Url;
#[derive(Debug, Clone)]
pub enum Error {
Empty,
UnknownProtocol,
}
@folex
folex / ctrlc_hang.rs
Created April 23, 2020 15:03
ctrlc_hang.rs
#[cfg(test)]
mod tests {
use async_std::task;
use futures::{
channel::{mpsc, mpsc::UnboundedReceiver},
prelude::*,
select,
stream::StreamExt,
};
use serde::{Deserialize, Serialize};
@folex
folex / prerelease.sh
Created December 29, 2020 11:46
Increment semver version as prerelease in Github Actions
yarn global add semver
PATH="$(yarn global bin):$PATH"
# take npm version and increment it
PKG_NAME="$(cat package.json | jq -r .name)"
# sanitize branch name so it can be used as a semver suffix (replace [^0-9a-zA-Z-] with hyphen)
SANITIZED_BRANCH="$(echo -n "${{ env.BRANCH_NAME }}" | tr -C '[:alnum:]-' -)"
# take all versions from npm and replace single quotes with double quotes