Skip to content

Instantly share code, notes, and snippets.

@folex
folex / fluence_animation.py
Last active October 7, 2022 13:32
Fluence Network Animation written in Manim
from manim import *
from math import sqrt
import random
import networkx as nx
nxgraph = nx.erdos_renyi_graph(11, 0.003)
# nxgraph = nx.gnp_random_graph(50, 0.2)
# nxgraph = nx.barabasi_albert_graph(50, 1)
# nxgraph = nx.random_lobster(150, 0.1, 0.1)
@folex
folex / retrieve_records.aqua
Created July 14, 2021 11:48
Aqua DHT record retrieval bug
import "dht.aqua"
import "@fluencelabs/aqua-lib/builtin.aqua"
service RecordOp("op"):
identity(records: []Record) -> []Record
func get_result(values_result: GetValuesResult) -> []Record:
records <- RecordOp.identity(values_result.result)
<- records
@folex
folex / Cargo.toml
Created July 1, 2021 16:37
Use Fluence from Rust with ConnectedClient crate
[package]
name = "concl"
version = "0.1.0"
edition = "2018"
[dependencies]
connected-client = { git = "https://github.com/fluencelabs/fluence" }
eyre = "0.6.5"
maplit = "1.0.2"
serde_json = "1.0.64"
@folex
folex / fluence.yml
Last active June 18, 2021 12:10
docker-compose -f fluence.yml up -d || rm -f
# management secret key is NAB5rGwT4qOEB+6nLQawkTfCOV2eiFSjgQK8bfEdZXY=
services:
fluence-0: # /ip4/127.0.0.1/tcp/9990/ws/p2p/12D3KooWHBG9oaVx4i3vi6c1rSBUm7MLBmyGmmbHoZ23pmjDCnvK
command: -f ed25519 -k 29Apzfedhw2Jxh94Jj4rNSmavQ1TkNe8ALYRA7bMegobwp423aLrURxLk32WtXgXHDqoSz7GAT9fQfoMhVd1e5Ww -m 12D3KooWFRgVmb1uWcmCbmJqLr8tBQghL6ysSpK2VyE2VZbaQ6wy -t 7770 -w 9990 --bootstraps /dns4/fluence-1/tcp/7771 /dns4/fluence-2/tcp/7772
container_name: fluence-0
environment:
RUST_BACKTRACE: full
RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_serv
@folex
folex / gh_actions_multicrate.yml
Created January 6, 2021 19:28
Github Actions Publish Multi-crate project
name: "publish-release"
on:
push:
branches:
- "master"
- "release"
jobs:
npm-publish:
@folex
folex / github_actions_rust_publish_branch.yml
Created December 31, 2020 07:44
Github Actions Publish a crate from a branch
name: "publish-branch"
on:
push:
branches-ignore:
- "master"
jobs:
npm-publish:
name: "Publish branch"
@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
@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 / 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 / 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