Skip to content

Instantly share code, notes, and snippets.

@giuliano-macedo
giuliano-macedo / download_file.rs
Last active January 25, 2024 08:52
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@adamjohnson
adamjohnson / sublime-keyboard-shortcuts.md
Last active May 12, 2020 12:19
Sublime Text keyboard shortcuts I should remember

Sublime Text keyboard shortcuts

These are some Sublime Text keyboard shortcuts that I can't seem to remember. I am writing them down in hopes I will use them and commit them to memory.

  1. Find the matching bracket: CTRL + M. Finds: (), {}, [].
  2. Select entire contents of parentheses, brackets, or braces: CTRL+SHIFT+M.
  3. Jump to specific line number: CTRL + P then :xx eg: :50 to go to line 50.
  4. Copy/Cut & Paste entire lines without highlighting: Same keys, paste inserts line above your cursor.
  5. Add a new line from the middle of some text & place cursor on the new line: CTRL/CMD + ENTER.
@lolgesten
lolgesten / tokio.rs
Last active March 30, 2021 16:52
futures::io::AsyncRead/AsyncWrite conversion to tokio::io::AsyncRead/AsyncWrite
use futures_io::{AsyncRead, AsyncWrite};
use std::fmt;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::AsyncRead as TokioAsyncRead;
use tokio::io::AsyncWrite as TokioAsyncWrite;
pub trait Stream: AsyncRead + AsyncWrite + Unpin + Send + 'static {}
@danielestevez
danielestevez / gist:2044589
Last active July 26, 2024 08:30
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}