Skip to content

Instantly share code, notes, and snippets.

Working from home

Tawfek Daghistani tawfekov

Working from home
View GitHub Profile
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 / 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
# available limit
user@ubuntu:~$ ulimit -n
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
tawfekov / composer.json
Created Jun 14, 2017
force composer to pull packgist over https NOT http
View composer.json
"repositories": [
"type": "composer",
"url": ""
{ "packagist": false }
tawfekov / gist:99529cc9663585a6ef80a3b4f2bf88bf
Last active Aug 4, 2018
list of fast ciphers that nginx can use
View gist:99529cc9663585a6ef80a3b4f2bf88bf
tawfekov / nginx.conf
Created Jun 3, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here
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).

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
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 / update_currency.php
Last active Dec 30, 2015
update magento currency via cron or simple php script
View update_currency.php
$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.