Skip to content

Instantly share code, notes, and snippets.

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

Mahmoud Rusty Abdelkader mahmoudimus

💭
@_@
View GitHub Profile
@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 / Microsoft.PowerShell_profile.ps1
Last active September 23, 2023 16:36
M$ Windowz Powershell mapping
# Inspirations from:
# - https://github.com/tex2e/blog/blob/master/_posts/powershell/2021-01-11-open.md?plain=1
# - https://github.com/PowerShell/Community-Blog/blob/main/Posts/2022/07/cheat-sheet-console-experience.md?plain=1
# Other PowerShell profiles
# - https://github.com/mikemaccana/powershell-profile/blob/master/defaults.ps1
# - https://github.com/staxmanade/DevMachineSetup/blob/master/initProfile.ps1
# - https://github.com/epoweripione/dotfiles/blob/main/powershell/Microsoft.PowerShell_profile.ps1
# - https://github.com/effs/dotfiles/blob/main/powershell/pwsh7_profile.ps1
# - https://github.com/razy69/Powershell/blob/master/Doc/Machine_Profile.ps1
@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>
@mahmoudimus
mahmoudimus / README.md
Last active May 10, 2023 13:22
Patch to upgrade Kaliel's Tracker to 10.1
@mahmoudimus
mahmoudimus / riscv.md
Created March 2, 2023 05:45 — forked from cb372/riscv.md
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@mahmoudimus
mahmoudimus / java.flags.txt
Created February 25, 2023 18:55 — forked from ornicar/java.flags.txt
java -Xms30g -Xmx30g -XX:+UseG1GC -XX:+PrintCodeCache -XX:NonProfiledCodeHeapSize=512m -XX:NonNMethodCodeHeapSize=32m -XX:ReservedCodeCacheSize=2g -XX:InitialCodeCacheSize=512m -XX:CodeCacheExpansionSize=2m -XX:+PrintFlagsFinal
/opt/jabba/jdk/openjdk@1.17/bin/java -Xms30g -Xmx30g -XX:+UseG1GC -XX:+PrintCodeCache -XX:NonProfiledCodeHeapSize=512m -XX:NonNMethodCodeHeapSize=32m -XX:ReservedCodeCacheSize=2g -XX:InitialCodeCacheSize=512m -XX:CodeCacheExpansionSize=2m -XX:+PrintFlagsFinal
[Global flags]
int ActiveProcessorCount = -1 {product} {default}
uintx AdaptiveSizeDecrementScaleFactor = 4 {product} {default}
uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product} {default}
uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product} {default}
uintx AdaptiveSizePolicyInitializingSteps = 20 {product} {default}
uintx AdaptiveSizePolicyOutputInterval = 0 {product} {default}
uintx AdaptiveSizePolicyWeight = 10
@mahmoudimus
mahmoudimus / current-export-history-hrefs.js
Last active February 5, 2023 01:22
Exports the history from Google Chrome's syncedTabs in chrome://history/syncedTabs
var tablistcontainer = (document.getElementById("history-app")
.shadowRoot.getElementById("synced-devices")
.shadowRoot.getElementById("synced-device-list"));
/* for sessionbuddy import */
var output = {tabs: []};
/* run through synced device cards *only* */
[].forEach.call(tablistcontainer.children, curNode => {
if (curNode.nodeName !== "HISTORY-SYNCED-DEVICE-CARD") {
return;
@mahmoudimus
mahmoudimus / doit.sh
Last active February 4, 2023 09:02
intellij remote development with nomachine on ec2 ubuntu
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
add-apt-repository -y ppa:webupd8team/java
apt-get -qq update
apt-get install -y oracle-java8-installer xfce4 xvfb
wget http://download.nomachine.com/download/4.6/Linux/nomachine_4.6.4_13_amd64.deb
dpkg -i nomachine_4.6.4_13_amd64.deb
echo 'DefaultDesktopCommand "/usr/bin/X11/startxfce4"' >> /usr/NX/etc/server.cfg
echo "PhysicalDesktopAuthorization 0" >> /usr/NX/etc/server.cfg
echo "VirtualDesktopAuthorization 0" >> /usr/NX/etc/server.cfg
COOKIE=`ps -ef | md5sum | cut -f 1 -d " "`