Skip to content

Instantly share code, notes, and snippets.

View a-magdy's full-sized avatar

Ahmed Magdy a-magdy

  • Copenhagen, Denmark
View GitHub Profile
a-magdy /
Last active November 13, 2023 14:01
export vars from .env file
# Use grep to validate each line using regex (clears out comments, empty lines and validates that each line is in the format of env vars)
# Then send it out to sed, to append export at the beginning of each line and ; at the end
# Then eval all
eval "$(grep -E '^[A-Za-z_][A-Za-z0-9_]*=.*' '.env' | sed 's/.*/export &;/')"
# Archive
a-magdy /
Last active August 30, 2023 21:13
Get node latest version for a major release
# $1 => major release version (e.g. 6, 7)
dotnet_get_latest_version() {
if [[ -n "$1" ]] ; then
# Get latest by major version using jq
curl -s | jq -r '.[].tag_name | select(. | startswith("v'"${1:-7}"'."))' | head -n 1 | sed 's/v//g'
a-magdy /
Last active August 23, 2023 12:31
Change commits author
function unique_list_of_committers() {
git log --format="%aN <%aE>" | sort -u
function change_author() {
a-magdy / gh.yaml
Last active July 27, 2023 17:45
GH Actions Log Secrets
- name: Log Secrets & Vars
shell: bash
run: |
echo "echo \"ARM_CLIENT_ID ($ARM_CLIENT_ID): \$(decode '$(echo ${ARM_CLIENT_ID} | base64)')\""
echo "echo \"ARM_CLIENT_SECRET ($ARM_CLIENT_SECRET): \$(decode '$(echo ${ARM_CLIENT_SECRET} | base64)')\""
echo "echo \"ARM_SUBSCRIPTION_ID ($ARM_SUBSCRIPTION_ID): \$(decode '$(echo ${ARM_SUBSCRIPTION_ID} | base64)')\""
echo "echo \"ARM_TENANT_ID ($ARM_TENANT_ID): \$(decode '$(echo ${ARM_TENANT_ID} | base64)')\""

Keybase proof

I hereby claim:

  • I am a-magdy on github.
  • I am ahmedmagdy ( on keybase.
  • I have a public key ASD8rVIHZD-wHK6OJMXP_Uunm6kuinSzaGFjGdPfRxkAJAo

To claim this, I am signing this object: