bookmark_borderQuantum Computing And Primes

Attempt to study and detect an undiscovered primes pattern!


GitHub repo for notes:
https://github.com/khaledalam/QuantumComputingAndPrimesAndOthers


Graphically

  1. pattern families:
    1. Grids
      1. [N x N] (0,0) top left : (n-1,n-1) bottom right 2×2 : 200×200
    2. Linear
      1. 2 to up N |/__ (2 up to 10000000)
      2. ..





Break 2048-bit RSA encryption in 8 hours

Quantum computer

bookmark_borderUsing Pipelines to Invalidate AWS CloudFront Cache that Pointing to AWS S3 bucket

Steps:

  • Add Repository Variables for Distribution IDs
  • Add Repository Variables for AWS keys as well
  • Add invalidate step in your pipeline
    e.g.
- step:
          name: ">> Invalidate AWS CloudFront (by: Khaled alam)"
          script:
          - pipe: atlassian/aws-cloudfront-invalidate:0.4.1
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              DISTRIBUTION_ID: $TEST_CLOUDFRONT_DISTRIBUTION_ID
              # PATHS: <string> # Optional
              DEBUG: "true" # Optional

Note: in case you want to invalidate specific files or paths, you should define that in PATHS: <string>

bookmark_borderConfirm AWS Elastic Beanstalk Deployment Progress

Amazon Web Services Elastic Beanstalk

Use case:
You are using Amazon Web Service(AWS) Elastic Beanstalk to handle your deployment process via some git version control pipelines and there is a step that needs to run after your code has been deployed successfully.

There are a lot of solutions that can be used e.g CloudWatch, Lambda Function,.. etc. but I decided to invent my own solution that is easy, interesting and will cost 0$ :))



Idea:
Use a unique value on pipeline level (e.g pipeline build number) and add it to new code before upload it to server then call some endpoint or file to check this value. while this value does not equal out the new unique value in the pipeline then the deployment not finished yet and we should wait!


How to add new value to new code?
– we will create special endpoint or file in our project
– in the pipeline before upload new code to server change value of this file eg. deploy_version.txt or endpoint {api_link}/current_version
e.g: set some variable value with a new unique value. (you can do that using e.g sed Unix-like command)

ex.

we have a static endpoint that returns JSON result with the value of currentVersion variable that placed in e.g `version.js`

const currentVersion='123';

in the pipeline before upload code step:
- sed -i 2"s/currentVersion='123'/currentVersion='$BITBUCKET_BUILD_NUMBER'/g" src/version.js


How to validate deployment progress?

create a bash script that will send curl request to that endpoint to validate if current version from the endpoint(currently deployed code) is equal to new unique pipeline value or not.

how can this bash script look like? email me for more details(khaledalam.net@gmail.com)


bookmark_borderThis is my hard drive

Sometimes some people ask me questions that maybe kids can know the answer to and I respond with I forget or idk!

Sometimes I forget people, names, how to go to places that I already went to before, situations, information, stories, speeches, etc..

I just want to point to something related to that topic:

This is my hard drive and I used to put things that are useful really useful.  

I don’t fill my head with rubbish, from time to time I clean up my head from any shit speech, stories, memories, poor talks or information always throw them to the void.

For the information that may be useful later, always save them externally on digital drives to make your head fresh and clean as much as you can!

As we technically use /dev/null device to avoid saving the three data streams, try to define a special device for your brain too. 

That will make a big difference!

What My Brain Looks Like When It Solves a Math Problem

P.S. There are methods that help to manage and enhance your brain performance and memorization (e.g method of loci) and I believe in the future(~20 years) the ability to manage brain will be possible digitally! and we already start hear about that (e.g Neuralink)

bookmark_borderCool Profile Pic Doc

CoolProfilePic app helps users to change their social media profile pictures automatically based on settings that they will choose such as new photo category and the changing frequency!

Using:

Docker(-compose), DigitalOcean, AWS, Jinja, Linux, Crons, Flask, RabbitMQ, PHP, Python, Node, MySQL, Express, MongoDB, SQL, Social media APIs, Flask_Dance, PDO, TwitterAPI, GitHubAPI, NPM, PhpMyAdmin, Composer, Guzzle, Sockets, PIL

Demo (the queuing cycle)

Watch Demo (the whole app) => youtube video

Architecture


Email me for the source code: khaledalam.net@gmail.com

Reflection

