Skip to content

Instantly share code, notes, and snippets.

View beeksiwaais's full-sized avatar

Beeksi beeksiwaais

View GitHub Profile
@beeksiwaais
beeksiwaais / mdtransform.pl
Created June 5, 2025 16:54
A perl script to transform markdown to italic and bold in the terminal without buffering
#!/usr/bin/env perl
# Ollama Markdown to Terminal Colors Converter - Perl Version
# Usage: ollama run llama "your prompt" | ./ollama-markdown-colorizer.pl
use strict;
use warnings;
use Term::ReadKey;
# Disable buffering for immediate output
@beeksiwaais
beeksiwaais / fulltextindexer.swift
Last active March 19, 2026 16:23
A script that start a webserver with the specified directory as its root. The script will also index the content of some text files and pdf in a index.webstart file
// MARK: - main.swift
import Foundation
import PDFKit // Import PDFKit for native PDF processing
import Network // Import Network framework for web server capabilities
import AppKit // Import AppKit for GUI elements (NSWindow, NSTextView, NSButton)
import UniformTypeIdentifiers // For UTType and MIME type mapping
// Define a custom error type for better error handling
enum IndexerError: Error, CustomStringConvertible {
@beeksiwaais
beeksiwaais / lua.c
Last active April 4, 2025 10:09
Patched lua.c for php 8.4 (WIP)
/*
+----------------------------------------------------------------------+
| Lua |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
@beeksiwaais
beeksiwaais / libhelper.fish
Created December 28, 2024 11:48
Lib Helper
#!/usr/bin/env fish
function compiler_helper
set results (pkg-config --list-all | fzf -m | awk '{print $1}' | xargs -I{} pkg-config --cflags --libs {} | tr '\n' ' ' | sed 's/ $/\n/')
echo $results
end
# Header function open
function explore_library_headers
set libraries (pkg-config --list-all | fzf -m | awk '{print $1}')
@beeksiwaais
beeksiwaais / gist:a603039431fff474c19d0c608e292216
Last active December 25, 2024 08:31
Functional Category Theory in JavaScript

Functional Category Theory in JavaScript

Category Theory Fundamentals and Implementation

1. Categories

A category C consists of:

  • Objects: Ob(C)
  • Morphisms: ∀A,B ∈ Ob(C), Hom(A,B)
  • Identity: ∀A ∈ Ob(C), idₐ: A → A
@beeksiwaais
beeksiwaais / yt-subscription-toggle-bookmark.js
Created May 25, 2023 00:42
This JavaScript bookmarklet is designed to manipulate the visibility of videos on a YouTube Subscription page. It alternates between three states - 'initial', 'hide-shorts', and 'hide-others'. In the 'initial' state, all videos are visible. In the 'hide-shorts' state, YouTube 'Shorts' videos are hidden, while other videos remain visible. In the …
javascript:(function() {
const hide = e => e.style.display = 'none';
const show = e => e.style.display = 'inline-block';
const states = ['initial', 'hide-shorts', 'hide-others'];
const isHidden = e => e.style.display === 'none';
const allElements = Array.from(document.querySelectorAll("ytd-grid-video-renderer"));
const shorts = allElements.filter(e => e.querySelector("span[aria-label='Shorts']"));
const others = allElements.filter(e => !e.querySelector("span[aria-label='Shorts']"));

Keybase proof

I hereby claim:

  • I am beeksiwaais on github.
  • I am beeksiwaais (https://keybase.io/beeksiwaais) on keybase.
  • I have a public key ASDDylL6Xc1esH213ILP9WdRtWqFwZ_qgOWCHWp10LFZdAo

To claim this, I am signing this object:

@beeksiwaais
beeksiwaais / mysql2_column_cache.rb
Created April 23, 2012 14:07 — forked from raggi/mysql2_column_cache.rb
Mysql2 Column Cache for Rails 3.0.12
# = MONKEY PATCH: Memoize Mysql2 Columns
#
# Reduces SHOW FIELDS selects in production to essentially 0 calls.
#
# == Reason:
#
# * We have some pages that are (with rails 3.0.12) generating nearly 1200 SHOW
# FIELDS sql statements.
# * These come from ActiveRecord::Associations during complex join semantics.
# * Esentially, through some relations, Arel::Table instances don't have
@beeksiwaais
beeksiwaais / dock-space-display.txt
Created December 22, 2010 23:54
Ajouter des espaces à son Dock sur Mac OS
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock