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
@doxt3r
doxt3r / sql2csv.py
Created July 18, 2019 14:43
SQL to CSV converter efdefsefqdsfqsfsqdffqdsfsdqs
#SQL to CSV converter ( sql2csv )
#./VIRkid
#Script is in Alpha stage so even i don't expect it to work 100% .sql files have tons of different formats ;_;
#fb.com/virkid36
#visit : skidventures.blogspot.com
#form more skiddy stuff
##########################
import re
import sys
import argparse
@doxt3r
doxt3r / sql2csv.py
Created July 18, 2019 14:54
converter
#! /usr/bin/python3
import sys
import re
MAX_BYTES = 524288 # max bytes stored in memory befor writting to disk (512KB)
MAX_MEMORY = 1073741824 # max memory stored before crash (1GB)
def main(argv):
if len(argv) < 1:
@doxt3r
doxt3r / csv_from_array.php
Last active February 19, 2020 20:29
csvfromArrayOfArrays
$tableoftables = [];
$response = new StreamedResponse();
$response->setCallback(function() use($tableoftables){
$outputBuffer = fopen("php://output", 'w+');
fputs($outputBuffer, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF)));
foreach($tableoftables as $v) {
fputcsv($outputBuffer, $v,';');
}
fclose($outputBuffer);
@doxt3r
doxt3r / countries_wcf7.txt
Created October 30, 2020 12:34
Country Select list for Wordpress Form Contact 7 (with iso code)
[select* country id:country
"France|FR"
"Afghanistan|AF"
"Åland Islands|AX"
"Albania|AL"
"Algeria|DZ"
"American Samoa|AS"
"Andorra|AD"
"Angola|AO"
"Anguilla|AI"
@doxt3r
doxt3r / pass_php_var_to_js_wordpress.php
Last active March 10, 2021 19:21
Pass php variables to enqueued js script
/* Custom script with no dependencies, enqueued in the header */
add_action('wp_enqueue_scripts', 'reem_enqueue_custom_js');
function reem_enqueue_custom_js() {
$loggedIn = (int) is_user_logged_in();
$locale = get_locale();
wp_enqueue_script('custom', get_stylesheet_directory_uri().'/js/custom.js');
wp_localize_script('custom', 'custom_vars', array(
'loggedIn' => $loggedIn,
'locale' => $locale,
'siteUrl' => site_url()
@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");
@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 / 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 / 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 / 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