Skip to content

Instantly share code, notes, and snippets.

View scorphus's full-sized avatar
Brewing at 🏡 office

Pablo Aguiar scorphus

Brewing at 🏡 office
View GitHub Profile
@scorphus
scorphus / multipartzip.go
Created August 7, 2014 17:56
multipartzip.go
// Copyright 2014 gandalf authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package multipartzip
import (
"archive/zip"
"bytes"
"io"
@scorphus
scorphus / UnzipMultipartFile.go
Last active August 29, 2015 14:04
Unzip multipart zipfile and return a slice [file_name]file_content
func UnzipMultipartFile(f *multipart.FileHeader) (map[string]*bytes.Buffer, error) {
file, err := f.Open()
if err != nil {
return nil, err
}
defer file.Close()
size, err := file.Seek(0, 2)
if err != nil {
return nil, err
}
@scorphus
scorphus / cmd_args.go
Created July 24, 2014 19:26
Iteratively add arguments to a Command
cmd := exec.Command(commandPath, "foo", bar, spam)
if len(egg) > 0 {
cmd.Args = append(cmd.Args, egg)
}