Skip to content

Instantly share code, notes, and snippets.

View nilesolutions's full-sized avatar

Ahmed Samy nilesolutions

  • Abu dhabi
View GitHub Profile
@nilesolutions
nilesolutions / optimize.php
Created December 24, 2018 09:51 — forked from fians/optimize.php
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/
@nilesolutions
nilesolutions / mytop.sh
Created September 9, 2018 07:32 — forked from detain/mytop.sh
mytop (Monitor mysql process list with top like screen updates and adiditonal stats like cpu/io usage)
#!/bin/bash
# mytop.sh - (Monitor mysql process list with top like screen updates and adiditonal stats like cpu/io usage)
#
# Sample Output:
#
# CPU Usage 3.29% user 1.60% system 3.37% io wait 0.00% steal 91.59% idle
# Up 17 days 10 hours Load Avg 0.43 0.36 0.35 Processes 1(running) 408(total) Last PID 17825
# +----------+------+-----------+----+---------+------+-------+------------------+
# | Id | User | Host | db | Command | Time | State | Info |
# +----------+------+-----------+----+---------+------+-------+------------------+
@nilesolutions
nilesolutions / reteet_lambda.js
Created July 13, 2018 11:07 — forked from tanish-kr/reteet_lambda.js
twitter get retweet by lambda function
'use strict';
const AWS = require("aws-sdk");
const dynamodb = new AWS.DynamoDB();
const querystring = require("querystring");
const http = require("https");
const TWITTER_API_URL = "https://api.twitter.com"
const TWITTER_HOSTNAME = "api.twitter.com"
/**
@nilesolutions
nilesolutions / Dockerfile
Created June 22, 2018 19:06 — forked from hardillb/Dockerfile
Mosquitto + auth_plugin + mongo
FROM ubuntu:16.04
MAINTAINER Ben Hardill <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
USER root
RUN apt-get update && apt-get install -y \
pkg-config \
@nilesolutions
nilesolutions / README.md
Created April 2, 2018 12:09 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@nilesolutions
nilesolutions / convert-wordpress-to-blogger-export-file.php
Last active January 19, 2018 11:53
convert your wordpress to blogger xml file that you can import your posts into your blog سكريبت التحويل من الوردبريس الي بلوجر
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit' , '500M');
class convert2bloger {
private $database = NULL;
private $errors = array();
private $curEntry = array(); // current entry of the parser
@nilesolutions
nilesolutions / DemoReel100.ino
Created January 19, 2018 09:44 — forked from kriegsman/DemoReel100.ino
FastLED "100-line" demo reel
#include "FastLED.h"
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
//
// -Mark Kriegsman, December 2014
@nilesolutions
nilesolutions / CompressAwsImages.php
Created December 29, 2017 21:02 — forked from Ryuske/CompressAwsImages.php
Laravel 4.2 artisan command for compressing AWS images
<?php
/**
* Command for losslessly compressing Amazon AWS images
*/
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
/**
<?php
function compose(callable $initial, callable ...$functions)
{
if (count($functions) < 1) {
throw new \InvalidArgumentException('at least two functions are required');
}
return array_reduce($functions, function ($f, $g) {
return function (...$args) use ($f, $g) {
return $f($g(...$args));
<?php
/*
* The MIT License
*
* Copyright 2016 Steve Guidetti.
*
* 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