Skip to content

Instantly share code, notes, and snippets.

View danieldogeanu's full-sized avatar

Daniel Dogeanu danieldogeanu

View GitHub Profile
@danieldogeanu
danieldogeanu / WampHTTPS.md
Last active March 27, 2024 16:43
How to enable HTTPS for WAMP Server.

After you've downloaded and installed WAMP Server, follow these steps:

  1. Generate SSL certificate using OpenSSL:
  • Add C:\wamp64\bin\apache\apache2.4.27\bin directory to the PATH so you can access openssl command from the command prompt (WAMP comes with its own version of OpenSSL already integrated, so you don't need to install it. You'll find it in this directory.).

    IMPORTANT: Please note that the path of your installation depends on your version of Apache! DO NOT copy and paste the paths presented in this gist as they will not match with yours!

  • Navigate to your user directory (C:\Users\%YOUR_USERNAME%\), create a new folder (.openssl), navigate to it with Powershell and run these commands:

    openssl genrsa -aes256 -out private.key 2048
    

openssl rsa -in private.key -out private.key

@danieldogeanu
danieldogeanu / RenameGitBranch.md
Last active March 25, 2024 22:43
How to rename your Git master branch to main.

To rename your Git master branch to main, you must do the following steps:

  1. Navigate to your repository in the command line and issue the following commands: - git branch -m master main - git push -u origin main

  2. Change your default branch on GitHub by going to your GitHub repository in your browser, and navigate to Settings > Branches and click on the dropdown and switch from master to main and click Update (this will only show if you have two or more branches). The main branch is now your default branch.

  3. Update the tracking of the branch from your command line with the following command: - git branch -u origin/main main

@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Last active March 10, 2024 07:41
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@danieldogeanu
danieldogeanu / WampSendmail.md
Created November 22, 2019 17:12
How to configure Wamp Server to send email with sendmail.

1. Download and Configure Sendmail for Windows:

  • Download Sendmail for Windows;
  • Extract sendmail.zip and place the contents in an easily accessible place, like C:\sendmail;
  • Open the sendmail.ini file using a text editor such as notepad and edit the following values:
    [sendmail]
    smtp_server=mail.example.com
    smtp_port=465
    auth_username=username@example.com
    

auth_password=your_password

@danieldogeanu
danieldogeanu / SyncFoldersOutsideOneDrive.md
Last active November 6, 2023 01:01
Sync Folders Outside OneDrive
  1. Find the Address of the folder you want to be synced. (ie. G:\Games\). Copy it.

  2. Find the OneDrive location you wish for it to sync to. Hold shift and right click. On the context menu, click open command window here.

  3. In the command window type mklink /j "YourCustomFolderName" G:\Games\ (G:\Games\ is the address of your original folder).

This is like a shortcut that tells any programs that look there to look at another directory. This will sync anything inside the address you tell it to the folder created in a onedrive directory


@danieldogeanu
danieldogeanu / EnablePaste.md
Last active September 14, 2023 17:36
Re-enable pasting on input fields.

To re-enable pasting for input fields where paste is disabled, open the console and paste the following:

document.addEventListener('paste', (e) => e.stopImmediatePropagation(), true);

Enjoy! 😊

If this was useful, you can buy me a coffee here. Thank you!

import { ComponentProps, FC, Fragment } from "react";
export interface ProvidersProps {
children: React.ReactNode;
}
export type ProviderWithProps = [FC<ProvidersProps>, Object];
/**
* Function that combines all the context providers into a single one.
@danieldogeanu
danieldogeanu / ChangeGitRemote.md
Created March 19, 2023 01:54
How to change Git remote origin urls, to push repo to GitLab or GitHub.

How to change Git remote origin URLs, to push all branches and tags from your repo to GitLab or GitHub.

With the commands below, you can change your source control provider easily:

git remote set-url origin git@gitlab.com:your-repo-name.git
git remote -v
git push -u origin --all
git push -u origin --tags
@danieldogeanu
danieldogeanu / ExcludeDirectoriesWinSCP.md
Created August 7, 2019 19:16
How to exclude certain directories on FTP transfer in WinSCP.

To exclude directories in WinSCP open the application and do the following:

  1. From the Login window click Tools > Preferences...;
  2. In the Preferences window navigate to Transfer section in the left side;
  3. From the right side click Add... button;
  4. In the Add transfer settings preset window, add a title for your preset in the Preset description field;
  5. Make sure that Binary (archives, doc, ...) is selected under the Transfer mode section;
  6. Under the Other section, at the end of the File mask: field, click the Edit... button;
  7. Add your files to exclude in the Exclude files: field, one per line;
  8. Add your directories to exclude in the Exclude directories: field, one per line;
  9. Click OK to close the window and to add the file masks;
@danieldogeanu
danieldogeanu / ConvertUnixTimestamp.md
Created October 31, 2020 19:01
How to convert a unix timestamp from a string to a number, in JavaScript, without losing precision.

How to convert a unix timestamp from a string to a number, in JavaScript, without losing precision:

const stringTimestamp = '1603767190'; // Unix Timestamp
const numberTimestamp = (+ new Date(stringTimestamp * 1000)) / 1000;

console.log(numberTimestamp); // 1603767190
console.log(typeof numberTimestamp); // number