Skip to content

Instantly share code, notes, and snippets.

View Banhawy's full-sized avatar
🏠
Working from home

Adham El Banhawy Banhawy

🏠
Working from home
View GitHub Profile
@Banhawy
Banhawy / list-containers-horizontally
Created February 1, 2019 14:37
[Horizontal Docker Display] #docker
# This can be in .zshrc or .bash_profile
export FORMAT="\nID\t{{.ID}}\nIMAGE\t{{.Image}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.RunningFor}}\nSTATUS\t{{.Status}}\nPORTS\t{{.Ports}}\nNAMES\t{{.Names}}\n"
docker ps --format $FORMAT
@Banhawy
Banhawy / run-in-background
Created February 1, 2019 15:17
[Run proccess in background] #linux #node
# Will return the process id
nohup any_command &
@Banhawy
Banhawy / ipconfig
Created February 2, 2019 15:25
[Find IP address of current machine] #linux
# Detailed view
ipconfig
# Filter the results
ipconfig | grep inet
@Banhawy
Banhawy / df
Created February 2, 2019 15:28
[List disk storage info] #Linux
# Prints out a list of storage drives with their sizes, usage, and locations
df -ah
@Banhawy
Banhawy / disk-usage
Created February 2, 2019 15:33
[Check a folder size] #linux
du -sh folder_name
@Banhawy
Banhawy / aync-with-s3
Last active May 1, 2019 08:58
[Sync folder with S3 bucket] #aws
# Reference: https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
aws s3 sync SOURCE_DIR s3://DEST_BUCKET/
@Banhawy
Banhawy / s3-policy
Created February 6, 2019 14:40
[Enable CORS on S3 Bucket] #aws #s3
# Go to the s3 bucket's Permissions -> CORS configurations and add the following policy
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
@Banhawy
Banhawy / create-user
Created February 6, 2019 16:15
[Signup A Cognito User Using CLI] #aws #cognito #aws-cli
# https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/sign-up.html
aws cognito-idp sign-up \
--region YOUR_COGNITO_REGION \
--client-id YOUR_COGNITO_APP_CLIENT_ID \
--username [email protected] \
--password Passw0rd!
--user-attribute Name=string,Value=string
@Banhawy
Banhawy / Grep-Admin-Url
Created February 16, 2019 00:01
[Find Magento Admin url] #magento
cat path/tp/docroot/app/etc/env.php | grep "frontName"
@Banhawy
Banhawy / design_config_form.xml
Last active February 18, 2019 22:09
[Magento Image Uploader Fix] #magento
# Refrences:
# https://community.magento.com/t5/Magento-2-x-Technical-Issues/A-technical-problem-with-the-server-created-an-error-Try-again/td-p/114492/page/3
# https://github.com/magento/magento2/issues/16531
# Change "fileUploader" to "imageUploader" in the "formElement" attribute on lines 57, 154 in vendor/magento/module-theme/view/adminhtml/ui_component/design_config_form.xml
# line 57
<field name="head_shortcut_icon" formElement="imageUploader">
# line 154