Skip to content

Instantly share code, notes, and snippets.

:electron:
Building Awesome Stuff

Daniel Dogeanu danieldogeanu

:electron:
Building Awesome Stuff
Block or report user

Report or block danieldogeanu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danieldogeanu
danieldogeanu / RedirectWordPressToHTTPS.md
Last active Oct 17, 2019
How to redirect a WordPress site to HTTPS via the .htaccess file.
View RedirectWordPressToHTTPS.md

Add the following two lines of code into the .htaccess file:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

WARNING: For testing purposes, you might want to remove the [L,R=301] condition from the second line and instead just use [L,R]. R=301 will make your browser PERMANENTLY redirect to the new URL and there's no way you can break out of that if you missconfigure your .htaccess file! You might get around the mistake, but your users WON'T!

Your final .htaccess should look like this:

@danieldogeanu
danieldogeanu / WampHTTPS.md
Last active Oct 8, 2019
How to enable HTTPS for WAMP Server.
View WampHTTPS.md

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.).
  • 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
    openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config c:\wamp64\bin\apache\apache2.4.27\conf\openssl.cnf
    
@danieldogeanu
danieldogeanu / GitLabCICD.md
Last active Oct 3, 2019
Things to remember about GitLab CI/CD config file.
View GitLabCICD.md
  • You MUST indent lines in the .gitlab-ci.yml file with 2 spaces and NOT TABS! If you don't do this, the GitLab CI/CD pipeline will fail and say there's unknown characters in your file (this is why).
@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Created Oct 3, 2019
How to make Powershell remember the SSH key passphrase.
View MakePowerShellRememberSSHPassphrase.md

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: a. Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window; b. Find the OpenSSH Authentication Agent in the list and double click on it; c. 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.

  2. 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;

  3. Configure SSH to automatically add the keys to the agent on startup by editing the config file found at C:\Users\%YOUR_USERNAME%\.ssh\config, and add the following lines:

@danieldogeanu
danieldogeanu / InstallSQLite.md
Last active Sep 24, 2019
How to install SQLite 3 on Windows 10.
View InstallSQLite.md
  1. Go to the SQLite download page;
  2. Under Precompiled Binaries for Windows download sqlite-tools-win32-x86-3290000.zip;
  3. Extract sqlite-tools-win32-x86-3290000.zip on the C:\ drive (it can be in the root of the drive or in a folder without spaces in its name);
  4. Search for "environment variables" in Windows Search and click on Edit the system environment variables;
  5. In the System Properties window click Environment Variables...;
  6. Under System variables select Path and click Edit...;
  7. In the Edit environment variable window, click New and paste the folder location where you extracted sqlite-tools-win32-x86-3290000.zip on the C:\ drive.
  8. Optionally you can rename sqlite3.exe to sqlite.exe, so you can type only sqlite command. Or you can duplicate sqlite3.exe and rename it to sqlite.exe to have access to both versions for compatibility.
@danieldogeanu
danieldogeanu / ExcludeDirectoriesWinSCP.md
Created Aug 7, 2019
How to exclude certain directories on FTP transfer in WinSCP.
View ExcludeDirectoriesWinSCP.md

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 / ListGlobalNPMPackages.md
Created Aug 5, 2019
List all global npm packages.
View ListGlobalNPMPackages.md

npm list -g --depth 0

@danieldogeanu
danieldogeanu / DeleteBranches.md
Last active Sep 1, 2018
How to delete branches from GitHub/BitBucket.
View DeleteBranches.md
  1. If the branches are only local, you can use -d if the branch has been merged:

    git branch -d branch-name

  2. If the branch contains code you never plan on mergin, use -D instead:

    git branch -D branch-name

  3. If the branch is in the upstream repo you can remove the remote reference by:

@danieldogeanu
danieldogeanu / MergeBranchToMaster.md
Last active Sep 1, 2018
How to merge a branch into master on GitHub/BitBucket.
View MergeBranchToMaster.md

git checkout master

git pull origin master

git merge yourBranch

git push origin master

View keybase.md

Keybase proof

I hereby claim:

  • I am danieldogeanu on github.
  • I am danieldogeanu (https://keybase.io/danieldogeanu) on keybase.
  • I have a public key ASCsAwthxKe2hoVBGnVC4NlpHaz_IBnII0nFe2J-DiHvFwo

To claim this, I am signing this object:

You can’t perform that action at this time.