Skip to content

Instantly share code, notes, and snippets.

View mahmoud-samy's full-sized avatar

Mahmoud Samy mahmoud-samy

View GitHub Profile
@mahmoud-samy
mahmoud-samy / hubdecrypt.sh
Created May 20, 2018 10:07 — forked from rgbkrk/hubdecrypt.sh
Encrypt a (short) file using someone's public key from github
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
@mahmoud-samy
mahmoud-samy / multiple_ssh_setting.md
Created May 7, 2018 09:32 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mahmoud-samy
mahmoud-samy / id_rsa_encryption.md
Created April 2, 2018 16:56
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@mahmoud-samy
mahmoud-samy / ConEmu Git Bash.md
Created March 2, 2018 03:36 — forked from n3dst4/ConEmu Git Bash.md
My ConEmu / Cmder git bash task config
  1. Open Conemu

  2. Open Settings -> Tasks or go to new tab button -> Setup tasks.

  3. Click + to add a new task

  4. Enter the name as Git Bash or whatever you like

  5. Task parameters:

     /icon "C:\Program Files (x86)\Git\etc\git.ico" /dir "C:\_git"
    
  6. Command:

http://api.aladhan.com/timingsByCity?city=Cairo&country=EG&method=5
using System;
using LiteDB;
namespace LiteDB.Extensions {
public static class LiteCollectionX {
/// <summary>
/// Upserts the specified value.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="collection">The collection within which to upsert the <paramref name="value"/>.</param>
@mahmoud-samy
mahmoud-samy / ko.utils.signatures.js
Created September 4, 2016 18:01 — forked from hyle/ko.utils.signatures.js
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
// Fix the following program to show the correct game name
var userId;
(function initialize(){
function generateUserName(n) {
return (((Math.sin(n) * 1000) - Math.floor((Math.sin(n) * 1000))) * 1000).toFixed(0);
}
var userKey = 2222222222;
userId = name = generateUserName(userKey);
})();
// The following recursive code will cause a stack overflow if the
// array list is too large.
// How can you fix this and still retain the recursive pattern?
var list = readHugeList();
var nextListItem = function() {
var item = list.pop();
if (item) {
// given the following data object, write functions that returns:
// 1- All professors
// 2- All students
// 3- Name of students with gpa higher than 3.1
// 4- A function that takes the prof. id and return all of his courses by name
var data = {
"users": [{
"id": "001",
"name": "Prof. Alaa Ahmed",