Skip to content

Instantly share code, notes, and snippets.

View ayuthmang's full-sized avatar
😊
Hope you have a great year

Ayuth Mangmesap ayuthmang

😊
Hope you have a great year
  • Bangkok, Thailand
View GitHub Profile
@ibayazit
ibayazit / serialize.interceptor.ts
Created April 13, 2023 08:58
NestJS format outgoing response
import {
UseInterceptors,
NestInterceptor,
ExecutionContext,
CallHandler
} from "@nestjs/common";
import { Observable } from "rxjs";
import { map } from "rxjs";
import { plainToInstance } from "class-transformer";
@mattbajorek
mattbajorek / notification.service.ts
Last active August 23, 2023 06:03
Full notification service
import { Injectable } from '@nestjs/common';
import { mapLimit } from 'async';
import * as firebase from 'firebase-admin';
import { BatchResponse } from 'firebase-admin/lib/messaging/messaging-api';
import { chunk } from 'lodash';
import * as shell from 'shelljs';
export interface ISendFirebaseMessages {
token: string;
title?: string;

To embed the contents of an SVG file into your site using NextJS 12 with the new Rust-based compiler, perform the following steps:

  1. Install @svg/webpack:
$ npm install --save-dev @svgr/webpack
  1. Create a svgr.config.js config file with the following contents. This will remove the width and height from the SVG but keep the viewBox for correct scaling.
@jgru
jgru / Dockerfile
Created August 14, 2021 11:09
Autopsy 4.19.0 in a Docker
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y testdisk wget gnupg
RUN wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | apt-key add -
RUN echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" > /etc/apt/sources.list.d/bellsoft.list
RUN apt-get update
Creating the license
Monokai Pro requires an email to purchase a license, so we're going to need one here. I'm going to use a placeholder address: [email protected].
Sublime Text 3 -
Take your email address and get the MD5 hash of it; you can use a website like https://www.md5hashgenerator.com/ for this. My test email comes out with 5658ffccee7f0ebfda2b226238b1eb6e or use https://monogen.vercel.app/.
Now, take the first 25 characters (so 5658ffccee7f0ebfda2b22623 for me), and insert a - after every 5 characters. You'll now have a valid license; in my case, it's 5658f-fccee-7f0eb-fda2b-22623.
Visual Studio Code -
To get it to work with VScode, you need to MD5 the extension UUID with the email you want to use and use the first 25 characters of the MD5 hash for VScode.
brew tap homebrew/cask-fonts
brew install --cask font-cascadia-code
brew install --cask font-cascadia-code-pl
brew install --cask font-cascadia-mono
brew install --cask font-cascadia-mono-pl
@sindresorhus
sindresorhus / esm-package.md
Last active November 17, 2024 12:06
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.
@gaearon
gaearon / Classes.js
Created May 27, 2020 17:38
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@kripod
kripod / package.json
Created May 6, 2020 10:30
Creating minified ESM+CJS bundles from TypeScript with Rollup and Babel in a monorepo, utilizing conditional exports
{
"name": "to-be-added",
"version": "0.0.0",
"sideEffects": false,
"exports": {
".": {
"import": "./dist-esm/bundle.min.mjs",
"require": "./dist-cjs/bundle.min.cjs"
},
"./server": "./server/index.js"
@nikallass
nikallass / check-smb-v3.11.sh
Created March 11, 2020 04:57
CVE-2020-0796. Scan HOST/CIDR with nmap script smb-protocols.nse and grep SMB version 3.11.
#!/bin/bash
if [ $# -eq 0 ]
then
echo $'Usage:\n\tcheck-smb-v3.11.sh TARGET_IP_or_CIDR'
exit 1
fi
echo "Checking if there's SMB v3.11 in" $1 "..."
nmap -p445 --script smb-protocols -Pn -n $1 | grep -P '\d+\.\d+\.\d+\.\d+|^\|.\s+3.11' | tr '\n' ' ' | replace 'Nmap scan report for' '@' | tr "@" "\n" | grep 3.11 | tr '|' ' ' | tr '_' ' ' | grep -oP '\d+\.\d+\.\d+\.\d+'