Skip to content

Instantly share code, notes, and snippets.

@klauspost
klauspost / splitfile.go
Created October 7, 2015 17:03
Split a file similar to how Total Commander does it (No CRC).
package main
import (
"fmt"
"io"
"os"
"path/filepath"
)
const (
package app
import (
"math/rand"
"time"
"github.com/revel/revel"
)
// randomDuration generates a duration between min and max duration.
// Copyright 2011 The Go Authors. All rights reserved.
// Copyright 2013 Klaus Post
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package crc32
import (
"github.com/klauspost/intrinsics/x86/sse2"
"github.com/klauspost/intrinsics/x86"
package main
// Adapted from : https://gist.github.com/arnehormann/65421048f56ac108f6b5
import (
"encoding/binary"
"flag"
"fmt"
"io"
"io/ioutil"
SET LEVEL=1
compress -in=%1 -out=* -stats -header=true -w="gzstd" -l=%LEVEL% >>results.txt
compress -in=%1 -out=* -stats -header=false -w="gzkp" -l=%LEVEL% >>results.txt
compress -in=%1 -out=* -stats -header=false -w="pgzip" -l=%LEVEL% >>results.txt
compress -in=%1 -out=* -stats -header=false -w="cgzip" -l=%LEVEL% >>results.txt
SET LEVEL=2
compress -in=%1 -out=* -stats -header=false -w="gzstd" -l=%LEVEL% >>results.txt
package main
// Adapted from : https://gist.github.com/arnehormann/65421048f56ac108f6b5
import (
"bufio"
"encoding/binary"
"flag"
"fmt"
"io"
@klauspost
klauspost / memset_amd64.go
Last active August 29, 2015 14:23
go memset (byte slice)
package memset
func memset(dst []byte, value byte)
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
@klauspost
klauspost / static.go
Last active August 29, 2015 14:21
revel static file server
package controllers
import (
"os"
fpath "path/filepath"
"strings"
"syscall"
"github.com/revel/revel"
)
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"