Skip to content

Instantly share code, notes, and snippets.

View alexbridge's full-sized avatar

O.Bilenko alexbridge

View GitHub Profile
@alexbridge
alexbridge / CHEAT_SHEETS.md
Last active February 20, 2025 10:15
Dev Cheatsheets
watch -n 1 "cat /proc/79204/smaps | grep -i pss |  awk '{Total+=\$2} END {print Total/1024 \"MiB\"}'"
@alexbridge
alexbridge / post-response.js
Created November 14, 2024 14:52
Postman / Visualize JWT Token
const { access_token } = pm.response.json();
const jwtToken = JSON.parse(atob(access_token.split('.')[1]));
var template = `
<style type="text/css">
.tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
.tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}
.tftable tr {background-color:#ffffff;}
.tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
@alexbridge
alexbridge / commons.gradle
Created August 12, 2024 11:53
Gradle include Test Files or Test methods
useJUnitPlatform {
// Include Test Files
if (project.hasProperty('includeTestFiles')) {
((project.property('includeTestFiles') as String).tokenize(',')).each {
include "${it}"
}
}
filter {
// Include Test Methods
@alexbridge
alexbridge / docker.install.sh
Created January 18, 2024 19:17
Ubuntu docker install bash script
#!/bin/bash
# Install Docker, you can ignore the warning from Docker about using WSL
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add your user to the Docker group
sudo usermod -aG docker $USER
# Sanity check that both tools were installed successfully
@alexbridge
alexbridge / Makefile
Created January 14, 2024 10:40
GIT bump all submodules to latest develop branch
bump-versions:
git submodule foreach 'git fetch origin; git checkout origin/develop'
git submodule foreach 'cd .. && git add $$name'
git commit -m 'Bump versions'
git show
@alexbridge
alexbridge / nextjs-module.ts
Created November 6, 2023 19:36
Nestjs useFactory example with inject and ConfigService
@Module({
providers: [
{
provide: MyApiService,
useFactory: (configService: ConfigService) => {
return new MyApiService(
configService.getOrThrow('MY_BASE_URL'),
configService.getOrThrow('MY_USER'),
configService.getOrThrow('MY_PASSWORD')
);
@alexbridge
alexbridge / README.md
Last active July 31, 2024 13:40
Nestjs Entity param converter. Convert request parameter to domain entity

Nestjs Entity param converter pipe

Convert input param into domain entity.

@Controller('books')
export class BooksController {
  @Get('/:id')
  async getBook(@Param('id', IdToEntityPipe()) book: BookEntity): Promise<BookEntity> {
return book;
@alexbridge
alexbridge / middleware.js
Last active October 1, 2019 11:19
Simle JS middleware implementation (ES6 Class version)
class Middleware {
use(fn) {
this.go = (prev => item => {
return prev(fn(item));
}
)(this.go)
}
go(item) {
console.count('GO');
return item;
@alexbridge
alexbridge / README.md
Last active April 7, 2019 06:52
MySql: Find out percentage of tables created on disk

Find out percentage of tables created on disk

mysql> show global status like 'created_tmp_disk_tables';
+-------------------------+--------+
| Variable_name           | Value  |
+-------------------------+--------+
| Created_tmp_disk_tables | 278571 |
+-------------------------+--------+
1 row in set (0.00 sec)