Skip to content

Instantly share code, notes, and snippets.

View itemir's full-sized avatar

Ilker Temir itemir

View GitHub Profile
@itemir
itemir / capitalize.js
Created May 3, 2023 19:18
Capitalizes text including all words that are three letters or less
// Capitalizes text including all words that are three letters or less
function capitalize(str) {
var lower = String(str).toLowerCase();
return lower.replace(/\b([a-z]{1,3}\b|\w)/g, function(x) {
return x.toUpperCase();
});
}
@itemir
itemir / md5_multipart_upload.py
Last active January 18, 2024 15:31
Python script to calculate MD5 hash of a multipart uploaded file (relevant for Object Storages like OCI Object Storage or AWS S3)
#!/usr/bin/python
import argparse
import hashlib
import sys
def md5(f, count):
hash_md5 = hashlib.md5()
eof = False
for i in range(count * 16):
chunk = f.read(65536)