Categories
All

Allocate 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.

Categories
All

Awesome 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

Categories
All

Tweet 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

Categories
All

Intro – Asdam Podcast | مقدمه أسدام بودكاست

Performer & Mix & Master: Khaled Alam

Listen on:
=> YouTube: https://youtu.be/0cRxIJ78YjY
=> Soundcloud: https://soundcloud.com/asdampodcast/intro-asdam-podcast

Main Asdam Podcast Website
Categories
All

Detect Outdated Info in Amazon Blog Website Footer

They updated it recently.

my screencast proof: https://youtu.be/K5ROwjrmwew

Amazon blog: https://blog.aboutamazon.com

Categories
All

How to write hidden text into image

—= EXIF =—
Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for imagessound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. The specification uses the following existing file formats with the addition of specific metadata tags: JPEG discrete cosine transform (DCT)[1] for compressed image files, TIFF Rev. 6.0 (RGB or YCbCr) for uncompressed image files, and RIFF WAV for audio files (Linear PCM or ITU-T G.711 μ-Law PCM for uncompressed audio data, and IMAADPCM for compressed audio data).[2] It is not used in JPEG 2000 or GIF.

This standard consists of the Exif image file specification and the Exif audio file specification.

wikipedia
duck.png

there are many tools, in this post I will use exiftool Linux tool:

$ exiftool duck.png
ExifTool Version Number         : 11.65
 File Name                       : duck.png
 Directory                       : .
 File Size                       : 22 kB
 File Modification Date/Time     : 2020:03:13 05:49:30+02:00
 File Access Date/Time           : 2020:03:13 05:53:21+02:00
 File Inode Change Date/Time     : 2020:03:13 05:49:38+02:00
 File Permissions                : rw-r--r--
 File Type                       : PNG
 File Type Extension             : png
 MIME Type                       : image/png
 Image Width                     : 512
 Image Height                    : 512
 Bit Depth                       : 8
 Color Type                      : RGB with Alpha
 Compression                     : Deflate/Inflate
 Filter                          : Adaptive
 Interlace                       : Noninterlaced
 Significant Bits                : 8 8 8 8
 Image Size                      : 512x512
 Megapixels                      : 0.262

Let’s add some text “secret text for you 😉” into duck.png image metadata.

$ exiftool -Comment="secret text for you ;)" duck.png

Let’s check metadata again:

$ exiftool duck.png
ExifTool Version Number         : 11.65
File Name                       : duck.png
Directory                       : .
File Size                       : 22 kB
File Modification Date/Time     : 2020:03:13 05:58:51+02:00
File Access Date/Time           : 2020:03:13 05:58:51+02:00
File Inode Change Date/Time     : 2020:03:13 05:58:51+02:00
File Permissions                : rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 512
Image Height                    : 512
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Significant Bits                : 8 8 8 8
Comment                         : secret text for you ;)
Image Size                      : 512x512
Megapixels                      : 0.262

As you can see text added:

Comment: secret text for you ;) 

In windows you can check metadata and it will looks something like this


You can save and extract Geo location lat & long from media files and more details too.

Note: most famous social media extract or removes(or in fact compress media files while uploading which cause exif data removal) but other many websites DONOT ex. flickr @_@

Understand Flickr EXIF data

EXIF data reveals the story behind a photo. Info like the camera type, settings, and location are automatically added by the device when it’s captured. You can see any photographer’s EXIF data if they’ve made it public.
Show or Hide EXIF data
– Click any photo to open it.
-Below the photo, click Show EXIF.

You can hide the EXIF data by clicking Hide EXIF.
Manage your EXIF data
– Keep EXIF data secret – Update your Privacy Settings to hide your own EXIF visibility.
– Missing EXIF data – Some image editing apps delete this upon saving.

https://help.flickr.com/en_us/understand-flickr-exif-data-r1ge02Xo1X

Which means if your smartphone camera enabled to save the Geo-location and you just capture video and upload it online.. that means your current physical Geo-location and more other details about you will be available online to the public.

Categories
All

