Skip to content

Instantly share code, notes, and snippets.

View yuseferi's full-sized avatar

Yusef Mohamadi yuseferi

View GitHub Profile
@yuseferi
yuseferi / main.go
Created February 16, 2022 12:51
Producer Consumer basic in Golang
package main
import (
"flag"
"fmt"
)
type Consumer struct {
msgs chan int
}
@yuseferi
yuseferi / drupal old fashion module to composer
Last active August 15, 2020 07:26
drupal old fashion module to composer.sh
# in root of your project
for i in $(find web/modules -maxdepth 1 -type d); do COMPOSER_MEMORY_LIMIT=-1 composer req drupal/$(basename $i); done
for i in $(find web/theme -maxdepth 1 -type d); do COMPOSER_MEMORY_LIMIT=-1 composer req drupal/$(basename $i); done
# Name the application the same as in your .platform.app.yaml.
name: PROJECT_NAME
# Use the recipe appropriate for your application.
recipe: drupal8
config:
# Lando defaults to Apache. Switch to nginx to match Platform.sh.
via: nginx
# Set the webroot to match your .platform.app.yaml.
@yuseferi
yuseferi / fix-files-directories-permission-php.php
Last active September 4, 2018 06:49
Fix Files Directories Permissions by PHP code
<?php
fix_file_directory_permission(dirname(__FILE__));
function fix_file_directory_permission($dir, $nomask = array('.', '..')) {
if (is_dir($dir)) {
// Try to fix directories permission
if (@chmod($dir, 0755)) {
echo "<p>Permission Fixed for : " . $dir . "</p>";
}
}
@yuseferi
yuseferi / fix-drupal-file-directories-permission
Created August 8, 2018 04:14
Fix Drupal File and Directory Permission
#!/bin/bash
path=${1%/}
user=${2}
group="www-data"
help="nHelp: This script is used to fix permissions of a drupal installationnyou need to provide the following arguments:nt 1) Path to your drupal installationnt 2) Username of the user that you want to give files/directories ownershipnNote: "www-data" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this scriptnnUsage: (sudo) bash ${0##*/} drupal_path user_namen"
if [ -z "${path}" ] || [ ! -d "${path}/sites" ] || [ ! -f "${path}/modules/system/system.module" ]; then
echo "Please provide a valid drupal path"
echo -e $help
@yuseferi
yuseferi / __INDEX.txt
Created March 17, 2017 06:08 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@yuseferi
yuseferi / detector.md
Created February 15, 2017 19:22 — forked from typehorror/detector.md
Detecting Similar News

Detecting Similar News

The following gist is an extract of the article Detecting Similar News. It exploit data retrieve by a crawler and detect similar article across different domains

Usage

Start by running the crawler to retrieve the data. Crawler takes about 50 minutes to retrieve all the data the first time.

$ python run.py

retrieving url... [techcrunch.com] /

@yuseferi
yuseferi / inject.py
Created February 4, 2017 10:31 — forked from leonjza/inject.py
Wordpress 4.7.0/4.7.1 Unauthenticated Content Injection PoC
# 2017 - @leonjza
#
# Wordpress 4.7.0/4.7.1 Unauthenticated Content Injection PoC
# Full bug description: https://blog.sucuri.net/2017/02/content-injection-vulnerability-wordpress-rest-api.html
# Usage example:
#
# List available posts:
#
# $ python inject.py http://localhost:8070/