Skip to content

Instantly share code, notes, and snippets.

View seanc's full-sized avatar

Sean Wilson seanc

View GitHub Profile
@eranbetzalel
eranbetzalel / batch-worker-host.ts
Last active May 30, 2025 16:03
This class provides an efficient and flexible way to handle batch processing of jobs in a BullMQ environment, leveraging NestJS. It ensures that jobs are processed in batches, which can be crucial for performance optimization in applications requiring bulk operations..
import {WorkerHost} from '@nestjs/bullmq';
import {Job} from 'bullmq';
export class BatchWorkerHost extends WorkerHost {
private jobBatchCreationTime: Date;
private jobBatch: Job[];
private jobBatchProcessPromise: Promise<void>;
private running: boolean = false;
private resolveJobBatchProcessPromise: () => void;
@Geczy
Geczy / readme.md
Last active June 6, 2025 15:36
Migrate Coolify to a new server
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active May 20, 2025 14:04
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/rfc9562/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@IlCallo
IlCallo / move.ts
Last active March 14, 2024 16:21
Apply Drag and Drop to QTable rows using SortableJs
// Taken from https://github.com/angular/components/blob/master/src/cdk/drag-drop/drag-utils.ts
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
@danalloway
danalloway / supabase_upload_stream.js
Created April 2, 2021 02:57
Supabase Storage - Upload Stream
const fetch = require("node-fetch");
const FormData = require("form-data");
const API_URL = process.env.SUPABASE_URL;
const AUTH_TOKEN = process.env.SUPABASE_KEY;
/**
* @async
* @param {string} bucketId
* @param {string} path
@sindresorhus
sindresorhus / esm-package.md
Last active June 7, 2025 05:45
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@seanc
seanc / fav-software.md
Created June 6, 2019 04:35
List of my favorite software

Favorite Software / Platforms

  • Visual Studio Code Insiders
  • Trello
  • GitKraken
  • DBeaver CE
  • Firefox
  • aXe accessibility testing extension
  • AndCo
  • Stripe
@AlexeyKupershtokh
AlexeyKupershtokh / dump.sql
Last active October 23, 2024 10:50
Postgres DDL to Clickhouse converter
select
concat(
'create table ',
table_name,
'(',
string_agg(
concat(
column_name,
' ',
CASE when is_nullable = 'YES' THEN 'Nullable(' END,
@iPublicis
iPublicis / trelloinstall.sh
Last active July 16, 2024 16:40
Install Trello Linux Client
#!/bin/bash
# Your system should be 64 bits and check if the last version at https://github.com/danielchatfield/trello-desktop/ is 0.19
# If the current version is not 0.19 change the file name below accordingly
wget https://github.com/Racle/trello-desktop/releases/download/v0.2.0/Trello-linux-0.2.0.zip -O trello.zip
sudo mkdir /opt/trello
sudo unzip trello.zip -d /opt/trello/
sudo ln -sf /opt/trello/Trello /usr/bin/trello
echo -e '[Desktop Entry]\n Version=1.0\n Name=Trello Desktop\n Exec=/usr/bin/trello\n Icon=/opt/trello/resources/app/static/Icon.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/trello.desktop