Skip to content

Instantly share code, notes, and snippets.

@mdsaleemj
mdsaleemj / storing and downloading binary data in mongodb
Last active November 21, 2018 12:40
storing and downloading binary data in mongodb without grid-fs
//The below model is used to book a travel ride.
//The uploaded file is parsed in the formidable multipart body parser and stored in req.files.fileField.
//File is read from , in my code, req.files.file
var rideModel = function(){
var rideSchema = new Schema({
email : String,
corp_id : String,
name : String,
manager: String,
@mdsaleemj
mdsaleemj / .vimrc
Last active August 14, 2020 10:16
My .vimrc file
let mapleader=","
set number " show line numbers
"spaces to tab
set tabstop=2
set expandtab
set shiftwidth=2
" list invisible chars
@mdsaleemj
mdsaleemj / machine.js
Created August 27, 2021 04:37
Generated by XState Viz: https://xstate.js.org/viz
const tahoeTravelMachine = Machine({
id: "tahoe-travel",
initial: "login",
states :{
login : {
on :{
LOGIN : "logged_in"
}
},
@mdsaleemj
mdsaleemj / install_execstack_on_ubuntu.md
Created October 19, 2015 07:07
How to install execstack on Ubuntu and Arch Linux

Execstack is a great tool for learning and training on Linux. It is a program which sets, clears, or queries the executable stack flag of ELF binaries and shared libraries. When I was looking to install it I took me a bit to find which package to install it in.

You can install with :

Ubuntu

$ sudo apt-get install prelink

Arch Linux

@mdsaleemj
mdsaleemj / openssl-extract-private-key-from-pfx.md
Last active January 21, 2022 07:43
openssl-extract-private-key-from-pfx

Customers sometimes have a need to export a certificate and private key from a Windows computer to separate certificate and key files for use elsewhere. Windows doesn't provide the means to complete this process.

Exporting Certificates from the Windows Certificate Store describes how to export a certificate and private key into a single .pfx file. Follow the procedure below to extract separate certificate and private key files from the .pfx file.

Procedure:

Take the file you exported (e.g. certname.pfx) and copy it to a system where you have OpenSSL installed. Note: the *.pfx file is in PKCS#12 format and includes both the certificate and the private key.

Run the following command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes