Skip to content

Instantly share code, notes, and snippets.

@Mualig
Mualig / exceptionsLogger.filter.ts
Last active February 15, 2022 14:03
NestJS Exception logger filter
import { ArgumentsHost, Catch, HttpException } from '@nestjs/common';
import { BaseExceptionFilter } from '@nestjs/core';
import { Constants } from '../constants.utils';
import { LoggingService } from '../logging/logging.service';
@Catch()
export class ExceptionsLoggerFilter extends BaseExceptionFilter {
private readonly log;
constructor(logger: LoggingService, httpAdapter: any) {
@Mualig
Mualig / killStuckContainers.sh
Created January 4, 2022 15:26
Kill / Clear Docker's containers stuck in "Created" state
#!/usr/bin/env sh
# Get the list of all containers
containers=$(docker ps -a | grep "Created" | awk '{print $1}')
# Get length of the list
length=$(echo "$containers" | awk '{print NF}')
echo "Gonna kill ${length} containers"
# Kill the stuck containers
@Mualig
Mualig / mongodb_kill_old_ops.md
Last active April 26, 2021 14:20
Command to kill old mongo DB ops

Command to kill old mongo DB operations

db.currentOp().inprog.forEach(
    function (op) {
        if (op.secs_running > 5) {
            print("host: " + op.host
                + " secs_running: " + op.secs_running
                + " op: " + op.op
 + " ns: " + op.ns
@Mualig
Mualig / docker-service-failing.md
Last active April 12, 2021 12:45
Docker service failing to start due to a network error

Pulled from https://stackoverflow.com/a/64948301

To unlock a docker service failing to start with this error:

network sandbox join failed: subnet sandbox join failed for "10.0.0.0/24": error creating vxlan interface: file exists

You can try to the [following steps][1].

  1. Check each node for any vx-* interfaces in /sys/class/net
ls -l /sys/class/net/ | grep vx
@Mualig
Mualig / FindThenRemoveFiles.md
Last active December 24, 2020 13:22
Find then remove files from multiple folders

Find then remove files from multiple folders

find ./ -name "docker.log" -type f -exec rm {} \;

source

Keybase proof

I hereby claim:

  • I am mualig on github.
  • I am mualig (https://keybase.io/mualig) on keybase.
  • I have a public key ASDfUcGM5uMv3esPI-xgaZtO_IGQtZXCoHswjtzgh2fnYQo

To claim this, I am signing this object:

@Mualig
Mualig / Node-IDE.gitignore
Last active February 11, 2020 08:18
Git ignore for node and various IDE
# Inspired from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
@Mualig
Mualig / remove-old-mongo-id.js
Created September 26, 2018 11:53
Remove old mongo documents based on _id
db.getCollection("raws").remove({
$where: function() {
return this._id.getTimestamp() <= new Date("2018-08-12");
}
})
@Mualig
Mualig / conventional-commit.md
Last active December 24, 2020 13:21
Conventional commit : mots clefs, format et exemple

Liste des mots clefs

  • 'build'
  • 'ci'
  • 'chore'
  • 'docs'
  • 'feat'
  • 'fix'
  • 'perf'
  • 'refactor'
  • 'revert'