Skip to content

Instantly share code, notes, and snippets.

View tbhaxor's full-sized avatar
👨‍🚀
Exploring nature beyond Kármán line

Gurkirat Singh tbhaxor

👨‍🚀
Exploring nature beyond Kármán line
View GitHub Profile
@tbhaxor
tbhaxor / main.ts
Created March 9, 2025 07:28
Nestjs swagger bearerAuth error
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { ValidationPipe } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { ConfigService } from '@nestjs/config';
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
app.useGlobalPipes(new ValidationPipe());
function Test-AADUserLogin {
<#
.SYNOPSIS
Checks the validity of Azure AD user logins by testing if they exist.
.DESCRIPTION
This function validates the existence of Azure AD user logins.
It accepts email addresses either directly as a parameter or by reading them from a file.
Each login is sent as a request to the Azure AD credential endpoint to check its existence.
The function supports retrying failed requests for transient errors.
import {
ConnectedSocket,
MessageBody,
OnGatewayConnection,
SubscribeMessage,
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import { GameService } from './game.service';
import type { Namespace, Socket } from 'socket.io';
@tbhaxor
tbhaxor / validate-length.pipe.spec.ts
Created March 22, 2024 19:31
Nestjs length validation pipe
import { BadRequestException, InternalServerErrorException } from '@nestjs/common';
import { ValidateLengthPipe } from './validate-length.pipe';
import { faker } from '@faker-js/faker';
describe('ValidateLengthPipe', () => {
it('should throw InternalServerErrorException on empty object', () => {
expect(() => new ValidateLengthPipe({})).toThrow(InternalServerErrorException);
});
it('should throw InternalServerErrorException when min < 0', () => {
@tbhaxor
tbhaxor / clipboard.txt
Created January 14, 2024 15:47
CRTE Ki baate
Hello World
@tbhaxor
tbhaxor / run.bash
Last active April 7, 2023 10:44
Utility script to run the athena computations and generate movie
#!/bin/bash
problem=""
output_directory="."
framerate=5
skip_simulation=false
git_base=$(git rev-parse --show-toplevel)
athenapk_exe="$git_base/build/bin/athenaPK"
# Parse command-line arguments
@tbhaxor
tbhaxor / ArchMachineConfig.cmake
Last active March 24, 2023 11:56
AthenaPK Compilation Steps
message(STATUS "Configuring cmake for Arch-based distros")
# Configure cuda install path
set(CUDA_ROOT "/opt/cuda" CACHE FILEPATH "Locate cuda compiler and libraries")
# Configure kokkos archtecture
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Enable cuda backend for Kokkos")
set(GPU_DEVICE_ARCH "TURING75" CACHE STRING "GPU device architecture")
set(Kokkos_ARCH_${GPU_DEVICE_ARCH} ON CACHE BOOL "Enable Kokkos optimizations for ${GPU_DEVICE_ARCH} architecture only")
@tbhaxor
tbhaxor / wep_decrypt.py
Last active April 20, 2024 20:10
Decrypt and bruteforce script for tbhaxor blog
import re
import sys
import subprocess
import os
import uuid
from binascii import hexlify
from concurrent.futures import ThreadPoolExecutor
# check the required parameters in the argv list
if len(sys.argv) < 4:
@tbhaxor
tbhaxor / wordlist-gen.py
Created August 21, 2022 15:38
4 digit wordlist generator
from itertools import product
from string import digits
with open("wordlist.txt", "w") as file:
for secret in product(digits, repeat=4):
print(*secret, sep="", file=file)
@tbhaxor
tbhaxor / docker-best-practices.txt
Last active May 18, 2022 14:03
Docker best practices for container, engine api and registry
# docker engine
docker unix socket should be runnining on with approperiate permissions, root user and docker group
allow only authorized users to have the
tcp and unix can run in both mode
unix socket is more secure if private docker setup
expose tcp socket with authentication and tls certs
implement firewall plugin and configure it properly
# in container
do not give excesive capabilities or privileged access