Skip to content

Instantly share code, notes, and snippets.

data:text/html, <html contentEditable=true style="caret-color: transparent; color: white; background-color: black;"><head><link rel="shortcut icon" href="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=" type="image/gif"><title>Black</title>
@Meyermagic
Meyermagic / cobs_codec.rs
Created October 10, 2018 03:58
Tokio Codec implementation of COBS packet framing
use bytes::BytesMut;
use cobs::{decode_vec_with_sentinel, encode_with_sentinel, max_encoding_length};
use tokio::codec::{Decoder, Encoder};
enum CobsCodecError {
MaxEncodeBufferSizeExceeded,
MaxDecodeBufferSizeExceeded,
CobsDecodingError,
IoError(::std::io::Error),
}
@Meyermagic
Meyermagic / diary.sh
Created April 8, 2018 21:13
Simple bash function for journal entries or notes.
function diary() {
root="$HOME/Documents/journal"
date="$(date -u +"%Y/%m/%d")"
dir="$root/$date"
name="$(date -u +"%T")"
if [ ! -z "$1" ]; then
name+=" '$1'"
fi
@Meyermagic
Meyermagic / quine.rs
Created April 8, 2018 04:24
Quine I wrote a while back. 85 characters
fn main(){(|a|print!("{}({:?})}}",a,a))("fn main(){(|a|print!(\"{}({:?})}}\",a,a))")}
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath^=/home/meyer/.config/nvim/repos/github.com/Shougo/dein.vim,/nix/store/zan6v7jn67dz3m2axnarvx2k1gxv0dah-neovim-0.1.3/share/nvim/runtime
" Required:
call dein#begin(expand('/home/meyer/.config/nvim'))
@Meyermagic
Meyermagic / lispy.go
Last active December 16, 2015 23:39
Here it is...
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
package main
import (
"bufio"
"fmt"
"math"
"os"
)
type Point struct {
-fcase-merge
Enable case-merging. Implied by -O.
-fcse
Turn on common sub-expression elimination. Implied by -O.
-fdo-eta-reduction
Enable eta-reduction. Implied by -O
-fenable-rewrite-rules
-fcase-merge
Enable case-merging. Implied by -O.
-fcse
Turn on common sub-expression elimination. Implied by -O.
-fdo-eta-reduction
Enable eta-reduction. Implied by -O
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)