Skip to content

Instantly share code, notes, and snippets.

View mahmoudimus's full-sized avatar
💭
@_@

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile
@mahmoudimus
mahmoudimus / text_nontext_separation.py
Last active April 7, 2024 04:00
A stupidly simple approach for text non-text separation for printed document images.
import argparse
import os
import torch
import pandas as pd
from PIL import Image
def LTPN_rotation_cal(mat, th):
"""
@mahmoudimus
mahmoudimus / llvm17_clang17.sh
Last active April 1, 2024 14:12
dockerfile to build tensorflow from source
function install() {
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 17
locate clang-17
clang-17 --version
}
function uninstall() {
sudo rm /etc/apt/sources.list.d/archive_uri-http_apt_llvm_org_*.list

TensorRT + Ubuntu 22.04 (on WSL2)

I revolced the following warnings related to libnvinfer.so.7 and libnvinfer_plugin.so.7

W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: xxxxx
W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: xxxxx
W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
@mahmoudimus
mahmoudimus / cuda-install-wsl2.sh
Created April 1, 2024 00:30 — forked from neggles/cuda-install-wsl2.sh
WSL2 ubuntu 22.04 CUDA setup
#!/usr/bin/env bash
set -euo pipefail
# please don't run this script as an actual script. it's not remotely error checked. paste command blocks in one by one
# and make sure the output looks vaguely sane.
# remove this once you've read below!
echo "You didn't actually read the instructions, did you?"; exit 1
# first up, `sudo nano /etc/wsl.conf` and add this:
[boot]
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
@mahmoudimus
mahmoudimus / .zshrc
Created March 24, 2024 15:43 — forked from matfax/.zshrc
Sudo authentication with Windows 1Password CLI on Ubuntu WSL
# ....
alias sudo="sudo -A"
@mahmoudimus
mahmoudimus / build-emacs.sh
Last active March 24, 2024 14:45 — forked from 3tty0n/build-emacs.sh
Build emacs on Ubuntu 22.04
#!/bin/sh
# Explore:
# https://github.com/howardabrams/hamacs/blob/main/README-Linux.org
# https://batsov.com/articles/2021/12/19/building-emacs-from-source-with-pgtk/
# https://practical.li/blog/build-emacs-from-source-on-debian-linux/
# https://github.com/konstare/emacs-gcc-pgtk/blob/master/Dockerfile
# First determine your gcc version with gcc --version,
# then modify libgccjit-12-dev below to the major version number you have!
@mahmoudimus
mahmoudimus / Build Emacs for Windows 64bit with Native Compilation.md
Created March 24, 2024 14:22 — forked from nauhygon/Build Emacs for Windows 64bit with Native Compilation.md
Step-by-step instructions to build Emacs for Windows 64 bit with MSYS2 and MinGW-w64. Now `native-comp` supported.

Build Emacs-w64 with MSYS2/MinGW-w64 with Native Compilation

Instructions are modified from emacs-w64 Wiki page by zklhp. Many thanks for sharing!

  1. Download the latest MSYS2 from this download page.

  2. Install MSYS2 to, for example, C:\msys2 (make sure no space in path to avoid unwanted problems).

  3. Optionally prettify the MSYS2 console mintty with ~/.minttyrc to make it more pleasing to eyes. Thanks to this awesome theme!

@mahmoudimus
mahmoudimus / idea-gcg1.vmoptions
Last active February 19, 2024 15:23
A running timeline of my IntelliJ on Steroids with GC tuning
-ea
-server
-Xss256k
-Xms4G
-Xmx4G
-XX:+IgnoreUnrecognizedVMOptions
-XX:+UnlockExperimentalVMOptions
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:-UseSerialGC
@mahmoudimus
mahmoudimus / ddrescue.md
Created November 24, 2023 04:22 — forked from cetinajero/ddrescue.md
Guide to Using DDRescue to Recover Data

Guide to Using DDRescue to Recover Data

Start command:

ddrescue -d /dev/sda output.img output.mapfile

NOTE: If direct disc access is not available in your system, try raw devices.