Skip to content

Instantly share code, notes, and snippets.

View msonowal's full-sized avatar
I zapp it.

Manash Sonowal msonowal

I zapp it.
View GitHub Profile
@msonowal
msonowal / README.md
Created March 4, 2022 16:00 — forked from josephdpurcell/README.md
NestJS: Ignore global ValidationPipe interceptor for a controller route

What is this?

This is an example of how to ignore a global validation pipe for a specific parameter, e.g. a request body. In fact, this example just shows a request body but you could apply this principle to other decorators.

This approach assumes validateCustomDecorators: false in the global validation pipe. If validateCustomDecorators is true in the global pipe I think you're out of luck. If that is your situation, consider refactoring so that validateCustomDecorators is false in the global pipe and then have each custom decorator add validation if it needs it.

How does this work?

The NestJS ValidationPipe does not validate custom decorators. So, in this above example we just make a @RawBody() param decorator, and NestJS will skip validating it.

@msonowal
msonowal / php-pools.md
Created December 16, 2021 11:32 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@msonowal
msonowal / main.yml
Created December 12, 2021 17:44 — forked from fulv/main.yml
Ansible - Creating users and copying ssh keypair files to the remote server
Put this in your `local-configure.yml` file, add as many users as you need:
users:
- name: fulvio
sudoer: yes
auth_key: ssh-rsa blahblahblahsomekey this is actually the public key in cleartext
- name: plone_buildout
group: plone_group
sudoer: no
auth_key: ssh-rsa blahblahblah ansible-generated on default
@msonowal
msonowal / gotham.md
Created May 31, 2021 10:13 — forked from mfd/ gotham.md
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">

@msonowal
msonowal / aws-cfn-self-referencing-sg.json
Created July 21, 2020 05:52 — forked from alanwill/aws-cfn-self-referencing-sg.json
AWS CloudFormation example that allows a security group rule to reference the same security group as the source.
{
"Description": "Create a VPC with a SG which references itself",
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpctester": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "172.16.0.0/23",
"EnableDnsSupport": false,
"EnableDnsHostnames": false,
@msonowal
msonowal / .Service Worker Setup.md
Created April 16, 2020 08:26 — forked from bryandh/.Service Worker Setup.md
Service Worker setup in Typescript

Service Worker Setup

@msonowal
msonowal / service-worker.d.ts
Created April 16, 2020 08:26 — forked from ithinkihaveacat/service-worker.d.ts
Typings for using the Service Worker API with TypeScript
/**
* Copyright (c) 2016, Tiernan Cridland
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
* granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
@msonowal
msonowal / array.ts
Created January 28, 2020 09:30 — forked from znck/array.ts
Array.prototype.forEachNonBlocking
export async function forEachNonBlocking<T>(
arrayOrIterator: IterableIterator<T> | T[],
fn: (item: T) => void,
frameBudgetInMillis: number = 10
): Promise<void> {
const iterator = Array.isArray(arrayOrIterator)
? arrayOrIterator[Symbol.iterator]()
: arrayOrIterator;
return new Promise((resolve, reject) => {
@msonowal
msonowal / SvgIcon.vue
Created January 3, 2020 10:42 — forked from calebporzio/SvgIcon.vue
SVG Icon Vue Component
<template>
<div class="inline-block" v-html="require('icon-' + this.icon + '.svg')"></div>
</template>
<style module>
.svg {
fill: currentColor;
height: 1em;
margin-top: -4px;
vertical-align: middle;
@msonowal
msonowal / iterm2-solarized.md
Created August 26, 2019 20:50 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k