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 / public_enc_example.sh
Last active July 24, 2018 12:23 — forked from thinkerbot/public_enc_example.sh
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys
@mahmoud-samy
mahmoud-samy / README.md
Created August 1, 2018 07:59 — forked from borekb/README.md
Docker and Git Bash / MSYS2 on Windows: path conversion workaround

Docker in Git Bash / MSYS2 on Windows: path conversion workaround

UPDATE 07/2018: I switched from Git Bash to MSYS2 recently which should be very similar, if not the same, but there some subtle differences which made me realize this is more tricky than I thought and that I don't 100% understand what is going on. If someone can help, please let me know in the comments.

Invoking docker in MSYS2 shell or Git Bash typically fails with complains about paths, for example:

$ docker run --rm -it ubuntu /bin/bash
stat C:/Program Files/Git/usr/bin/bash: no such file or directory
FROM ubuntu:16.04
RUN apt-get -y update && \
apt-get -y install gcc python2.7 python-dev python-setuptools wget ca-certificates \
# These are necessary for add-apt-respository
software-properties-common python-software-properties && \
# Install Git >2.0.1
add-apt-repository ppa:git-core/ppa && \
apt-get -y update && \
apt-get -y install git && \
@mahmoud-samy
mahmoud-samy / neo4j
Created January 17, 2019 13:29
ontology graph
MATCH (n) DETACH DELETE n;
LOAD CSV WITH HEADERS FROM "http://localhost:8000/data/con.csv" AS row
CREATE (a:ATOM)
SET a = row,
a.LSTR = toLower(row.STR);
CREATE INDEX ON :ATOM(AUI);
CREATE INDEX ON :ATOM(CUI);
@mahmoud-samy
mahmoud-samy / output
Created March 7, 2019 02:47
Time based TPL
CPU Task 14: 0001 ms at thread: 52 |
CPU Task 02: 1198 ms at thread: 58 |
IO Task 01: 2486 ms at thread: 1 |
IO Task 03: 2935 ms at thread: 1 |
IO Task 05: 3383 ms at thread: 1 |
IO Task 07: 3832 ms at thread: 1 |
IO Task 09: 4280 ms at thread: 1 |
IO Task 11: 4729 ms at thread: 1 |
---------------- window opened ----------------
01: 2486 ms
@mahmoud-samy
mahmoud-samy / reset_sourcegraph_admin_password.md
Created September 22, 2019 21:13 — forked from ryan-blunden/reset_sourcegraph_admin_password.md
Instructions for resetting the Sourcegraph admin password

Presuming you have access to the Sourcegraph Docker container and the container name is sourcegraph:

  1. Get the id for the admin account (should be 1 in most cases):
docker container exec sourcegraph psql -U postgres sourcegraph -c 'SELECT id, username, passwd FROM users'
  1. Set the $ID variable:
version: "2.4"
services:
sourcegraph:
image: sourcegraph/server:3.13
expose:
- 7080
ports:
- "0.0.0.0:7080:7080"
volumes:
@mahmoud-samy
mahmoud-samy / codi.sh
Created May 12, 2020 03:20
Code analysis
#!/bin/bash
BASE_RESULTS_DIR=~/development/tools/code-analyzer
function vis() {
REPO_NAME=$1
DATE=$2
AFTER=$DATE
GIT_COMMIT_DATE=$DATE
@mahmoud-samy
mahmoud-samy / pass.md
Created April 8, 2021 14:28 — forked from abtrout/pass.md
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys