Skip to content

Instantly share code, notes, and snippets.

View bricss's full-sized avatar
🦉
Understand Create Evaluate

Yahor Siarheyenka bricss

🦉
Understand Create Evaluate
View GitHub Profile
@bricss
bricss / git-broom.sh
Last active February 17, 2023 17:16
Remove remote merged branches from Git repo
#!/usr/bin/env bash
# Removes remote merged branches from Git repo
# Usage: `sh git-broom.sh`
protect='(dev|main|master|release)'
git fetch --prune --tags origin
git branch --remotes --merged origin | grep origin | grep -v $(git symbolic-ref --short HEAD) | egrep -v $protect | sed s/origin\\/// | xargs git push origin --delete
@bricss
bricss / .eslintrc.js
Last active June 6, 2023 19:00
ESLint config: Ultra refined + TypeScript recomm
// npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint eslint-config-ultra-refined typescript --save-dev
module.exports = {
extends: ['ultra-refined'],
overrides: [
{
extends: [
'ultra-refined',
'plugin:@typescript-eslint/recommended',
],
files: [
@bricss
bricss / git-drain.sh
Last active February 17, 2023 17:20
Ignores active Git repo change(s)
#!/usr/bin/env bash
# Ignores active change(s) in Git repo
# Mostly useful within CICD pipelines
# Usage: `sh git-drain.sh`
git status --porcelain | cut -c4- | xargs -n1 git update-index --assume-unchanged
@bricss
bricss / iso-8601-rex.mjs
Last active February 4, 2023 00:35
RegExp for ISO 8601 date string validation
export const isoDateRex = /^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/;
@bricss
bricss / fixment.sh
Last active July 21, 2023 17:20
Podman permissions fixment
#!/usr/bin/env bash
# In case of "creating events dirs: mkdir /run/user/1000/libpod: permission denied"
sudo rm -rf ${HOME}/.local/share/containers