Reset Root Password in MySQL ^8.*

  1. Add below code to the end of /etc/mysql/my.cnf file.
    [mysqld]
    skip-grant-tables
  2. Restart service:
    sudo systemctl restart mysql
  3. Login into mysql:
    sudo mysql -uroot
  4. Remove root password:
    UPDATE mysql.user SET authentication_string=null WHERE User='root'; FLUSH PRIVILEGES; exit;
  5. Comment below code at the end of /etc/mysql/my.cnf file by add # in front of each line.
    # [mysqld]
    # skip-grant-tables
  6. Restart service:
    sudo systemctl restart mysql
  7. Login into mysql:
    sudo mysql -uroot

Done! 🙂

Categories
All

INSTALL AND RUN FLASK(PYTHON) ON UBUNTU 19.04 on VpsServer

Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks.


Step #0:
Signup (I appreciate if you use my referral link)
https://www.vpsserver.com/?affcode=21edd2c7bade
after your account becomes verified, create a Ubuntu 19.04 server.

Step #1:
Install python pip and flask by run:
$ sudo apt install python-pip
$ sudo apt install python3-pip
$ pip install -U Flask
$ pip3 install -U Flask

Step #2:
Add your project files on the server (ex. from GitHub using clone command)
in this tutorial let’s use a very simple flask app example that prints Hello, World! and save the app in (ex. /var/www/flask):

$ mkdir /var/www/flask
$ cd /var/www/flask
$ nano app.py
copy below code and paste it in app.py file using CTRL + SHIFT + V keys.

# app.py file

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World!"

then press ( CTRL+ X )-> Y -> ENTER.


Step #3:
Run the server by run:
$ env FLASK_APP=app.py flask run -h xxx.xxx.xxx
change xxx.xxx.xxx to your server ip

output:

Serving Flask app "app.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://xxx.xxx.xxx:5000/ (Press CTRL+C to quit)
Categories
All

Simple System With GraphGL, Reactjs, PHP

simple system with GraphQL, Reactjs, PHP

Tools used: PHP v7.3^ , Symfony 4.4^ , React 16^ , VPS, SQL , Docker , overblog/GraphQLBundle

Preview:

as gif – video

note: this is my first time to use GraphQL & Reactjs

GraphiQL:

Example Query:

query {
buyer(id: 20){
id,
name,
authToken
},
products{
id,
name
},
buyers{
name
}
}

Example Mutation: 
Note: entered buyerID and productsIDs must be existed to create order!

mutation {
createOrder(buyerID: "20", productsIDs: ["26", "24"]){
id,
buyer{
name
},
products{
name,
id
}
}
}

Install & run:
  • $ git clone git@github.com:khaledalam/simple-system-with-graphql-react-php.git $ cd simple-system-with-graphql-react-php
  • Update DB info in .env file:DATABASE_URL=mysql://USERNAME:PASSWORD@127.0.0.1:PORT/DB_NAME
  • $ composer install # press (a) to accept all recipes $ yarn install $ php bin/console doctrine:database:create $ php bin/console doctrine:schema:update --force -n $ php bin/console doctrine:fixtures:load -n # add dummy buyers&products
  • $ php bin/console server:start
Assumptions:
  • I assume order can contain multi-products instead of a single product.
  • I assume we can use any ready jwt sandbox app (ex. example)
    • host jwt sandbox on any server
    • inject it throw register, login and retrieving buyer’s orders processes via HTTPexample: – curl -H “Authorization: jwt+[TOKEN]” http://jwt_server/getBuyerIdOfThisToken – compare returnedId with current buyer id – if equal then fetch all current buyer’s orders
  • I assume all current urls available only for admins
  • I assume validations are very basic annotation constraints
  • I assume we use symfony environment (ex. this docker-symfony)
  • I assume more improvements will be done (ex. decrease redundant codes, reducing repetition logic)
  • I assume using another toolkit that supports editing HTTP headers for graphql instead of playground(since I used symfony not laravel and no stable symfony bundle similar to mll-lab/laravel-graphql-playground)

GitHub: https://github.com/khaledalam/simple-system-with-graphql-react-php

Categories
All

Protected: Energy Vampire Recruiters

This content is password protected. To view it please enter your password below: