Skip to content

Instantly share code, notes, and snippets.

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

Saleh Souzanchi zoghal

🏠
Working from home
View GitHub Profile
@zoghal
zoghal / 00_wp-optimizations-security-n-cleanup.md
Created October 3, 2023 00:39 — forked from ApoGouv/00_wp-optimizations-security-n-cleanup.md
WP - Optimizations, Security hardening and Cleanup.

** WP - Optimizations, Security hardening and Cleanup **

Here you can find a a list of WP optimization and cleanup functions and methodology.

1.  .htaccess
  ** Security **
- Disable the server signature
- Disable directory browsing
- Force https to your site.
@zoghal
zoghal / my.cnf
Created August 30, 2023 16:40 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@zoghal
zoghal / gist:06f9d8ffdbd82bbea4ce76e38a999d3b
Last active January 23, 2018 12:54 — forked from baghayi-gist/gist:4009084
PHP: Converting Numbers functions Persian To English & English To Persian
function convertNumbersFaToEn($number)
{
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$num = range(0, 9);
return str_replace($persian, $num, $number);
}
function convertNumbersEnToFA($number)
{
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$num = range(0, 9);
@zoghal
zoghal / debug.py
Created October 8, 2016 10:50 — forked from sah/debug.py
some handy functions for debugging python code
# Copyright © 2011, 2012, 2013, 2014 Sauce Labs Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@zoghal
zoghal / nginx.conf
Created October 17, 2015 00:15 — 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
@zoghal
zoghal / gsub.js
Last active September 6, 2015 02:55 — forked from geowarin/gsub.js
Javascript implementation of ruby gsub
String.prototype.gsub = function (pattern, replacement) {
var match, result, source = this.toString();
if (pattern == null || replacement == null) {
return source;
}
result = '';
while (match = source.match(pattern)) {
result += source.slice(0, match.index);
result += typeof replacement === 'function' ? replacement(match[0]) : replacement;
source = source.slice(match.index + match[0].length);
@zoghal
zoghal / JS gsub
Last active August 29, 2015 14:26 — forked from varunkumar/JS gsub
JavaScript implementaion of ruby's gsub
gsub = function(source, pattern, replacement) {
var match, result;
if (!((pattern != null) && (replacement != null))) {
return source;
}
result = '';
while (source.length > 0) {
if ((match = source.match(pattern))) {
result += source.slice(0, match.index);
result += (typeof replacement === 'function') ? replacement(match[0]) : replacement;
@zoghal
zoghal / test.js
Last active August 29, 2015 14:21 — forked from JacksonTian/test.js
var Ghost = require('webghost');
var should = require('should');
var ghost = new Ghost({browser: "chrome", host: "ip"});
ghost.open()
.go("http://your/url")
.text('p', function (text) {
text.should.be.not.equal('haha');
})
.click('button') // 点击按钮
from ghost import Ghost
from PySide.QtGui import QApplication, QImage, QPainter, QPrinter
class MyGhost(Ghost):
def capture_pdf(self):
printer = QPrinter(QPrinter.HighResolution)
printer.setResolution(300)
printer.setOutputFileName("QtPrinter.pdf")
printer.setPaperSize(QPrinter.A4)
from ghost import Ghost
from sys import argv
def main():
url = argv[1]
path = argv[2]
screenshot(url,path)
def screenshot(url,path):
ghost = Ghost()