Skip to content

Instantly share code, notes, and snippets.

@mcrio
mcrio / JsIndexDateTest.cs
Created December 1, 2022 20:05
RavenDB Javascript indexes and Date()
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Raven.Client.Documents;
using Raven.Client.Documents.Indexes;
using Raven.Client.Documents.Linq;
using Raven.Client.Documents.Session;
using Raven.TestDriver;
using Xunit;
// MATCHING
endpoints.MapPost("test", TestEventHandler).WithMetadata(
new TopicAttribute(
"pubsub", "topic1", "event.type == \"testevent.v1\"", 1
)
);
// NOT MATCHING
endpoints.MapPost("test", TestEventHandler).WithMetadata(
new TopicAttribute(
@mcrio
mcrio / TestPoolMetadata.json
Last active August 16, 2021 08:58
Test pool medata
{
"name": "Niks testing pool #89573",
"description": "My pool description",
"ticker": "NTP89",
"homepage": "https://www.cardano.org"
}
@mcrio
mcrio / is4startup.cs
Created June 17, 2021 20:22
Allow all for Identity Server CORS as we'll rely on ASP.net CORS implementation
services.AddSingleton<ICorsPolicyService>(container =>
{
ILogger<DefaultCorsPolicyService> logger =
container.GetRequiredService<ILogger<DefaultCorsPolicyService>>();
return new DefaultCorsPolicyService(logger)
{
AllowAll = true,
};
});
@mcrio
mcrio / System Design.md
Created April 12, 2020 10:01 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mcrio
mcrio / Crypt.php
Last active March 29, 2018 16:15
PHP / RSA asymmetric encryption of text using PHPSecLib 2.0+
<?php
/**
* Required phpseclib/phpseclib: ^2.0
*
* As asymmetric encryption does not allow safe encryption of long messages we encrypt the message using a
* symmetric key but encrypt that key using the assymetric approach and bundle all the data together as single string.
* Based on: https://www.sitepoint.com/encrypt-large-messages-asymmetric-keys-phpseclib/
*/
use phpseclib\Crypt\Random;
use phpseclib\Crypt\Rijndael;
@mcrio
mcrio / dl.php
Last active May 13, 2020 13:21
Download file from url
<?php
set_time_limit(0);
$localFile = './file.tgz';
$remoteUrl = 'http://..';
$fp = fopen($localFile, 'rw');
$options = array(
CURLOPT_FILE => $fp,
@mcrio
mcrio / gist:7951414
Last active December 31, 2015 06:59
parameters:
servicename: service21
services:
myservice
class: /someclass