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
@harshavardhana
harshavardhana / nginx-minio-static.md
Last active April 19, 2024 09:33 — forked from koolhead17/gist:4b8dd8d95ec86368634693cf9ad9391c
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@harshavardhana
harshavardhana / humanize-duration.go
Created September 13, 2015 09:19
humanizeDuration humanizes time.Duration output to a meaningful value - golang's default ``time.Duration`` output is badly formatted and unreadable.
package main
import (
"fmt"
"math"
"time"
)
// humanizeDuration humanizes time.Duration output to a meaningful value,
// golang's default ``time.Duration`` output is badly formatted and unreadable.
version: '3.7'
# Settings and configurations that are common for all containers
x-minio-common: &minio-common
image: quay.io/minio/minio:${RELEASE}
command: server http://site1-minio{1...4}/data{1...2}
environment:
- MINIO_PROMETHEUS_AUTH_TYPE=public
- CI=true
@harshavardhana
harshavardhana / AES.java
Created February 12, 2017 09:52 — forked from dweymouth/AES.java
A Java class to perform password-based AES encryption and decryption
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <dweymouth@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. D. Weymouth 4/2014
* ----------------------------------------------------------------------------
*/
import java.io.*;
@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
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="YOUR-ACCESSKEY"
S3SECRET="YOUR-SECRETKEY"
function putS3
{
path=$1
file=$2
aws_path=$3
"""
FTP benchmark.
Usage:
ftpbench --help
ftpbench -h <host> -u <user> -p <password> [options] login
ftpbench -h <host> -u <user> -p <password> [options] upload <workdir> [-s <size>]
ftpbench -h <host> -u <user> -p <password> [options] download <workdir> [-s <size>] [--files <count>]
Connection options:
DATA AND METADATA COHERENCE
Some modern cluster file systems provide perfect cache coherence among their clients. Perfect cache coherence among disparate NFS clients is expensive to achieve, especially on wide area networks. As such, NFS settles for weaker cache coherence that satisfies the requirements of most file sharing types.
Close-to-open cache consistency
Typically file sharing is completely sequential. First client A opens a file, writes something to it, then closes it. Then client B opens the same file, and reads the changes.
When an application opens a file stored on an NFS version 3 server, the NFS client checks that the file exists on the server and is permitted to the opener by sending a GETATTR or ACCESS request. The NFS client sends these requests regardless of the freshness of the file's cached attributes.
When the application closes the file, the NFS client writes back any pending changes to the file so that the next opener can view the changes. This al
#!/bin/bash \
i=1
sudo rm -f /tmp/fstab
for disk in $(lsblk -i -p -n -o NAME | grep -v 'loop\|nvme0\|nvme1\|nvme2\|nvme3\|ubuntu\|md\|sda' | sort); do
sudo mkdir -p /disk${i}
sudo mkfs.xfs -f -L disk${i} $disk
echo "LABEL=disk${i} /disk${i} xfs defaults,noatime 0 0" | sudo tee -a /tmp/fstab
i=$(( $i + 1 ))
@harshavardhana
harshavardhana / README.md
Last active March 16, 2023 17:16 — forked from magnetikonline/README.md
AWS S3 bucket policy recipes.