Skip to content

Instantly share code, notes, and snippets.

View space11's full-sized avatar
🐧

Borys space11

🐧
View GitHub Profile
@space11
space11 / installing-postman.md
Created September 2, 2024 09:03 — forked from pmkay/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@space11
space11 / dayjs-range.ts
Created May 21, 2024 10:56
Generate to date ranges
// Credit to https://github.com/iamkun/dayjs/issues/1162?fbclid=IwAR2swchqUZ3ovxzj0MeL7CVbZpN8KVnWx-LgLwIY80UNuGSQ4TRnQC3wIfQ#issuecomment-1694654608
import type { Dayjs, ManipulateType } from 'dayjs';
/**
* Create a range of Day.js dates between a start and end date.
*
* ```js
* dayjsRange(dayjs('2021-04-03'), dayjs('2021-04-05'), 'day');
* // => [dayjs('2021-04-03'), dayjs('2021-04-04'), dayjs('2021-04-05')]
@space11
space11 / frontend-framework-detector.js
Created April 30, 2024 15:43
Detect front end framework
// Credit to: https://stackoverflow.com/a/75537070/9336948
if(!!window.React ||
!!window.__REACT_DEVTOOLS_GLOBAL_HOOK__ ||
!!document.querySelector('[data-reactroot], [data-reactid]'))
console.log('React.js');
if(!!document.querySelector('script[id=__NEXT_DATA__]'))
console.log('Next.js');
if(!!document.querySelector('[id=___gatsby]'))
@space11
space11 / join_mp4_files.sh
Created April 17, 2024 18:18
Join mp4 files in linux
# Find files in directory
for f in *.m4a; do echo "file '$f'" >> mylist.txt; done
# Join found files using ffmpg
ffmpeg -f concat -i mylist.txt output.m4a
@space11
space11 / component.html
Created April 5, 2024 11:35
Allow only one ngx-bootstrap Popover at the time.
<button
type="button"
class="btn btn-default btn-secondary"
popover="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."
popoverTitle="Popover on top"
placement="top"
>
Popover on top
</button>
import "regexp"
// Basic regular expressions for validating strings
const (
Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\
@space11
space11 / mail.txt
Created November 22, 2023 18:50
Mail to Delete Any Account
Subject: Request for [Company Name] Account Deletion
Dear [Company Name] Team,
I am writing this email to request the deletion of my account as I have no further use for it. Kindly delete my account along with all my account information from your database.
Below are my account details:
Name: [Your Full Name]
Email: [Your Registered Email]
@space11
space11 / Sequential-Diagram-of-Electronic-Payment.uml
Last active October 24, 2023 15:58
Sequential Diagram of Electronic Payment
@startuml
title Sequential Diagram of Electronic Payment
actor CustomerA
actor BankA
actor BankB
participant "Seller/Service Provider" as Seller
CustomerA -> Seller: INITIATE PAYMENT
activate Seller
@space11
space11 / exception.filter.ts
Last active September 30, 2023 11:58
NestJs error filter example.
import { ArgumentsHost, Catch, ExceptionFilter, HttpException, HttpStatus, Logger } from '@nestjs/common';
@Catch()
export class HttpErrorFilter implements ExceptionFilter {
private readonly logger : Logger
constructor(){
this.logger = new Logger
}
catch(exception: Error, host: ArgumentsHost): any {
const ctx = host.switchToHttp();
@space11
space11 / install_nerd_font.sh
Created September 7, 2023 07:19
Install Nerd Font on Linux / Ubuntu
#Find the font
## Go to nerd fonts patched-fonts directory: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts
# Go to user font directory
cd ~/.fonts
# Donwload a font file and save it.
curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DroidSansMono/DroidSansMNerdFontMono-Regular.otf
# Rebuild the font cache
fc-cache -fv