Skip to content

Instantly share code, notes, and snippets.

View gambitier's full-sized avatar
🏆
Open for collaboration

Akash Jadhav gambitier

🏆
Open for collaboration
View GitHub Profile
@gambitier
gambitier / s3_delete_folder.go
Created January 21, 2025 13:43
A Go script to efficiently delete a folder (and all its contents) from an Amazon S3 bucket. The script uses the AWS SDK for Go and optimizes performance by employing concurrency and batch deletions, making it suitable for large-scale deletions of S3 objects.
package main
import (
"log"
"sync"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)

Convert GIF files to WebP and WebM format to save space when archiving

In the following post I want to share something for users who have tons of GIFs and want to store or archive the information in a more space-saving way.

Disclaimer: I do not take responsibility for any damages to or losses of your files.

Do you also have dozens of GIF files and ever wondered why a little bit blinking or a movement of few seconds needs several MB storage? If it is your own content, you need them in original state or anything similar, you can stop reading any further.

GIF files have been invented a very long time ago (you remember 1987?) and weren't meant to be used for displaying an anime or short movie clip and the like. Therefore the format and compression (is no longer) isn't efficient enough.

@gambitier
gambitier / .golangci.yml
Created August 5, 2024 14:28 — forked from maratori/.golangci.yml
Golden config for golangci-lint
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021 Marat Reymers
## Golden config for golangci-lint v1.59.1
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt and change it for your needs.
run:
@gambitier
gambitier / github-release-notes.md
Created October 24, 2023 16:41
Creating Github Release Notes
using ClosedXML.Excel;
public async Task<FileResult> ExportPeopleInExcel()
{
var people = await context.People.ToListAsync();
var fileName = "people.xlsx";
return GenerateExcel(fileName, people);
}
private FileResult GenerateExcel(string fileName, IEnumerable<Person> people)
import { exec as exec_child_process } from 'child_process';
const exec = util.promisify(exec_child_process);
async function initGitRepo(dest: string) {
try {
const command = 'git init';
const { stdout, stderr } = await exec(command, {
cwd: dest
});
console.log(`stdout: ${stdout}`);
import * as convert from 'xml-js';
const xml = readFileSync(filePath, {
encoding: 'utf8'
});
const result1 = convert.xml2json(xml, { compact: true, spaces: 4 });
const data = JSON.parse(result1) as DataType;
function getAllFiles(dirFullPath: string, arrayOfFiles: string[] = []) {
const files = readdirSync(dirFullPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(function (file) {
if (statSync(dirFullPath + '/' + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirFullPath + '/' + file, arrayOfFiles);
} else {
arrayOfFiles.push(path.join(dirFullPath, '/', file));
@gambitier
gambitier / deepGroupBy.js
Created January 6, 2023 06:11 — forked from leofavre/deepGroupBy.js
Similar to LoDash groupBy(), but with nested groups.
/**
* Part of [Canivete](http://canivete.leofavre.com/#deepgroupby)
*
* Groups the contents of an array by one or more iteratees.
* Unlike Lodash [`groupBy()`](https://lodash.com/docs/4.17.4#groupBy),
* this function can create nested groups, but cannot receive
* strings for iteratees.
*/
const deepGroupBy = (collection, ...iteratees) => {
let paths = collection.map(value => iteratees.map(iteratee => iteratee(value))),

Paste the code in your Browser’s Console

var jqry = document.createElement('script');
jqry.src = "https://code.jquery.com/jquery-3.3.1.min.js";
document.getElementsByTagName('head')[0].appendChild(jqry);
jQuery.noConflict();