Skip to content

Instantly share code, notes, and snippets.

View zuhairkareem's full-sized avatar
🏠
Working from home

zuhairkareem

🏠
Working from home
View GitHub Profile
@zuhairkareem
zuhairkareem / windows-server-startup.md
Created August 15, 2022 07:51
Add scripts on startup on windows server
@zuhairkareem
zuhairkareem / drupal_upgrade_domains_firewall.md
Last active June 14, 2022 08:18
Drupal upgrade - domains to include in firewall in decoupled architecture

Here is some unofficial info that I compiled for a customer some time ago. Maybe you can use it as a starting point.

ftp.drupal.org , Port 443 (for update module)

git.drupal.org , Port 22, 80, 443 (for patches)

packages.drupal.org , Port 22, 80, 443 (for Drupal Composer packages)

updates.drupal.org , Port 80, 443 (for update module)

@zuhairkareem
zuhairkareem / ubuntu_error_fix.md
Last active May 16, 2022 12:16
invoke-rc.d: policy-rc.d denied execution of stop. , dpkg: error processing package mysql-server-8.0 error on Ubuntu 20.04

For forcefully purging the package.

Since removing packages can be destructive, print the list of the package that will be removed:

dpkg -l | awk  '{print $2}' | grep -i mysql | grep -v lib

Check if any important package is being removed. If everything seems fine, proceed to step 2.

Purge the packages:

@zuhairkareem
zuhairkareem / manually_translate_d8_config.php
Created February 15, 2022 15:13
Create translated strings manually in Drupal 8 config interface translation
<?php
use \Drupal\locale\SourceString;
$source_string = "Source text string";
$translated_string = "translated string";
$langcode = "ar";
// Find existing source string.
$storage = \Drupal::service('locale.storage');
@zuhairkareem
zuhairkareem / rest_resource_del.md
Created November 7, 2021 13:34
Delete a specific REST resource using drush Drupal 8/9

drush cdel rest.resource.{YOUR_RESOURCE_NAME}

@zuhairkareem
zuhairkareem / delete_tokens_d8_oauth2.md
Created October 18, 2021 10:01
delete all oAuth2 tokens - Drupal 8/9
<?php

$query = \Drupal::entityTypeManager()->getStorage('oauth2_token')->getQuery();
$entity_ids = $query->execute();


$results = \Drupal::entityTypeManager()->getStorage('oauth2_token')->loadMultiple(array_values($entity_ids));

//var_dump($results);
@zuhairkareem
zuhairkareem / lando_useful_tips.md
Created April 14, 2021 10:02
Lando - Useful tips
Oauth2 public/private key config in lando
Create public/private key inside drupal lando root and give the path in the simple oauth configuration (/admin/config/people/simple_oauth)
openssl genrsa -out private.key 2048
openssl rsa -in private.key -pubout > public.key
/app/public.key
@zuhairkareem
zuhairkareem / curl_post.md
Last active March 11, 2021 10:56
Curl with redirections in bash
curl --request POST \ 
    -Li 'URL_VALUE' \
    --header 'cache-control: no-cache' \
    --header 'content-type: application/json' \
    --data '{\n\n"Name":"Test"\n\n}'
@zuhairkareem
zuhairkareem / angular_8_11_upgrade.md
Last active February 1, 2021 19:28
Angular 8 to 11 Upgrade

Angular 8 to 9 :-

  1. Follow the official migration guide.
  2. Add "ng add @angular/localize" and add "import '@angular/localize/init';" in polyfills.ts, remove entryComponents

Angular 9 to 11 :-

  1. Add a slash before assets url (if you get - Module Error (Emitted value instead of an instance of Error)) - https://stackoverflow.com/questions/53024995/module-error-emitted-value-instead-of-an-instance-of-error

  2. Hammerjs - https://indepth.dev/posts/1075/exciting-times-ahead-be-ready-for-angular-9#hammerjs-is-now-optional & https://stackoverflow.com/questions/63613272/hammer-gesture-config-import-error-after-updating-angular-project-from-7-to-10 & https://github.com/angular/components/blob/master/guides/v9-hammerjs-migration.md#the-migration-reported-ambiguous-usage-what-should-i-do