Skip to content

Instantly share code, notes, and snippets.

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

Habeeb doxt3r

🏠
Working from home
View GitHub Profile
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
class AddEntityChoiceSubscriber implements EventSubscriberInterface
@doxt3r
doxt3r / full-ls-date.sh
Created February 15, 2023 10:48 — forked from wellington1993/full-ls-date.sh
ls linux with date year
ls -lahot --full-time
@doxt3r
doxt3r / .htaccess
Created January 30, 2023 13:04 — forked from jennimckinnon/.htaccess
Restrict Direct Access to Plugin and Theme PHP files in WordPress. Source: https://www.acunetix.com/websitesecurity/wordpress-security-top-tips-secure-wordpress-application/
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/directory/to/exclude/
RewriteRule wp-content/plugins/(.*\.php)$ - [R=404,L]
RewriteCond %{REQUEST_URI} !^/wp-content/themes/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/themes/directory/to/exclude/
RewriteRule wp-content/themes/(.*\.php)$ - [R=404,L]
@doxt3r
doxt3r / ssl_tricks.txt
Created October 18, 2022 07:44
Remove passphrase from certificate key
openssl rsa -in [my.key] -out [new.key]
Enter the passphrase
The output file new.key should now be unencrypted
@doxt3r
doxt3r / gist:87ddf7051353a7cce86c9a315f3369d4
Created October 14, 2022 14:42 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@doxt3r
doxt3r / WebStorm_DataGrip_IntelliJIdea
Created June 13, 2022 14:46 — forked from ShawNexT/WebStorm_DataGrip_IntelliJIdea
WebStorm & DataGrip & IntelliJIdea renew license
cd ~/.WebStorm*
rm config/eval/WebStorm*evaluation.key
rm config/options/other.xml
cd ~/.java/.userPrefs/jetbrains
rm -rf webstorm
cd ~/.DataGrip*
rm config/eval/DataGrip*evaluation.key
rm config/options/other.xml
@doxt3r
doxt3r / ObjectManager_issue_after_update.md
Created December 27, 2021 22:04
Uncaught ReflectionException: Class "Doctrine\Common\Persistence\ObjectManager" not found while loading dans un symfony project 5

Après un composer update:

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Warning:  Uncaught ReflectionException: Class "Doctrine\Common\Persistence\ObjectManager" not found while loading "App\DataFixtures\AppFixtures". in /home/habeeb/lab/project/vendor/symfony/config/Resource/ClassExistenceResource.php:181

Il faut changer "use Doctrine\Common\Persistence\ManagerRegistry" par use Doctrine\Persistence\ManagerRegistry;

@doxt3r
doxt3r / parmissions.txt
Created July 14, 2021 18:25
permissions on linux
Number Octal Permission Representation
0 No permission
1 Execute permission
2 Write permission
3 Execute and write permission: 1 (execute) + 2 (write) = 3
4 Read permission
5 Read and execute permission: 4 (read) + 1 (execute) = 5
6 Read and write permission: 4 (read) + 2 (write) = 6
7 All permissions: 4 (read) + 2 (write) + 1 (execute) = 7
@doxt3r
doxt3r / mysql
Created July 14, 2021 10:41
Mysql error installation on Ubuntu
habeeb@machine2 info $ sudo apt reinstall mysql-server-core-8.0
The following packages will be REINSTALLED:
mysql-server-core-8.0
The following partially installed packages will be configured:
mysql-server-8.0
0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 2 not upgraded.
Need to get 18,1 MB/19,4 MB of archives. After unpacking 0 B will be used.
Get: 1 http://ubuntu.univ-nantes.fr/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.25-0ubuntu0.20.04.1 [18,1 MB]
Fetched 18,1 MB in 29s (633 kB/s)
dpkg: warning: files list file for package 'mysql-server-8.0' missing; assuming package has no files currently installed
@doxt3r
doxt3r / getFilename.php
Created March 18, 2021 21:12 — forked from kitsaels/getFilename.php
Get Filename from HTTP header Content-Disposition
<?php
function getFilename($header) {
if (preg_match('/Content-Disposition:.*?filename="(.+?)"/', $header, $matches)) {
return $matches[1];
}
if (preg_match('/Content-Disposition:.*?filename=([^; ]+)/', $header, $matches)) {
return rawurldecode($matches[1]);
}
throw new Exception(__FUNCTION__ .": Filename not found");