Skip to content

Instantly share code, notes, and snippets.

View MohamedAlaa's full-sized avatar

Mohamed A. Hassan MohamedAlaa

View GitHub Profile
@MohamedAlaa
MohamedAlaa / redis-benchmark.md
Created August 27, 2016 23:32
Redis Benchmark on Google cloud using n1-standard-4 instance
❯ redis-benchmark -p 6379 -P 100 -n 100000 -q
PING_INLINE: 653594.81 requests per second
PING_BULK: 1149425.38 requests per second
SET: 561797.75 requests per second
GET: 800000.00 requests per second
INCR: 746268.62 requests per second
LPUSH: 543478.25 requests per second
RPUSH: 584795.31 requests per second
LPOP: 606060.56 requests per second
@MohamedAlaa
MohamedAlaa / 0_reuse_code.js
Created November 16, 2015 05:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// This is a simple function to get all the attached jquery events on all the DOM elements
// you will find a new data attribute on the elements that has events attached to it.
(function() {
if (window.jQuery) {
var elms = [],
elm = {},
attrs = "",
evTypes = 0,
evCounter = 0,
elmCounter = 0,
@MohamedAlaa
MohamedAlaa / ImageMagick-snippets.md
Last active April 13, 2024 21:53
ImageMagick Snippets

Remove white background color of an image in ImageMagick

$ convert  your.jpg  -transparent white  your.png

Flatten a transparent image with a white background:

@MohamedAlaa
MohamedAlaa / sublime-settings.md
Last active August 12, 2021 23:04
Standard Sublime Settings Proposal

Problem we are trying to resolve

One of the Problems we face in any teams is that every one has his own sublime settings for spacing indentation which cause a problem when you push to git hub as some prefer using tabs for indentation and others using spacing.

Wrong Spacing and indentation example

The Objective

The objective is to standardize your sublime settings for readability and to avoid extra indentation or spaces after each line you write

@MohamedAlaa
MohamedAlaa / server.sh
Last active October 25, 2018 19:22
osx computer info in terminal
#!/bin/bash
echo "--------------------------------------------------------------------------------"
uname -a
echo "--------------------------------------------------------------------------------"
MEMORY=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print $1 $2 $3}'`
echo "$MEMORY"
echo "--------------------------------------------------------------------------------"
CORES_COUNT=`sysctl hw.ncpu | awk '{print $2}'`
echo "CPU"
sysctl -n machdep.cpu.brand_string
@MohamedAlaa
MohamedAlaa / nvd3.scss
Last active August 29, 2015 14:01
nvd3 Scatter hide the lines in the x and y Axis
.nv-scatterChart {
.nv-distributionX line.nv-distx[y1="0"],
.nv-distributionY line.nv-disty[x2="8"]
{
display: none;
}
}
@MohamedAlaa
MohamedAlaa / index.html
Last active July 3, 2017 14:52 — forked from enjalot/index.html
Show value in Pie Chart example with D3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
#!/usr/bin/env ruby
require 'cinch' # gem install cinch --no-ri --no-rdoc
require 'askwiki' # gem install askwiki --no-ri --no-rdoc
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.freenode.org"
c.nick = "Ask_wikipedia"
c.channels = ["#cinch-bots"]