Skip to content

Instantly share code, notes, and snippets.

// 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;
@bozhink
bozhink / XmlDocumentDeserializer.cs
Created October 24, 2016 09:57
Deserialize XmlDocument to object
/// <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);
@bahmanm
bahmanm / list-group-by.ml
Created November 20, 2015 17:40
OCaml `List.group_by`
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;;
@casperin
casperin / index.js
Last active December 4, 2019 08:09
Karma, PhantomJs, Jasmine setup using npm
/**
* 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
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash