Skip to content

Instantly share code, notes, and snippets.

View spdrman's full-sized avatar

Roman spdrman

View GitHub Profile
@tallpeak
tallpeak / sftocsv.rs
Created June 23, 2022 19:22
superfile to tab-separated-values
// fixedWidthToCSV
// output is short by 545 lines
// wc c:\Users\tallp\Downloads\SFA8 c:\temp\sfa8.txt
// 1167801 12474922 411065952 c:\Users\tallp\Downloads\SFA8
// 1167256 40205289 449393560 c:\temp\sfa8.txt
// 2335057 52680211 860459512 total
// https://www.youtube.com/watch?v=lLWchWTUFOQ
// Ryan Levick
// oxide.computer
// Please find the full, tested version in
// https://github.com/influxdata/influxdb_iox/blob/fe155e15fb2ad166aee66b0458e63c24a8128dd4/query/src/exec/task.rs#L101-L118
pub struct DedicatedExecutor {
state: Arc<Mutex<State>>,
}
/// Runs futures (and any `tasks` that are `tokio::task::spawned` by
/// them) on a separate Tokio Executor
struct State {
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@cryptix
cryptix / client.go
Created June 22, 2014 11:09
multipart upload with io.Pipe
package main
import (
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"runtime"
@pzurek
pzurek / Twelve_Go_Best_Practices.md
Last active March 16, 2024 14:19
Twelve Go Best Practices