Skip to content

Instantly share code, notes, and snippets.

View b1ek's full-sized avatar
👋
Coding

blek! b1ek

👋
Coding
View GitHub Profile
@b1ek
b1ek / new-client.sh
Created January 10, 2024 01:42
A CLI tool to create a new ORY Hydra client
#!/bin/zsh
# new-client.sh - CLI tool to create a new client
# Copyright (C) 2024 blek! <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@b1ek
b1ek / index.html
Created January 5, 2024 19:03
my empty html template
<!DOCTYPE html>
<html lang='en_US'>
<head>
<meta charset='utf8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style>
html, body {
font-family: 'Cantarell', 'Open Sans', 'Segoe UI', sans-serif
}
@b1ek
b1ek / README.md
Last active October 13, 2023 14:58
A simple regex for JS minification

Regex for basic JS minification

This is not exactly a full-featured speedy bundler, but it will do the basic minification.

/((?![\"\'])(\/\/.*|(?<=\n) +|^$|\/\*.*\*\/|(?<=[\{\}\(\)\[\]])[\n ]+|[\n ]+(?=[\{\}\(\)\[\]]))(?![\"\'])|(?<=for) (?=\()|(?<=;)(\n| )| (?=[\=\!\(\)\}\{\"\'\`]))/g
(
@b1ek
b1ek / README.md
Last active June 21, 2023 10:50
email regex

Email regex

^[^\.][a-zA-Z0-9!#$%&'*+\-\/=?^_`{|}~\.\"\(\),:;<>@\[\\\]]+@(([^\-][\w\d\-\.]{1,63}\.){1,}\w{1,63}|[^\-][\w\d\-\.]{1,63}|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|([a-f0-9:]+:+)+[a-f0-9]+)$

Matches:

[email protected]
[email protected]
@b1ek
b1ek / russian_phone_regex.md
Last active May 31, 2023 06:59
Russian phone number regex

Russian phone number regex

Regex: /^(\+|)(7|8)( |)\d{3}( |)\d{3}( |)(\d{2}( |)){2}$/
Matches:

  • +799999999
  • 799999999
  • 899999999
  • +899999999
  • +7 99999999
  • +7 999 999 9999
@b1ek
b1ek / bcrypt_regex.txt
Created February 3, 2023 23:22
bcrypt regex
/^\$2(a|b|x|y)\$[0-9]{1,2}\$[a-zA-Z.0-9\/+]{22}={0,2}[A-Za-z0-9+\/.+]{31}={0,2}$/gm
@b1ek
b1ek / README.md
Created January 14, 2023 09:28
Docker desktop installation on arch-based distros

Docker desktop installation on arch-based distros

  1. Install docker (pacman -S docker)
  2. Download package from https://docs.docker.com/desktop/install/archlinux/
  3. Install the package as said in the website
  4. Done

Common issues

  • The app is saying that docker engine is starting, but nothing happens for a long time.

It looks like QEMU is not installed. Try (re)installing it via pacman -S qemu and see if that solved the error

@b1ek
b1ek / rsqrt.c
Created January 11, 2023 17:15
Fast square root in c
// Source: https://en.wikipedia.org/wiki/Fast_inverse_square_root
#include <stdint.h> // uint32_t
float Q_rsqrt(float number)
{
union {
float f;
uint32_t i;
}
conv = { .f = number };
@b1ek
b1ek / php.docker
Created December 3, 2022 14:32
Enable php repository on debian based distros
# code snippet for dockerfiles
# FROM debian:bullseye-slim
RUN \
apt-get install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list && \
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg && \
apt-get update
@b1ek
b1ek / install.sh
Created November 18, 2022 12:12
Install docker desktop on arch
#!/bin/bash
yes "" | sudo pacman -S gnome-terminal qemu
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-4.14.1-x86_64.pkg.tar.zst?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64 -o docker.pkg.tar.zst
yes "" | sudo pacman -U docker.pkg.tar.zst
echo "$USER:100000:65536" >> sudo /etc/subuid
echo "$USER:100000:65536" >> sudo /etc/subgid
systemctl > /dev/null 2&>1
if [ $? -ne 0 ]; then
echo "It seems that you don't use systemd. Start the docker-desktop service manually using your init."