Skip to content

Instantly share code, notes, and snippets.

Mohamed A. Hassan MohamedAlaa

View GitHub Profile
View ajax-form.js
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@MohamedAlaa
MohamedAlaa / server.sh
Last active Oct 25, 2018
osx computer info in terminal
View server.sh
#!/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 / git
Created Jul 12, 2012
Git Conventions
View git
// run once per project
git remote add upstream [ssh repo]
// before pull request
git fetch upstream
// merge remote with local
git merge upstream/master
// install hub
View ImageMagick-snippets.md

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 / redis-benchmark.md
Created Aug 27, 2016
Redis Benchmark on Google cloud using n1-standard-4 instance
View redis-benchmark.md
❯ 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
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
You can’t perform that action at this time.