Skip to content

Instantly share code, notes, and snippets.

View MohammedEssehemy's full-sized avatar
👀
Exploring

Essehemy MohammedEssehemy

👀
Exploring
View GitHub Profile
@MohammedEssehemy
MohammedEssehemy / loopback-text-mongo
Last active July 23, 2018 18:49
[loopback text search query] example for url request on loopback to hit text index on mongodb #loopback #mongodb #text
{{host}}/api/model?filter={ "where": { "$text" : { "search" : "ess" } } }
@MohammedEssehemy
MohammedEssehemy / loopback-regex-mongo
Last active July 23, 2018 18:49
[loopback regex] loopback url search regex mongo
{{host}}/api/model?filter={"where": { "searchTerms" : { "like" : "esr" , "options": "i"} } }
@MohammedEssehemy
MohammedEssehemy / drawCanvas.html
Last active July 29, 2018 11:28
html canvas draw with background
<html>
<script type="text/javascript">
var canvas, canvasimg, backgroundImage, finalImg;
var mouseClicked = false;
var prevX = 0;
var currX = 0;
var prevY = 0;
var currY = 0;
var fillStyle = "black";
var globalCompositeOperation = "source-over";
@MohammedEssehemy
MohammedEssehemy / formsTrackChanges.js
Last active August 3, 2018 11:32
[confirm before page leave - iron router] #Meteor #blaze #iron #router
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import 'meteor/aldeed:template-extension';
import { $ } from 'meteor/jquery';
import { Router } from 'meteor/iron:router';
import swal from 'sweetalert';
// credits: https://stackoverflow.com/a/959679/7435863
$.fn.extend({
trackChanges() {
@MohammedEssehemy
MohammedEssehemy / init.coffee
Last active March 19, 2020 09:08
[atom-sync-settings] automatic update by http://atom.io/packages/sync-settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@MohammedEssehemy
MohammedEssehemy / git_rebase.md
Last active September 24, 2018 21:49 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@MohammedEssehemy
MohammedEssehemy / sign.sh
Created September 28, 2018 14:19 — forked from ezimuel/sign.sh
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@MohammedEssehemy
MohammedEssehemy / git.migrate
Last active December 10, 2018 17:49 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
# credits: https://serverfault.com/a/426429/452807
PRIVKEY=id_rsa
TESTKEY=id_rsa.pub
diff <( ssh-keygen -y -e -f "$PRIVKEY" ) <( ssh-keygen -y -e -f "$TESTKEY" )
@MohammedEssehemy
MohammedEssehemy / NTFS_MAC.md
Last active December 6, 2018 02:57
Read NTFS USB on MAC

Read NTFS USB on MAC

  1. Copy device label REPLCAE SPACE WITH \040
  2. Open terminal
  3. sudo nano /etc/fstab
  4. Add the following line.
       LABEL=LABEL_FROM_1 none ntfs nobrowse,rw
    
  5. Remove device and insert it again