Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tawfek Daghistani tawfekov

🏠
Working from home
View GitHub Profile
@tawfekov
tawfekov / regions.sql
Created Feb 5, 2019
Saudi Arabia Magento2 Regions - Import
View regions.sql
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Aqiq','Aqiq');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Atawlah','Atawlah');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Baha','Baha');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Baljurashi','Baljurashi');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Mandaq','Mandaq');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Mudhaylif','Mudhaylif');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Mukhwah','Mukhwah');
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'SA','Qilwah','
@tawfekov
tawfekov / gist:f0f12d2dfa8680440fe147b35c05273c
Created Aug 4, 2018 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04 for Nginx
View gist:f0f12d2dfa8680440fe147b35c05273c
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@tawfekov
tawfekov / composer.json
Created Jun 14, 2017
force composer to pull packgist over https NOT http
View composer.json
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
],
@tawfekov
tawfekov / gist:99529cc9663585a6ef80a3b4f2bf88bf
Last active Aug 4, 2018
list of fast ciphers that nginx can use
View gist:99529cc9663585a6ef80a3b4f2bf88bf
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
@tawfekov
tawfekov / nginx.conf
Created Jun 3, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View gist:340aeefad299326ba40c
Verifying that +tawfekov is my openname (Bitcoin username). https://onename.com/tawfekov
View gpg-import-and-export-instructions.md

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
# or, instead of backing up trustdb...
View .vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
View Observer.php
<?php
/*
To make the cleaning expired carts automatic, override cleanExpiredQuotes with the following
version which will also take care of the old active carts: app/code/core/Mage/Sales/Model/Observer.php
*/
public function cleanExpiredQuotes($schedule)
{
// extending limit
@tawfekov
tawfekov / update_currency.php
Last active Dec 30, 2015
update magento currency via cron or simple php script
View update_currency.php
<?php
include("app/Mage.php");
Mage::app();
$now = new \DateTime();
echo "start downloading rates : {$now->format("Y-m-d H:i:s")}\n";
$model = Mage::getModel("directory/currency");
$currency_converter= Mage::getModel("directory/currency_import_webservicex");
$rates = $currency_converter->fetchRates();
echo json_encode($rates) . "\n";
echo "has been downloaded\n";
You can’t perform that action at this time.