Skip to content

Instantly share code, notes, and snippets.

View zuramai's full-sized avatar

Saugi zuramai

View GitHub Profile

Yes, it is possible for memory leaks to occur during the process of uploading images to S3 (or any cloud storage service like MinIO). Memory leaks can happen due to improper handling of resources such as file handles, network connections, or buffers. If these resources are not properly released after use, they can accumulate over time and lead to increased memory usage, eventually causing performance degradation or crashes.

Here are some common scenarios where memory leaks can occur during image uploads to S3 and how to mitigate them:


1. Improper Handling of File Objects

  • Problem: When uploading files to S3, you often open file objects (e.g., using open() in Python) to read the file contents. If you don't close these file objects properly after the upload, they can remain in memory, leading to a memory leak.
  • Solution: Always ensure that file objects are properly closed after use. You can use Python's with statement, which automatically handles closing the file object once t
@zuramai
zuramai / contemplative-llms.txt
Created January 8, 2025 07:16 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@zuramai
zuramai / cis.js
Last active May 3, 2024 10:33
Auto Input CIS
const sleep = ms => new Promise(r => setTimeout(r, ms));
let i = 0
// PLEASE REMOVE THE JUDGEMENT SCORE, ONLY INCLUDE THE MEASUREMENT
let data = prompt().split('\n').filter(v => v != "")
const inputData = async () => {
let rightButton = document.querySelectorAll(".btn.btn-sm.btn-wsi-light")[5]
if (rightButton.classList.contains('disabled')) return false
let inputs = document.querySelectorAll('.mark-entry-direct')
/*! For license information please see desktop-player.min.js.LICENSE.txt */
(()=>{var e={132:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var o=n(637),a=n.n(o),i=n(521),r=n.n(i),l=n(21),s=n(418),p=a()(!1),g=r()(l.Z),d=r()(s.Z);p.push([e.id,'.mgp_container{height:100% !important;width:100% !important;position:relative;background:#000;overflow:hidden;color:#fff}.mgp_container,.mgp_container *{box-sizing:border-box !important;-webkit-tap-highlight-color:transparent}.mgp_container div,.mgp_container span,.mgp_container applet,.mgp_container object,.mgp_container iframe,.mgp_container h1,.mgp_container h2,.mgp_container h3,.mgp_container h4,.mgp_container h5,.mgp_container h6,.mgp_container p,.mgp_container blockquote,.mgp_container pre,.mgp_container a,.mgp_container abbr,.mgp_container acronym,.mgp_container address,.mgp_container big,.mgp_container cite,.mgp_container code,.mgp_container del,.mgp_container dfn,.mgp_container em,.mgp_container img,.mgp_container ins,.mgp_container kbd,.mgp_container q,.mgp_container
@zuramai
zuramai / series.php
Created July 20, 2023 02:53
Plugin series
<?php
/*
Plugin Name: Nested Route
*/
add_action('init', 'rpt');
function rpt() {
// flush_rewrite_rules();
register_post_type('series', [
'label' => 'series',
@zuramai
zuramai / comment-phone.php
Created July 17, 2023 06:17
Comment Phone Wordpress
<?php
/*
Plugin Name: Comment IP
Author: Ahmad Saugi
*/
add_action('plugin_init', 'ip_init');
function ip_init() {
}
@zuramai
zuramai / useMyFetch.ts
Created January 20, 2023 11:31
useFetch Wrapper
import type { NitroFetchRequest } from 'nitropack'
import type { KeyOfRes } from 'nuxt/dist/app/composables/asyncData'
import type { UseFetchOptions } from '#app'
type FetchOptions<T> = UseFetchOptions<
T extends void ? unknown : T,
(res: T extends void ? unknown : T) => T extends void ? unknown : T,
KeyOfRes<(res: T extends void ? unknown : T) => T extends void ? unknown : T>>
| undefined
@zuramai
zuramai / resume.json
Last active April 27, 2022 04:20
Resume JSON
{
"basics": {
"name": "Ahmad Saugi",
"label": "Software Engineer",
"image": "",
"email": "[email protected]",
"url": "https://saugi.me",
"summary": "My name is Ahmad Saugi, a bachelor of computer science student. My passion for software lies with dreaming up ideas and making them come true with elegant interfaces. I take great care in experience, architecture, and code quality of the things I build.\n\nI am also an open-source enthusiast and maintainer. I love how collaboration and knowledge sharing happens through open-source and I am happy to see what I do could eventually feedback to the community and industry.\n\nOutside of programming, I enjoy reading books. I love the pleasure and excitement of gaining new knowledge other than programming from the books I read.",
"location": {
"countryCode": "ID",
@zuramai
zuramai / unitCircle.js
Created March 14, 2022 03:23
Unit Circle Canvas
class UnitCircle {
constructor(canvas) {
this.canvas = canvas
this.ctx = this.canvas.getContext('2d')
this.circleSize = this.canvas.width * 2/5
this.position = [0.23, -0.5] // equivalent to [x, y]
this.mousePosition = [0, 0]
@zuramai
zuramai / index.html
Created February 28, 2022 02:09
CSS Grid
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS GRID</title>
<style>
.grid-container {
display: grid;
grid-template-columns: repeat(23,auto);