Skip to content

Instantly share code, notes, and snippets.

View 0-vortex's full-sized avatar
:shipit:
looking out for #0

TED Vortex (Teodor-Eugen Duțulescu) 0-vortex

:shipit:
looking out for #0
View GitHub Profile
@JohnBra
JohnBra / useStorage.tsx
Created July 4, 2022 22:44
Typed React useStorage hook for chrome extensions
import { Dispatch, SetStateAction, useState, useEffect, useCallback, useRef } from 'react';
export type StorageArea = 'sync' | 'local';
// custom hook to set chrome local/sync storage
// should also set a listener on this specific key
type SetValue<T> = Dispatch<SetStateAction<T>>;
/**
@anchan828
anchan828 / README.md
Last active May 1, 2024 04:26
This is an improvement to allow @nestjs/typeorm@8.1.x to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

@martinwoodward
martinwoodward / mermaid.md
Created February 11, 2022 20:34
GitHub HTML Rendering Pipeline
```mermaid
sequenceDiagram
    participant dotcom
    participant iframe
    participant viewscreen
    dotcom->>iframe: loads html w/ iframe url
    iframe->>viewscreen: request template
    viewscreen->>iframe: html & javascript
 iframe-&gt;&gt;dotcom: iframe ready
@CribberSix
CribberSix / 0033.yml
Last active February 20, 2024 09:51
docker-compose.yml for a series of articles on my medium
version: "3"
services:
# scheduler & monitoring service
airflow-webserver:
hostname: myairflow
container_name: airflow_container
image: 'puckel/docker-airflow:1.10.9' # latest image as of 2021-11-08.
ports:
- '8085:8080'
@gwillem
gwillem / _cronrat.sh
Last active July 11, 2022 14:04
This is the decoded payload from the CRON loader. Full analysis here: https://sansec.io/research/cronrat
set -eEu
set -o pipefail
trap 'echo "L$LINENO"; O70; exit -1' ERR
O54=4
function O70()
{
if [[ ! -z "${O57+x}" ]]; then
if [[ -f "${O57}" ]]; then
rm -f "${O57}"
fi
@MarZab
MarZab / api-filter-query.ts
Last active April 11, 2024 11:14
NestJS Filters with Swagger deepObject (example: `?filters[name]=thing1&filters[description]=thing2`)
import { applyDecorators } from '@nestjs/common';
import { ApiExtraModels, ApiQuery, getSchemaPath } from '@nestjs/swagger';
/**
* Combines Swagger Decorators to create a description for `filters[name]=something`
* - has support for swagger
* - automatic transformation with nestjs
*/
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/explicit-module-boundary-types
export function ApiFilterQuery(fieldName: string, filterDto: Function) {
@sindresorhus
sindresorhus / esm-package.md
Last active May 21, 2024 21:42
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.
@0-vortex
0-vortex / rules.txt
Last active January 10, 2024 18:05
PerimeterX
// get atob functions
VariableDeclarator StaticMemberExpression[property=atob]
VariableDeclarator[init.type="CallExpression"][init.callee.body.statements.0.body.statements.0.expression.property="atob"]
.closest('VariableDeclarator[init]')
// get atob function aliases
FunctionDeclaration ReturnStatement IdentifierExpression[name="Pu"]
.closest('FunctionDeclaration BindingIdentifier')
CallExpression[callee.type="IdentifierExpression"][callee.name="et"][arguments.length=1][arguments.0.type="LiteralStringExpression"]
@cecilemuller
cecilemuller / example.yml
Created October 20, 2020 01:49
Run Docker Compose + in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@orta
orta / _npm-vs-yarn.md
Last active November 1, 2020 19:10
Yarn vs npm CLI

These are the common everyday commands used in most projects:

Installing a package deps

npm install

yarn install