Skip to content

Instantly share code, notes, and snippets.

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

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile

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 / 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.

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@mahmoudimus
mahmoudimus / hand-modify-pdf.md
Created September 4, 2023 22:06 — forked from senderle/hand-modify-pdf.md
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Script to draw bounding boxes and text from a Tesseract box file.
The script takes an image TIFF_FILE, draws the text and bounding boxes
of the corresponding BOX_FILE and saves the resulting OUT_FILE.
Tesseract box file columns:
<symbol> <left> <bottom> <right> <top> <page>