dataDesk BLOG

Welcome to the blog of Mr.G

Nature
Posts: 9

Blog 1: Screenshot_2025-03-20-09-40-36.jpg | (Open) | (Share)

▲ Previous | Next ▼

/PicNotes

(Last modified: March 22 2025 09:50:06)
Screenshot_2025-03-20-09-40-36
Image
Shared by © dataDesk



Blog 2: orny_Adams.md | (Open) | (Share)

▲ Previous | Next ▼

/Videos

(Last modified: March 09 2025 20:43:11)

orny Adams

thumbnail



Blog 3: markdown-cheat-sheet.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/Code/helpful

(Last modified: March 21 2025 09:07:14)

Markdown Cheat Sheet

Thanks for visiting The Markdown Guide!

This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t cover every edge case, so if you need more information about any of these elements, refer to the reference guides for basic syntax and extended syntax.


## Basic Syntax

These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements.

### Heading

# H1
## H2
### H3

### Bold

**bold text**

### Italic

*italicized text*

### Blockquote

> blockquote

### Ordered List

1. First item
2. Second item
3. Third item

### Unordered List

- First item
- Second item
- Third item

### Horizontal Rule

---

### Link

[Markdown Guide](https://www.markdownguide.org)

### Image

![alt text](https://www.markdownguide.org/assets/images/tux.png)

## Extended Syntax

These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.

### Table

| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |

### Fenced Code Block

use ``` code ```

### Footnote

Here's a sentence with a footnote. [^1]

[^1]: This is the footnote.

### Heading ID

### My Great Heading {#custom-id}

### Definition List

term
: definition

### Strikethrough

~~The world is flat.~~

### Task List

- [x] Write the press release
- [ ] Update the website
- [ ] Contact the media

### Emoji

That is so funny! :joy:

(See also [Copying and Pasting Emoji](https://www.markdownguide.org/extended-syntax/#copying-and-pasting-emoji))

### Highlight

I need to highlight these ==very important words==.

### Subscript

H~2~O

### Superscript

X^2^



Blog 4: phpmailer.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/HowTo

Last modified: March 19 2025 17:43:31

phpmailer


composer require phpmailer/phpmailer

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php'; // Load PHPMailer via Composer

function sendAuctionEmail($recipientEmail, $recipientName, $subject, $message) {
    $mail = new PHPMailer(true);

    try {
        // SMTP settings
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com'; // SMTP server (use your provider if not Gmail)

        //$mail->Host = 'myappz.com'; 
        //$mail->Hostname = 'mail.myappz.com';

        $mail->SMTPAuth = true;
        $mail->Username = 'your-email@gmail.com'; // Your email address
        $mail->Password = 'your-email-password'; // Use an "App Password" if using Gmail
        //$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; 
        //$mail->Port = 587;
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
        $mail->Port = 465;

        // $mail->SMTPDebug = 2; // Use 2 for verbose output
        // $mail->Debugoutput = function ($str, $level) {
        //     file_put_contents('phpmailer_debug.log', "[$level] $str\n", FILE_APPEND);
        // };

        // Email headers
        $mail->setFrom('your-email@gmail.com', 'Auction Alerts'); // Sender email & name
        $mail->addAddress($recipientEmail, $recipientName); // Recipient email & name
        $mail->Subject = $subject;
        $mail->Body = $message;
        $mail->isHTML(true); // Allows HTML content (optional)

        // Send email
        $mail->send();
        return "📧 Email sent successfully to $recipientEmail";
    } catch (Exception $e) {
        return "❌ Email failed: " . $mail->ErrorInfo;
    }
}


require 'sendmail.php';

// Example: Send an email when 15 minutes remain
$recipientEmail = "user@example.com";
$recipientName = "John Doe";
$subject = "Auction Alert: 15 Minutes Left!";
$message = "Hello $recipientName, this is a reminder that your auction is ending in 15 minutes.";

echo sendAuctionEmail($recipientEmail, $recipientName, $subject, $message);

Gmail (and other email providers) require proper email authentication to prevent spam and to verify that emails are coming from legitimate sources. This typically involves SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail).

Here’s how to set up SPF and DKIM to make your email deliverable to Gmail and other providers:


1️⃣ SPF (Sender Policy Framework)

SPF is used to verify the sending mail server is authorized to send emails on behalf of your domain.

Steps to Set Up SPF:

  1. Log in to your DNS provider (where you manage your domain settings).

  2. Add a TXT record for SPF:

    • Host: @ (or your domain name)
    • Type: TXT
    • Value:
      v=spf1 a mx ip4:12.123.123.12 ~all
    • Explanation:
      • v=spf1 → Specifies it's an SPF record.
      • a → Accepts mail from the IP address of the A record.
      • mx → Accepts mail from any server listed in the MX records for the domain.
      • ip4:12.123.123.12 → Allows mail from the IP 12.123.123.12 (your server IP).
      • ~all → Soft fail (emails from unauthorized servers are marked but not rejected).
  3. Save and apply the record. It may take a few minutes for DNS propagation.


2️⃣ DKIM (DomainKeys Identified Mail)

DKIM adds a digital signature to the email, allowing the receiving mail server (like Gmail) to verify that the email was sent by an authorized server and that it wasn’t tampered with during transit.

Steps to Set Up DKIM:



Blog 5: New_Project.md | (Open) | (Share)

▲ Previous

/Dev/HowTo/Git

Last modified: March 16 2025 12:44:13

New Project

To add your project to GitLab, follow these steps:


1️⃣ Create a New Repository on GitLab

  1. Go to your GitLab account.
  2. Click on New Project.
  3. Choose Create Blank Project.
  4. Give your project a name (e.g., my-ubuntu-project).
  5. Set visibility (Private, Internal, or Public).
  6. Click Create Project.
  7. Copy the Git URL (e.g., git@gitlab.com:username/my-ubuntu-project.git).

2️⃣ Initialize Git in Your Project Folder

Open a terminal and navigate to your project folder:

cd /path/to/your/project

Initialize Git:

git init

Set the GitLab remote repository:

git remote add origin git@gitlab.com:username/my-ubuntu-project.git

(Replace username with your GitLab username and my-ubuntu-project.git with your repo name.)


3️⃣ Add and Push Your Files

Stage all files:

git add .

Commit with a message:

git commit -m "Initial commit"

Push your project:

git branch -M main  # Ensure you're on the main branch
git push -u origin main

4️⃣ (Optional) Set Up SSH for GitLab

If you haven't already set up SSH authentication:

ssh-keygen -t rsa -b 4096 -C "your-email@example.com"

Copy your SSH key:

cat ~/.ssh/id_rsa.pub

Add it to GitLab (Profile → Preferences → SSH Keys).


! [rejected] main -> main (fetch first)
error: failed to push some refs to 'digts.de:firstgroup/user-handling-2.0.git'

Solution

This error occurs because the remote GitLab repository already has some commits that your local repository doesn’t have. To fix it, follow these steps:


1️⃣ Fetch and Merge Remote Changes

First, pull the latest changes from the remote repository before pushing your local changes:

git pull --rebase origin main

If you get a merge conflict, Git will show the affected files. You’ll need to manually resolve them and commit.


2️⃣ Force Push (If Needed)

If you are sure your local version is correct and you want to overwrite the remote changes, you can force push:

git push -f origin main

⚠ Warning: This will overwrite the remote repository with your local version, erasing any remote changes.


3️⃣ Alternative: Create a Backup Branch

If you’re unsure about force pushing, create a backup before pulling:

git branch backup-main
git push origin backup-main

Then try:

git pull --rebase origin main
git push origin main

4️⃣ If You Want to Keep Both Local & Remote Changes

Instead of --rebase, do a merge:

git pull origin main
# Resolve conflicts if needed
git commit -am "Merged remote changes"
git push origin main

gitignore


1️⃣ Check If config.php Is Still Tracked Locally

Run:

git ls-files | grep config.php
  • If it returns nothing, Git is not tracking config.php.
  • If it shows config.php, Git is still tracking it.

To be sure, check:

git status

If config.php is listed under "Untracked files", it means it's not in Git anymore (which is what you want).


2️⃣ Ensure config.php Is Ignored

To prevent Git from tracking it in the future, add it to .gitignore:

echo "config.php" >> .gitignore
git add .gitignore
git commit -m "Ignore config.php"
git push origin main

Now config.php will never be added again.



Who I am

"Just me, myself, and I, exploring the universe of unknownment, embracing the mystery of what lies beyond, one star at a time."

Share this page on Facebook | X.com | Reddit

Page Content

  • Image Screenshot 2025-03-20-09-40-36
    Published: 2025-03-29
    Read
  • Image orny Adams
    Published: 2025-03-29
    Read
  • Image markdown-cheat-sheet
    Published: 2025-03-21
    Read
  • Image phpmailer
    Published: 2025-03-20
    Read
  • Image New Project
    Published: 2025-03-16
    Read

Tags

WebDev New York London AI NORWAY DIY Ideas Life Family News Clothing Invest Sports Health