Skip to content

Instantly share code, notes, and snippets.

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

Tawfek Daghistani tawfekov

🏠
Working from home
View GitHub Profile
@tawfekov
tawfekov / regions.sql
Created February 5, 2019 07:25
Saudi Arabia Magento2 Regions - Import
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 August 4, 2018 09:02 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04 for Nginx
# 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 June 14, 2017 15:51
force composer to pull packgist over https NOT http
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
],
@tawfekov
tawfekov / gist:99529cc9663585a6ef80a3b4f2bf88bf
Last active August 4, 2018 09:03
list of fast ciphers that nginx can use
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 June 3, 2016 20:45 — 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/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
Verifying that +tawfekov is my openname (Bitcoin username). https://onename.com/tawfekov

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...

@tawfekov
tawfekov / .vimrc
Created June 15, 2014 18:23 — forked from JeffreyWay/.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
<?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 December 30, 2015 03:29
update magento currency via cron or simple php script
<?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";