Skip to content

Instantly share code, notes, and snippets.

View b1ek's full-sized avatar
👋
Coding

blek! b1ek

👋
Coding
View GitHub Profile
@b1ek
b1ek / reverse_array.py
Created January 15, 2022 16:16
reverse python array
def reverse_array(array: list) -> list:
out = [];
i = len(array) - 1;
while (1):
out.append(array[i]);
if (i == 0): return out;
i -= 1;
@b1ek
b1ek / brainf.md
Last active August 7, 2023 22:24
Brainfuck compiler

Brainfuck compiler

Pretty much the title. Array length is not limited to 30000 anymore, it is calculated on the compile time.
It passed all the tests

Input file: file.txt
Out file: out.c

It is compiled to c code

program.c

@b1ek
b1ek / Email Regex.md
Last active August 17, 2022 09:53
Email Regex
^[a-zA-Z0-9._]+@\w+(\.\w{2,}){1,}$
@b1ek
b1ek / string_enc.md
Last active September 5, 2022 00:29
C string encryption

To edit the string, change it in the variable in the file at line 3.

import random as r, time as t

STRING = 'ur gay';
offset = r.randint(0, 10000);
encryptS = list();
c = 0;
@b1ek
b1ek / README.md
Created September 17, 2022 13:13
Carmichael function python
from math import gcd
def carmi(n):
    copr = [x for x in range(1, n) if gcd(x, n) == 1]
    k = 1
    while not all(pow(x, k, n) == 1 for x in copr):
        k += 1
    return k

If you get an import error on line 1, change math to fractions and see how it works

@b1ek
b1ek / README.md
Created September 17, 2022 15:09
Python ssl

Please DON'T use this.

This is just a toy project i wrote for fun.
You can use this for studiyng RSA, but if you want proper RSA encryption in your project, use a cryptography library.

from math import gcd

def prime(x):
    count = 0
    for i in range(int(x/2)):
        if x % (i+1) == 0:
@b1ek
b1ek / enc.py
Last active December 1, 2022 11:10
Python C string encryption
import random as r, time as t
STRING = 'You are gay\n';
offset = r.randint(0, 10000);
encryptS = list();
c = 0;
def rands(sz): return ''.join(r.choices(list('abcdef1234567890'), k=sz));
for i in STRING:
@b1ek
b1ek / array_to_table.php
Created October 24, 2022 08:21
PHP array to table
<?php
function arr2table($array, $headers = true) {
$buffer = '<table><tbody><tr>' . ($headers ? '<td>Index</td>' : '');
foreach($array as $i => $val) {
$buffer .= "<td>$i</td>";
}
$buffer .= '</tr>' . ($headers ? '<td>Value</td>' : '');
foreach($array as $i => $val) {
$buffer .= '<td>' . print_r($val, true) . '</td>';
}
@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."
@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