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! <me@blek.codes>
#
# 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:

me@blek.codes
me@some.regional.mail.at.blek.codes
@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 / README.md
Last active December 4, 2022 13:55
blek! Announcement (python)

blek! Announcement

This is an announcement functionality that is used by most of blek! programs, and shouldn't be used anywhere else.

Basically, this is needed so that i could've easily add this to my programs. If you are not me, i dont think you could find this of any use except if you use it to make announcements for your project