Skip to content

Instantly share code, notes, and snippets.

@gsquire
gsquire / lib.rs
Last active April 19, 2019 18:36
/*
[dependencies]
crossbeam-utils = "0.6"
hashbrown = "0.2"
parking_lot = "0.7"
*/
// Go Reference: https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/singleflight/singleflight.go
use std::fmt::Debug;
@gsquire
gsquire / vim-ref.md
Last active November 27, 2018 19:07

Useful VIM Commands I Never Remember

Folding

  • {n,m}fo: From lines n to m fold them.
  • zo: Open this fold.
  • zc: Close this fold.
  • za: Alternate closing and opening the fold.

Bookmarking

  • m{_}: Mark this line using a lowercase letter to reference later.
package main
import (
"fmt"
"sync"
"time"
)
type BankAccount struct {
balance int
package main
import (
"fmt"
"sync"
"time"
)
var wg sync.WaitGroup
#[macro_use]
extern crate error_chain;
extern crate clap;
extern crate reqwest;
use std::fs::File;
use std::io;
use clap::{App, Arg};
@gsquire
gsquire / rust_docker
Last active March 14, 2024 15:24
A small docker image for rust using alpine linux
FROM alpine:3.6
RUN apk add --no-cache rust cargo
COPY project /build
WORKDIR /build
RUN ["cargo", "build", "--release"]
ENTRYPOINT ["cargo", "run", "--release"]
extern crate byteorder;
extern crate futures;
extern crate tokio_core;
extern crate tokio_io;
use std::io::{self, Write};
use std::net::TcpStream;
use byteorder::{BigEndian, ByteOrder};
use futures::{Future, Stream};

Keybase proof

I hereby claim:

  • I am gsquire on github.
  • I am gsquire (https://keybase.io/gsquire) on keybase.
  • I have a public key ASBTfYk9Fk3qd88j19-z1YHMxaG8_dEUM7iBOPKyWu_4HAo

To claim this, I am signing this object:

diff --git a/Cargo.toml b/Cargo.toml
index 633e404..6963348 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ license = "MIT/Apache-2.0"
hyper = { version = "0.9" , default-features = false }
log = "0.3"
native-tls = "0.1"
+serde_derive = "0.8"
serde = "0.8"
package main
import (
"fmt"
"log"
"math"
"net/http"
"os"
"os/exec"
"time"