Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active May 30, 2025 12:32
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.
@nanmi
nanmi / fun NLP.md
Last active April 1, 2025 10:51
fun NLP

The Most Powerful NLP-Weapon Arsenal

NLP民工的乐园: 几乎最全的中文NLP资源库

  • 词库
  • 工具包
  • 学习资料

在入门到熟悉NLP的过程中,用到了很多github上的包,遂整理了一下,分享在这里。

很多包非常有趣,值得收藏,满足大家的收集癖!

@sarkrui
sarkrui / WeChat_backup.sh
Last active February 23, 2023 09:48
备份微信聊天记录
#!/bin/bash
#change working directory to Desktop
cd ~/Desktop
# remove any previously existing compressed files
rm -f WeChat_history*
# generate the new updated
tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat
@soraxas
soraxas / compress
Last active September 1, 2023 05:03
script:Auto extraction tool based on the file extension
#!/bin/bash
SAVEIFS=$IFS
IFS="$(printf '\n\t')"
DEFAULT_FNAME=compressed_output
DEFAULT_FORMAT=tar.gz
SCRIPT="$(basename $0)"
function help {
printf "Usage: %s [-o|--output FNAME] [-f|--format FORMAT] <file1> [file2] ... [-- [OPTS_TO_PASSTHROUGH]]\n" "$SCRIPT"
@bumi
bumi / yjs-pg-server.js
Created March 20, 2020 10:04
implementation of a websocket server storing yjs documents in a postgresql database
const WebSocket = require('ws');
const http = require('http');
const Y = require('yjs');
const wsUtils = require('./utils');
const cookie = require('cookie');
const QuillDelta = require('quill-delta');
//const QuillConverter = require('node-quill-converter');
//const MdastFromQuillDelta = require('mdast-util-from-quill-delta');
@markmichon
markmichon / CircuitBreaker-configurable.js
Last active April 18, 2021 03:10
Circuit Breaker examples
class CircuitBreaker {
constructor(request, options = {}) {
const defaults = {
failureThreshold: 3,
successThreshold: 2,
timeout: 6000
}
Object.assign(this, defaults, options, {
request,
state: "CLOSED",
@tomnomnom
tomnomnom / alert.js
Last active May 8, 2025 06:03
Ways to alert(document.domain)
// How many ways can you alert(document.domain)?
// Comment with more ways and I'll add them :)
// I already know about the JSFuck way, but it's too long to add (:
// Direct invocation
alert(document.domain);
(alert)(document.domain);
al\u0065rt(document.domain);
al\u{65}rt(document.domain);
window['alert'](document.domain);
@denji
denji / README.md
Last active May 7, 2025 07:38 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@francabrera
francabrera / Cloudant View for Intrusion Detection System
Created September 20, 2016 09:00
A simple cloudant view which analyze the logged calls to the QE API in order to find suspected logs. Based on:
function (doc) {
if (doc.loopback__model__name == "Auditlog"){
var filters = {
"filters":{
"filter":[
{
"id":"1",
"rule":"(?:\"[^\"]*[^-]?>)|(?:[^\\w\\s]\\s*\\\/>)|(?:>\")",
"description":"Finds html breaking injections including whitespace attacks",
"tags":{
@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active May 12, 2025 03:50
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js