Skip to content

Instantly share code, notes, and snippets.

View borissov's full-sized avatar
🛰️
Occupy Mars.

Radoslav Borissov borissov

🛰️
Occupy Mars.
View GitHub Profile
@borissov
borissov / mvcc.js
Created March 9, 2024 19:40
Simple MVCC Example
class MVCCDatabase {
constructor() {
this.data = {};
this.versions = {};
}
async read(key, transactionId) {
// Simulate read operation with MVCC
if (this.versions[key]) {
const version = this.versions[key].find(v => v.transactionId <= transactionId);
@borissov
borissov / bluetooth.md
Last active February 18, 2024 11:50
Bluetooth on old subwoofer

PARTS LIST:

Bluetooth Audio Receiver [XY-BT-Min]

The Bluetooth Audio Receiver is a versatile device designed to facilitate wireless audio streaming from various compatible devices such as smartphones, tablets, and laptops. By leveraging Bluetooth technology, it enables seamless connectivity and high-quality audio transmission, eliminating the need for cumbersome cables. This receiver is perfect for upgrading conventional wired audio systems to modern wireless setups, offering enhanced convenience and flexibility in audio configurations.

DC-DC Power Module [B0505S-1W]

The B0505S-1W 5V to 5V Converter DC-DC Power Module is a specialized power conversion solution featuring ground noise isolation capabilities. It efficiently converts a 5V input voltage to a stable 5V output while effectively isolating ground noises, ensuring clean and reliable power delivery. This module is particularly valuable in applications where noise interference can degrade system performance, such as audio equipment, sensit

@borissov
borissov / trash.hosts
Last active September 2, 2023 05:55
Аn easy way to block gambling websites. Feel free to add.
127.0.0.1 inbet.com
127.0.0.1 8888.bg
127.0.0.1 palmsbet.com
127.0.0.1 sesame.bg
127.0.0.1 winbet.bg
127.0.0.1 bet365.com
127.0.0.1 efbet.com
127.0.0.1 bwin.com
127.0.0.1 betway.bg
127.0.0.1 betmarketland.bg
@borissov
borissov / vim_convert_php_array.vim
Last active January 8, 2020 11:01
Hot key to convert PHP Array to short syntax ([]) exclude build-in functions and work with multiple lines arrays
autocmd FileType php,phtml nmap <buffer><F6> /\%\([a-zA-Z0-9_]\)\@<!\(array\)\( \)*\((\)<CR>ma%r]`adwr[
autocmd FileType php,phtml imap <buffer><F6> <Esc><F6>i
if(window.location.host === 'www.imot.bg'){
document.querySelector('a.next').style.width = '30%';
document.querySelector('a.prev').style.width = '30%';
console.log('cjs working');
}
//Remove transperent wrapper in instagram and force to HQ images.
if(window.location.host === 'www.instagram.com'){
document.addEventListener('click', function(element){
@borissov
borissov / bootable_linux_usb.sh
Last active July 19, 2020 09:08
Always forget the commands for creating bootable USB..Burn Linux ISO to USB drive.
#!/bin/bash
sudo fdisk -l
sudo dd bs=4M if=/path/to/iso of=/dev/sdX status=progress && sync
#osx
diskutil list
sudo dd bs=4m if=/path/to/iso of=/dev/sdX && sync
@borissov
borissov / opener_for_pgcli_mycli.sh
Created March 6, 2019 07:11
Wrapper to open ".env" files with MyCLI or PgCLI. Search in parent directories.
#!/bin/bash
function dbe() {
local slashes=${PWD//[^\/]/}
local directory="$PWD"
for (( n=${#slashes}; n>0; --n ))
do
if [ -f "$directory/.env" ]; then
echo -e "Load file:\\033[0;31m$(readlink -f -- "$directory/.env") \\033[0m"
while read p; do
@borissov
borissov / svn_to_git.sh
Last active February 15, 2019 09:50
Migrate form SVN to GIT and keep old and ignored files.
#!/bin/bash
# Most important part is to create proper .gitignore file.
git init
git remote add origin NEW_GIT_REPO
git fetch --all
git reset --hard origin/master
git status
rm -rf .svn
@borissov
borissov / VIM_url_handler.md
Last active October 21, 2020 14:29
URL protocol handler for gVim in Ubuntu 18.04 LTS (Bionic Beaver)

There was a way to register URL protocol handler for "vim:" in Ubuntu 18.04 LTS to call gVim.

You can create urls from type: "vim:local_file?line_number" for exapmple: "vim:~/.vimrc?5" will open .vimrc and focus on line 5.

First create file "/usr/share/applications/rvim.desktop".

Append in "/usr/share/applications/defaults.list":

x-scheme-handler/vim=rvim.desktop
@borissov
borissov / pregzip_assets_laravel5.md
Created August 6, 2018 15:29
Gzip assets in Laravel 5

First Install gzip Webpack plugin

npm i -D compression-webpack-plugin

In webpack.mix.js add plugin configuration:

const CompressionPlugin = require("compression-webpack-plugin")