Skip to content

Instantly share code, notes, and snippets.

View Mikescops's full-sized avatar
🐯
Hey

Corentin Mors Mikescops

🐯
Hey
View GitHub Profile
@koshatul
koshatul / README.md
Last active October 22, 2025 04:00
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
@andrew-nuwber
andrew-nuwber / README.md
Last active May 21, 2025 18:11
Namecheap DNS to zone file

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have

@sindresorhus
sindresorhus / esm-package.md
Last active December 25, 2025 12:39
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.
@statico
statico / index.js
Last active January 27, 2025 03:55
Simple AWS ECS status update notifications to Slack webhook
/*
Want to know when ECS events happen in Slack? Try this.
(1) Create a new Slack app with an incoming webhook, save the webhook URL
(2) Create an SNS topic called something like ECSEvents
(3) Create a CloudWatch Rule that publishes all ECS events to the topic
(4) Create a Node.js Lambda that is triggered by the SNS topic
(5) Add a WEBHOOK_URL environment variable to the Lambda with the webhook URL
(6) Paste this code into index.js
(7) Paste the contents of https://unpkg.com/node-fetch/lib/index.js into fetch.js
(8) Deploy and enjoy
import { TwitterApi } from 'twitter-api-v2';
const rl = require('readline');
const APP_INFOS = { appKey: 'XXX', appSecret: 'YYY' };
const readline = rl.createInterface({
input: process.stdin,
output: process.stdout
});
@ArsenyYankovsky
ArsenyYankovsky / dynamodb-lock-item.ts
Last active June 10, 2025 11:26
Lock an item in DynamoDB for exclusive processing.
/*
Assuming you have a blog Posts table with the following structure:
{
// hash key
"id": 154325,
"title": "Things you need to know before going bouldering for the first time.",
"text": "...",
// represents unix time of a moment this record was locked at
"lockedAt": 1684067555
}
@wojtekmaj
wojtekmaj / add-missing-import-extensions.txt
Last active October 17, 2025 17:51
Visual Studio Code-compatible regular expression to add all missing import extensions
# Find
import\s(([^;]|\n)*)\sfrom\s(['"])(\.{1,2}\/.*)(?<!\.js)(?<!\.(css|pdf|png|jpg|jsx|mjs|mp3|mp4|svg|ttf))(?<!\.(avif|json|webm|webp|woff))(?<!\.woff2)(['"]);
# Replace with
import $1 from $3$4.js$7;