Skip to content

Instantly share code, notes, and snippets.

@ErfanMirzapour
ErfanMirzapour / TailwindCSS-CheatSheet.md
Last active September 9, 2024 17:01
Mapping CSS properties to equivalent tailwind classes
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2025 12:29
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.
function preprocessImage(canvas) {
const ctx = canvas.getContext('2d');
const image = ctx.getImageData(0,0,canvas.width, canvas.height);
blurARGB(image.data, canvas, 1);
dilate(image.data, canvas);
invertColors(image.data);
thresholdFilter(image.data, 0.4);
return image;
}
@mstorus
mstorus / cryptoSign.js
Created February 27, 2021 07:03
use browser subtle crypto to sign some text with hmac-sha1
async function cryptoSign(message) {
const key = await window.crypto.subtle.generateKey(
{
name: "HMAC",
hash: { name: "SHA-512" },
},
true,
["sign", "verify"]
);
const encodedText = new TextEncoder().encode(message);
@kleysonr
kleysonr / face_liveness.html
Last active March 8, 2025 21:10
Mediapipe facemesh eye blink for face liveness detection example
<html>
<head>
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Require the peer dependencies of facemesh. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-converter.min.js"></script>
@MBrassey
MBrassey / Match_Addresses.md
Last active March 12, 2025 21:33
Match Crypto Wallet Addresses (REGEX)

Match Crypto Wallet Addresses using Regular Expressions

The following regular expressions are crafted to match some commonly used cryptocurrency wallet address types. This document details the Regex components and pattern tests to match Ethereum, Bitcoin, Dash and Monero addresses.

🌀 Click the images below to view the tested patterns.

Ethereum (ETH)

/^0x[a-fA-F0-9]{40}$/g

@jengel3
jengel3 / authentication-1.controller.ts
Last active April 23, 2024 19:26
NestJS - Implementing Access & Refresh Token Authentication
// app/modules/authentication/authentication.controller.ts
import { Body, Controller, Post } from '@nestjs/common'
import { RegisterRequest } from './requests'
import { User } from '../../modules/user'
import { UsersService } from '../users/users.service'
@eunsukimme
eunsukimme / Dockerfile.app
Last active March 4, 2025 13:08
Configuration Files for Logging System wigh Docker-elk, Filebeat and Node.js
FROM node:12
WORKDIR /app
COPY ./package*.json ./
RUN npm install
ENV PORT=4000
COPY . .
CMD ["npm","run","start"]
@ruizb
ruizb / README.md
Last active January 17, 2025 13:06
A glossary of TypeScript.

A glossary of TypeScript

Motivation

Once upon a time, there was a developer that had an issue using the TypeScript language. He wanted to share his issue with the community to get help, but he didn't know how to properly write the title that would best describe his problem. He struggled to find the appropriate words as he didn't know how to name "this behavior" or "that kind of type mechanism".

This story encouraged me to start writing a glossary of TypeScript. Hopefully it will help you if you have to look for an issue, write an issue, or communicate with other TypeScript developers.

Disclaimer: it was me, I was the developer that struggled. I still struggle though, but this means I still have things to learn, which is great!

@farhadshiri
farhadshiri / exploit.asm
Last active January 7, 2023 19:37
DNS Response Denial-of-Service
; HOD-symantec-firewall-DoS-expl.asm:
; Symantec Multiple Firewall DNS Response Denial-of-Service
; -------------------------------------------------------------------
; By f.shiri 2020
; [email protected]
; -------------------------------------------------------------------
; Tested on:
; - Symantec Norton Personal Firewall
; Systems Affected:
; -------------------------------------------------------------------