Skip to content

Instantly share code, notes, and snippets.

View minamaged113's full-sized avatar
๐Ÿƒ
Improving...

Mina Gabriel minamaged113

๐Ÿƒ
Improving...
View GitHub Profile
@minamaged113
minamaged113 / createPython3Venv.sh
Created June 22, 2019 20:55
Create a Python virtual environment using ยดvenvยด internal tool shipped with python.
#!/bin/bash
python3 -m venv venv
source venv/bin/activate
@minamaged113
minamaged113 / pip-freeze-fix.sh
Created October 17, 2019 15:36
pip freeze ubuntu alias
#!/bin/zsh
cat <<EOT >> ~/.zshrc
alias freeze-packages="pip freeze | sed '/pkg-resources==0.0.0/d'"
EOT
. ~/.zshrc
export FORMAT="\nID\t{{.ID}}\nIMAGE\t{{.Image}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.RunningFor}}\nSTATUS\t{{.Status}}\nPORTS\t{{.Ports}}\nNAMES\t{{.Names}}\n"
# this shell will only work on bash
#!/usr/bin/env bash
PARAMS=""
# Check if git repo
if ! git rev-parse --git-dir > /dev/null; then
exit 1
fi;
while (( "$#" )); do
case "$1" in
-v|--verbose)
VERBOSE=1
" = VIM configuration example
" =============================================================================
" == Information
" Author: Mina Ghobrial | https://github.com/minamaged113
" Should be stored in ~/.vimrc
" To download vim, check https://www.vim.org/download.php
" On ubuntu: apt-get install vim
" =============================================================================
@minamaged113
minamaged113 / git+clone+ssh+agent+forward+sudo
Created October 26, 2020 17:25 — forked from scottjacobsen/git+clone+ssh+agent+forward+sudo
Git clone using ssh agent forwarding and sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
@minamaged113
minamaged113 / commit-msg
Created February 11, 2021 20:23
git hook to edit commit message
#!/bin/bash
# git hook to add ticket number from branch name
# branch names should have the following naming
# convention for this to work:
# <type>/<ticket-handle-without-hashes>-<ticket-title>
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
COMMIT_MSG=$(cat "$1")
TICKET_NO_FROM_BRANCH_NAME=$(echo $BRANCH_NAME | cut -d "/" -f 2 | cut -d "-" -f 1)
@minamaged113
minamaged113 / pcolor.sh
Created July 12, 2021 08:25
simple bash function for displaying multicolor output.
function pcolor() {
red=$'\e[1;31m'
grn=$'\e[1;32m'
yel=$'\e[1;33m'
blu=$'\e[1;34m'
mag=$'\e[1;35m'
cyn=$'\e[1;36m'
end=$'\e[0m'
printf "${!1}%-6s\n${end}" "$2"
@minamaged113
minamaged113 / docker-ps-vertical
Created September 22, 2021 15:57 — forked from wzulfikar/docker-ps-vertical
vertical format for docker ps
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"
// usage:
docker ps --format="$FORMAT"
@minamaged113
minamaged113 / x11frwrdngscrpt.sh
Last active April 13, 2023 08:46
A script to set DISPLAY variable when connecting using ssh to ubuntu to allow opening GUI applications from remote console.
#!/usr/bin/env bash
# Add this to your `~/.$(echo $0 | tr -d "-")rc` file to run it for
# every shell instance
#####################################################################
# Add one of the following options to forward the displace from WSL
# outside
#####################################################################
# Option 1 @ port 0