This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here you can find full description: https://thetial.com/rsa-encryption-and-decryption-net-core/ | |
using System; | |
using System.IO; | |
using System.Text; | |
using System.Collections.Generic; | |
using Org.BouncyCastle.Crypto; | |
using Org.BouncyCastle.Crypto.Encodings; | |
using Org.BouncyCastle.Crypto.Engines; | |
using Org.BouncyCastle.OpenSsl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Deserializes XmlDocument object to Serializable object of type T. | |
/// </summary> | |
/// <typeparam name="T">Serializable object type as output type.</typeparam> | |
/// <param name="document">XmlDocument object to be deserialized.</param> | |
/// <returns>Deserialized serializable object of type T.</returns> | |
public static T Deserialize<T>(this XmlDocument document) | |
where T : class | |
{ | |
XmlReader reader = new XmlNodeReader(document); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let group_by (f : 'a -> 'b) (ll : 'a list) : ('b, 'a list) Hashtbl.t = | |
List.fold_left | |
(fun acc e -> | |
let grp = f e in | |
let grp_mems = try Hashtbl.find acc grp with Not_found -> [] in | |
Hashtbl.replace acc grp (e :: grp_mems); | |
acc) | |
(Hashtbl.create 100) | |
ll;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I couldn't find a super simple example of how to run Karma, PhantomJs, with | |
* Jasmine tests via npm, so eventually I decided to create my own. Maybe | |
* someone will find it useful. | |
* | |
* | |
* Installation (using npm): | |
* | |
* npm install -g karma-cli | |
* npm install -g karma --save-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |