Skip to content

Instantly share code, notes, and snippets.

View alexbridge's full-sized avatar

O.Bilenko alexbridge

View GitHub Profile
@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 November 4, 2023 08:13
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)