Skip to content

Instantly share code, notes, and snippets.

View elsheikh21's full-sized avatar
🎯

Ahmed ElSheikh elsheikh21

🎯
View GitHub Profile
  1. Create a git repo locally, default branch_name:main or master based on the convention you are following>

git init -b <branch_name>

  1. add all files to local git repo

git add --all

  1. commiting the files

git commit -m

  1. your remote repo URL

git remote add origin <REMOTE_URL>

  1. verify the added remote > git remote -v
import subprocess
from prettytable import PrettyTable
import logging
def print_profiles():
# Define the File handler to print to a file
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('networks_passwords.txt')
@elsheikh21
elsheikh21 / pull_keep_local_changes
Created January 18, 2022 14:25
Pull whilst keeping local changes
# save (stash) local changes
git stash save
# execute the `git pull` command
git pull
# fetch your stashed changes
git stash pop
@elsheikh21
elsheikh21 / migrate_repo_from_vsc
Last active December 30, 2021 10:45
Migrate repositories from a VCS to another
# clone repo to your device, and change directory to it
$ git clone --mirror <Bitbucket_repo_address>
$ cd <repo_folder>
# Remove current origin from vcs you want to migrate from
$ git remote rm origin
# Add new origin e.g. new github repo you want to migrate to
$ git remote add origin <GitHub_repo_address>
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras import backend as K
class BertEmbeddingLayer(tf.keras.layers.Layer):
'''
Integrate BERT Embeddings from tensorflow hub into a
custom Keras layer.
references:
@elsheikh21
elsheikh21 / model_bert_embeddings.py
Last active October 28, 2019 17:29
to fix the integration of bert embeddings layer with my mdoel
import os
import yaml
import numpy as np
from argparse import ArgumentParser
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras.layers import (LSTM, Softmax, Add, Bidirectional, Dense, Input, TimeDistributed, Embedding)
from tensorflow.keras.preprocessing.sequence import pad_sequences
def is_prime(num):
for i in range(2, num):
if num % i == 0:
return True
return False
print(is_prime(5))
print(is_prime(15))
@elsheikh21
elsheikh21 / filter.py
Created October 23, 2019 23:03
filter odd & even from a given a list, and return a list of 2 lists
def filter(array):
odd_numbers, even_numbers = [], []
for num in array:
if num % 2 == 0:
even_numbers.append(num)
else:
odd_numbers.append(num)
return [even_numbers, odd_numbers]
def bubble_sort(array):
for num in range(len(array) - 1, 0, -1):
for i in range(num):
if array[i] > array[i + 1]:
array[i], array[i + 1] = array[i + 1], array[i]
array = [4, 1, 8, 5, 10, 3, 9]
bubble_sort(array)
print(array)
@elsheikh21
elsheikh21 / html_loader.html
Created October 16, 2019 13:17
simple loader for your html pages
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />