Skip to content

Instantly share code, notes, and snippets.

View thomaskanzig's full-sized avatar
😎
Knowledge is responsibility

Thomas Känzig thomaskanzig

😎
Knowledge is responsibility
View GitHub Profile
@thomaskanzig
thomaskanzig / insufficient-permission-to-add-an-object-to-the-repository-database-git-objects.md
Created April 5, 2023 15:56
Insufficient permission to add an object to the repository database .git/objects

Insufficient permission to add an object to the repository database .git/objects

If you did some git command with user root previously for some reason and now you don't have the permission with any other user, you can simplest do this.

From the root project:

cd .git/objects
@thomaskanzig
thomaskanzig / get-list-and-delete-objects-from-aws-s3-bucket.md
Last active March 31, 2023 09:13
Get, list and delete objects from AWS S3 Bucket

Get, list and delete objects from AWS S3 Bucket

As requirement, install the AWS SDK for PHP library to connect AWS S3.
First of all you need to connect to your AWS S3:

require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
@thomaskanzig
thomaskanzig / configure-gitlab-ci-runner-with-docker-executor-using-aws-ec2.md
Last active July 4, 2024 10:49
Configure GitLab CI Runner with Docker executor using AWS EC2

Configure GitLab CI Runner with Docker executor using AWS EC2

In this tutorial you will see how you can create you gitlab-ci.yml file in your repository and execute jobs on gitlab pipelines.

1. Create a VM on AWS EC2

  • In AWS, create an instance and choose the Amazon Linux 2 AMI machine.
  • Create a new key pair with the name similar like gitlab-runner. Isn't needed to be the same, just a name so you can identfy the purpose.
    • The key pair type can be ED25519
@thomaskanzig
thomaskanzig / how-to-add-a-new-key-pair-to-your-exisitng-AWS-ec2-instances.md
Created February 7, 2023 17:49
How to add a new key pair to your exisitng AWS ec2 Instances

How to add a new key pair to your exisitng AWS ec2 Instances

To connect Amazon Ec2 Instances we need a Private Key generated while creating a particular Instance. In case, anyhow you deleted that key pair from your account or for security reasons you want to attach a new key to your Instance, then here is the step-by-step tutorial to perform the same.

1. Open Key Pairs page

Once you log in to your AWS account you will see the AWS Management Console. On the left top side, click on the Service drop Menu to select EC2. As you are on the ec2 Dashboard, scroll down and from the left side select “Key Pairs” and then click on the “Create Key Pair“.

2. Create a new Private SSH ec2 key pair

@thomaskanzig
thomaskanzig / fixing-error-with-file-get-contents-permission-denied.md
Created January 18, 2023 14:31
PHP Fixing error with file_get_contents permission denied

PHP Fixing error with file_get_contents permission denied

If you don't receive any content with file_get_contents() and curl , like this error below:

file_get_contents('url'): failed to open stream: Permission denied
  1. Be sure you have allow_url_fopen=On in your php.ini file. (If someone doesn't know where your php.ini file is, quick check with phpinfo() could get you everything.
@thomaskanzig
thomaskanzig / install-php-composer-globally-on-rocky-linux.md
Last active January 17, 2023 17:48
Install PHP Composer on Rocky Linux 8 Globally

Install PHP Composer on Rocky Linux 8 Globally

Download PHP Composer Installer Script:

Run the command below to download PHP composer installer script:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
@thomaskanzig
thomaskanzig / how-to-remove-git-from-the-project.md
Created January 15, 2023 15:55
How to Remove Git from the Project

How to Remove Git from the Project?

To remove Git from project we can remove the .git folder using the Git command.

rm -rf .git*

The Git command rm -rf is used, rm removes a file from Git, and the -rf option of this command removes files recursively and forcefully. .git* removes the folder starting with .git.

@thomaskanzig
thomaskanzig / how-to-update-.gitignore-file.md
Last active August 28, 2022 11:35
How to update .gitignore file

How to update .gitignore file

In some case, in the middle of our developlment, you have to add a new file or directory to the .gitignore file.
How do you do that?

Well, first of all make sure that the changed files in your project are saved in a commit. Then, add your file or directory to your .gitignore file.
Run these commands below to clear your repository cache and save again in a new commit:

git rm -r --cached . 
@thomaskanzig
thomaskanzig / how-to-install-php-apache-mysql-phpMyAdmin-on-macos-monterey-using-homebrew.md
Last active June 20, 2024 02:07
How to install PHP + Apache + MySQL + phpMyAdmin on macOS Monterey using Homebrew

How to install PHP + Apache + MySQL + phpMyAdmin on macOS Monterey using Homebrew

This is a simple process with all instructions for the Development Environment on Mac OS X.
All steps will be launch in your Terminal (/Applications/Utilities/Terminal).

XCode Command Line Tools

If you don't already have XCode installed, it's best to first install the command line tools as these will be used by homebrew: