Skip to content

Instantly share code, notes, and snippets.

View harshavardhana's full-sized avatar
🌚
I may be slow to respond.

Harshavardhana harshavardhana

🌚
I may be slow to respond.
View GitHub Profile
package main
import (
"bytes"
"fmt"
"io"
"log"
"os"
"github.com/cheggaaa/pb"
package main
import (
"log"
"net/http"
"strings"
)
func RedirectHandler(code int) http.Handler {
return &redirectHandler{code}
@harshavardhana
harshavardhana / README.md
Last active July 13, 2021 15:40
REX-Ray with Minio

Getting Started

The following command will install the latest version of REX-Ray to /usr/bin/rexray on Linux systems:

$ sudo apt install s3fs
$ curl -sSL https://dl.bintray.com/emccode/rexray/install | sh

Depending on the Linux distribution REX-Ray will be registered as either a SystemD or SystemV service.

Configure

REX-Ray requires a configuration file for storing details used to communicate with storage providers. This can include authentication credentials and driver specific configuration options. After REX-Ray has been installed, copy and paste the contents below to a new file on the host at /etc/rexray/config.yml to configure s3fs storage driver.

@harshavardhana
harshavardhana / upload.html
Last active December 18, 2018 08:24
Upload to play.minio.io from browser
<!DOCTYPE html>
<html>
<head>
<title>AWS SDK for JavaScript - Sample Application</title>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.65.0.min.js"></script>
<!-- <script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.20.min.js"></script>-->
</head>
<body>
<div id="results"></div>
@harshavardhana
harshavardhana / docker-compose.yml
Created September 15, 2017 19:32
Continuous mirroring
version: '2'
services:
minio:
image: minio/minio
container_name: miniobkp
ports:
- 9000:9000
env_file:
- ./minio.env
@harshavardhana
harshavardhana / batch-deploy.go
Last active September 11, 2017 19:19
Deploy 20 instances on packet.net
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
// sameMount reports whether childInfo and parentInfo describe
// the same file or directory in the same mount. For example,
// on Unix this means that the device fields of the two underlying
// structures are identical; on other systems the decision may
// be based on the path names. sameMount only applies to results
// returned by os.Stat. It returns false in other cases.
func sameMount(childInfo os.FileInfo, childPath string, parentInfo os.FileInfo, parentPath string) bool {
if childInfo == nil || parentInfo == nil {
return false
}
// Returns the volume serial number of the file or directory at fsPath.
func statVolumeSerialNumber(fsPath string) (uint32, error) {
pathp, err := syscall.UTF16PtrFromString(fsPath)
if err != nil {
return 0, err
}
h, err := syscall.CreateFile(pathp, 0, 0, nil, syscall.OPEN_EXISTING, syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
if err != nil {
return 0, err
}
// Package bpool implements a fixed size pool of byte slice.
package minio
import "sync"
// BytePool - temporary pool of byte slice.
type BytePool struct {
sync.Mutex
buf []byte // array of byte slices
used bool // indicates if a buf is in use
@harshavardhana
harshavardhana / main.go
Created August 7, 2017 07:19 — forked from FZambia/main.go
Verify armored GPG signature using Go language
package main
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"golang.org/x/crypto/openpgp/armor"