Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@MohamedElashri
MohamedElashri / explain.md
Created May 29, 2021 15:02
How do I clear/delete the current line in terminal? #terminal #bash

You can use Ctrl+U to clear up to the beginning.

You can use Ctrl+W to delete just a word.

You can also use Ctrl+C to cancel.

If you want to keep the history, you can use Alt+Shift+# to make it a comment.

@MohamedElashri
MohamedElashri / tensorflow-metal.md
Created June 9, 2021 01:55
tensorflow-metal on M1 #mac

tensorflow-metal

Accelerate training of machine learning models with TensorFlow right on your Mac. Install TensorFlow v2.5 and the tensorflow-metal PluggableDevice to accelerate training with Metal on Mac GPUs.

You can learn more about TensorFlow PluggableDevices here

OS Requirements

macOS 12.0+

Currently Not Supported

@MohamedElashri
MohamedElashri / Dokcer_Installer.md
Last active June 20, 2021 16:31
Linux_Server install script

Usage

install once

sudo curl -sL https://git.io/Jnoe4 -o /usr/local/bin/linux_install.sh
sudo chmod ugo+x /usr/local/bin/linux_install.sh

run many times

@MohamedElashri
MohamedElashri / remove-google-tracking.user.js
Created August 16, 2021 05:21
Remove Google's link tracking and disable click-tracking
// ==UserScript==
// @name Remove Google's link tracking
// @description Removes onmousedown event from external Google links to allow direct links and disable click-tracking
// @namespace https://melashri.net
// @author Mohamed Elashri
// @include http://*.google.*
// @include https://*.google.*
// @include *://*.google.tld/*
// @version 0.0.1
// @grant unsafeWindow
@MohamedElashri
MohamedElashri / colab2pdf.md
Created August 27, 2021 14:58
This is documentation on how to convert jupyter notebook to pdf

Install the necessary packages into the virtual machine with:

!apt-get install texlive texlive-xetex texlive-latex-extra pandoc
!pip install pypandoc

Mount your google drive to get access to your ipynb files

@MohamedElashri
MohamedElashri / portscan.sh
Created November 3, 2021 18:18
protect against port scanning using firewall script
#!/bin/bash
SCRIPTNAME="Portscan Protection"
VERSION="v1.0"
SCRIPTLOCATION="/usr/local/sbin/portscan-protection.sh"
WHITELISTLOCATION="/usr/local/sbin/portscan-protection-white.list"
CRONLOCATION="/etc/cron.d/portscan-protection"
GITHUBRAW="https://gist.githubusercontent.com/MohamedElashri/ec469f43bd2cb71743dafab5203ac533/raw/139ecdea79ad206d99a9871a0d550d08a6a5c509/portscan.sh"
AUTOUPDATE="YES"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@MohamedElashri
MohamedElashri / openpgp.md
Last active November 19, 2021 23:48
openpgp.md
@MohamedElashri
MohamedElashri / doc.md
Last active November 22, 2021 22:04
Get a list of python modules and create a requirements.txt file

To get a list of python modules available, a solution is to use freeze:

pip freeze

To create a requirements.txt file from freeze:

pip freeze > requirements.txt
@MohamedElashri
MohamedElashri / keybase.md
Created November 27, 2021 00:31
keybase.md

Keybase proof

I hereby claim:

  • I am mohamedelashri on github.
  • I am melashri (https://keybase.io/melashri) on keybase.
  • I have a public key ASAeVmLjfSEgsS1xaKAlQxY7C0uI-e7lPTRR5ed4g_qaawo

To claim this, I am signing this object:

@MohamedElashri
MohamedElashri / hn.js
Created December 10, 2021 16:00
HN Enhancments
// ==UserScript==
// @name Hacker News
// @namespace melashri.net
// @version 0.6 (by Mohamed Elashri)
// @description Enhanced HN, unread comments highlighter. Open links in new page
// @author Prahlad Yeri, Mohamed Elashri
// @match https://news.ycombinator.com/*
// @grant GM_addStyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==