Skip to content

Instantly share code, notes, and snippets.

Avatar

Loïc Girault lgirault

View GitHub Profile
@lgirault
lgirault / example.rs
Created Mar 12, 2020
lifetime probleme
View example.rs
fn example<'a>(tcp_stream: &'a mut tokio::net::TcpStream) -> impl Future<Output=io::Result<()>> +'a {
async move {
let (mut reader, mut writer) = tcp_stream.split();
let user_input = tokio::spawn(async move {
loop {
let buf : &[u8] = &[1,2,3];
writer.write(buf).await;
}
@lgirault
lgirault / err.txt
Created Mar 4, 2020
Rust Send problem
View err.txt
error: future cannot be sent between threads safely
--> src/main.rs:184:5
|
184 | tokio::spawn(async move {
| ^^^^^^^^^^^^ future is not `Send`
|
::: /home/lorilan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/spawn.rs:123:21
|
123 | T: Future + Send + 'static,
| ---- required by this bound in `tokio::task::spawn::spawn`
@lgirault
lgirault / ResourceExtractorDbIndex.scala
Created Mar 15, 2019
ResourceExtractorDbIndex update
View ResourceExtractorDbIndex.scala
package com.mediarithmics.schemaextractor
import org.scalameta.FileLine
import scalafix.internal.patch.CrashingSemanticdbIndex
import scalafix.internal.reflect.ClasspathOps
import scalafix.internal.v0.{LegacyInMemorySemanticdbIndex, LegacySemanticdbIndex}
import scalafix.util.SemanticdbIndex
import scalafix.v0.{Database, Denotation, Document, ResolvedName, Symbol}
import scala.meta.inputs.Position
View first_run.txt
DEBUG] Target alias resources has already been registered. Overwriting!
DEBUG] using engine_version: f2d5ed1a811da574148593f5ce3b93e21c242bc0 built at repo_version: release_1.11.0rc1-5-ga43a47c
DEBUG] loading native engine python module from: /tmp/tmpHXmCbd
DEBUG] ProjectTree ignore_patterns: ['.*/', '/dist/']
DEBUG] Initializing ShardedLmdb at root "/home/lorilan/.cache/pants/lmdb_store/files"
DEBUG] starting background reactor
DEBUG] Making ShardedLmdb content database for "/home/lorilan/.cache/pants/lmdb_store/files/0"
DEBUG] Making ShardedLmdb lease database for "/home/lorilan/.cache/pants/lmdb_store/files/0"
DEBUG] Making ShardedLmdb content database for "/home/lorilan/.cache/pants/lmdb_store/files/1"
DEBUG] Making ShardedLmdb lease database for "/home/lorilan/.cache/pants/lmdb_store/files/1"
View buildSbtEnv.nix
{ callPackage, stdenv, makeWrapper, jdk, scala, sbt, writeText,
our-sbt-plugins }:
with stdenv.lib;
rec {
prepareSbtProject = args@{
repo, name, src,
groupId,
buildInputs ? [],
View command time -v nix-instantiate
error: stack overflow (possible infinite recursion)
Command exited with non-zero status 1
Command being timed: "nix-instantiate default.nix -A mediarithmics-api.business-analytics"
User time (seconds): 1.13
System time (seconds): 0.23
Percent of CPU this job got: 98%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.38
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
View ResourceExtractorDbIndex.scala
package p
import scalafix.util.SemanticdbIndex
import scala.meta._
class ResourceExtractorDbIndex(index: SemanticdbIndex) extends SemanticdbIndex {
private[this] var cache: Map[Symbol, Option[Defn]] = Map.empty
def document(s: Symbol): Option[Document] =
View Const.scala
package p
import cats.Functor
case class Const[A, R](value: A)
object Const {
implicit def constFunctor[X]: Functor[Const[X, ?]] =
new Functor[Const[X, ?]] {
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
You can’t perform that action at this time.