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
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
@tbhaxor
tbhaxor / bandit.txt
Last active May 1, 2022 06:24
OTW Challenge Flags
boJ9jbbUNNfktd78OOpsqOltutMc3MY1
CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
pIwrPrtPN36QITSp3EQaw936yaFoFgAB
koReBOKuIDDepwhWk7jZC0RTdopnAYKh
DXjZPULLxYr17uwoI01bNLQbtFemEgo7
HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs
cvX2JJa4CFALtqS87jk27qwqGhBM9plV
UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR
truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk
@tbhaxor
tbhaxor / brute.py
Created January 23, 2022 21:50
Brute force the zip file password using multithreading in python 3
#!/usr/bin/env python3
import sys
from threading import Thread
from queue import Queue
from zipfile import ZipFile, BadZipFile
from tempfile import mkdtemp
from blessings import Terminal
TMPDIR = mkdtemp()