The idea of automate changing facebook, twitter github, etc.. profile picture came to my mind few days ago, I decided to build this self project from A to Z using some new strategy and stack as a proof of concept of some things that I want to proof personally by myself.

Solved Challenges

  • Connections between containers issues
  • Deadlock issues
  • Sockets issues
  • Caching common dependencies

Current demo is version 1 of the app

Version 2 Tweeks:

  • use multi workers, publisher, queues, taskers
  • mapping DB queries by its types and priority
  • improve containerization performance
  • design IP blocker microservice
  • design mailer microservice
  • handle higher traffic and load
  • automate the deployment process and increase its speed
  • advertise (image processing -> add watermark @CoolProfilePic text on new images)

Random sketches

bookmark_borderIdeal City

Cloud system micro-serviced using Docker, Python, Golang, Node, Flask, Gin, Express.js, MongoDB

Reflection

Show cheaper products of a target city comparing to your city!

=> City Searcher API Microservice Repo

Run
sh run.sh

output

live demo: http://khaledalam.net:8001


Architecture

GitHub: https://github.com/khaledalam/ideal-city

bookmark_borderAliases Manager

Hi everyone!
I just released the first version of my new tool
(Aliases Manager a GUI app using #Python and #Tkinter)

project on #GitHub : https://lnkd.in/dynSGDm

feel free to give the tool a try and a star if you liked it.

#gui#python3#pip#docker#git#files#string#manipulation#linux#unix#mac#windows#bash#treeview#tk#tcl#geometry#terminal#terminals#kernal#cmd#sh#scripting

bookmark_borderAllocate memory to work as swap space on VMs

When physical RAM is already in use, VM instances use swap space as a short-term replacement for physical RAM.

Contents of RAM that aren’t in active use or that aren’t needed as urgently as other data or instructions can be temporarily paged to a swap file. This frees up RAM for more immediate use.

Resolution

Calculate the swap space size

As a general rule, calculate swap space according to the following:

Amount of physical RAMRecommended swap space
2 GB of RAM or less2x the amount of RAM but never less than 32 MB
More than 2 GB of RAM but less than 32 GB4 GB + (RAM – 2 GB)
32 GB of RAM or more1x the amount of RAM
Note: Swap space should never be less than 32 MB.

In this example dd command, the swap file is 4 GB (128 MB x 32):  

$ sudo dd if=/dev/zero of=/swapfile bs=128M count=32

2.    Update the read and write permissions for the swap file:

$ sudo chmod 600 /swapfile

3.    Set up a Linux swap area:

$ sudo mkswap /swapfile

4.    Make the swap file available for immediate use by adding the swap file to swap space:  

$ sudo swapon /swapfile

5.    Verify that the procedure was successful:

$ sudo swapon -s

6.    Enable the swap file at boot time by editing the /etc/fstab file.

Open the file in the editor:

$ sudo nano /etc/fstab

Add the following new line at the end of the file, save the file, and then exit:

/swapfile swap swap defaults 0 0

Done )

run $ htop and check swp [ ] section.

bookmark_borderAwesome Docker WordPress

Simple and easy containerized WordPress website with docker-compose.

Components used:

  • [image] wordpress:latest
  • [image] mysql:5.7
  • [image] phpmyadmin/phpmyadmin
  • docker
  • docker-compose
  • wget, curl, tar, mysqladmin

Usage

  • $ git clone
  • $ cd awecome-docker-wordpress
  • make sure ports in docker-compose file are opened and not in used
  • make sure no running containers using same ports. delete all containers: $ docker rm $(docker -aq) -f
  • $ sudo ./build.sh
  • Naviagate to:
    website: localhost or 127.0.0.1
    PMA: localhost:5000 or 127.0.0.1:5000

Notes: if you want to use your existing WordPress files remove or comment <<< Download latest wordpress section in build.sh file and put your files in app folder!


GitHub: https://github.com/khaledalam/awesome-docker-wordpress

bookmark_borderTweet Products

Auto tweet about your e-commerce products with content, hashtags and links using python and docker.

(c) ManyDatasets.com

code on github => https://lnkd.in/e4FFUus

Usage

  • create twitter app and change api keys
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET")
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET")
  • install docker or docker.io
  • create docker image docker build -t manydatasets_twitter .
  • run docker conatiner: docker run -d --name manydatasets_twitter manydatasets_twitter

#marketing #twitter #tweet #ecommerce #products #product #docker #python #bs4 #pandas #wp #wordpress #shopify #magento #manydatasets