Skip to content

Instantly share code, notes, and snippets.

@brunomlopes
brunomlopes / IsInAsyncErrorInRavenDb.cs
Last active August 29, 2015 14:27
Test case for bug? Tested on 3.0.3751-Unstable and 3.0.3690
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
using Raven.Client.Linq;
using Raven.Tests.Helpers;
using Xunit;
using System;
using Microsoft.Framework.DependencyInjection;
namespace weListen.Infrastructure.Workers.Sanitization
{
public static class ExtensionMethods
{
public static IServiceCollection RegisterEngines(this IServiceCollection services)
{
return services.AddScoped<EngineA>()
@brunomlopes
brunomlopes / sendeml.csx
Created October 8, 2015 19:26
Scriptcs file to send a bunch of .eml files
/*
Run
> scriptcs -install Lumisoft.Net.dll
To install Lumisoft.net
*/
using LumiSoft.Net;
using System.IO;
using System.Linq;
using LumiSoft.Net.SMTP.Client;
@brunomlopes
brunomlopes / RavenDbIssueWithAtSymbol.cs
Created June 1, 2017 17:12
Unit test for a problem with queries with @ symbols
class Entity
{
public string Id { get; set; }
public string AuthorId { get; set; }
public string Title { get; set; }
public string Language { get; set; }
}
class Index : AbstractIndexCreationTask<Entity>
{
@brunomlopes
brunomlopes / scriptedindexresults-unintended-change.cs
Created February 26, 2018 15:56
Scripted index results which update statistics document save floats, but when doc is int, it's marked as a change
public class UnitTest : RavenTestBase
{
[Fact]
public void ALoadShouldNotCauseADocumentToChange()
{
var documentStore = NewDocumentStore(activeBundles:"ScriptedIndexResults");
StoreScriptedIndexDefinition(documentStore);
using (var session = documentStore.OpenSession())
@brunomlopes
brunomlopes / keybase.md
Created April 20, 2018 17:35
keybase.md

Keybase proof

I hereby claim:

  • I am brunomlopes on github.
  • I am brunomlopes (https://keybase.io/brunomlopes) on keybase.
  • I have a public key ASDlTIWcOr-fqK6LqiNEYPgQZyRe4Ue-JJzU_0adb_O1Ugo

To claim this, I am signing this object:

@brunomlopes
brunomlopes / python-pluck.py
Last active October 15, 2019 15:03
A hacky pluck function for python, used to flatten data
def pluck(obj, *keys):
def i(o, k):
if "." in k:
(sub, rest) = k.split('.', 1)
if not sub in o:
return None
val = o[sub]
if isinstance(val, list):
return (k, list(i(x, rest)[1] for x in val))
(_, val) = i(val, rest)
@brunomlopes
brunomlopes / set-random-clipboard.ps1
Last active July 30, 2020 14:20
Copy a random selection of words to the clipboard each second. Used to get random text for testing
$words = @("as","I","his","that","he","was","for","on","are","with","they","be","at","one","have","this","from","by","hot","word",
"but","what","some","is","it","you","or","had","the","of","to","and","a","in","we","can","out","other","were","which","do","their",
"time","if","will","how","said","an","each","tell","does","set","three","want","air","well","also","play","small","end","put","home",
"read","hand","port","large","spell","add","even","land","here","must","big","high","such","follow","act","why","ask","men","change","went",
"light","kind","off","need","house","picture","try","us","again","animal","point","mother","world","near","build","self","earth",
"father","any","new","work","part","take","get","place","made","live","where","after","back","little","only","round","man","year",
"came","show","every","good","me","give","our","under","name","very","through","just","form","sentence","great","think","say","help",
"low","line","differ","turn","cause","much","mean","before","move","right","boy","old","too
@brunomlopes
brunomlopes / c_cpp_properties.json
Created March 17, 2021 00:06
vscode config for qml_firmware
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update/arm-none-eabi/include/**",
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update/lib/gcc/arm-none-eabi/8.3.1/include/**",
"/usr/local/Cellar/arm-gcc-bin@8/8-2019-q3-update/lib/gcc/arm-none-eabi/8.3.1/include-fixed/**",
"/usr/local/Cellar/avr-gcc@8/8.4.0/avr/include/**",
"/usr/local/Cellar/avr-gcc@8/8.4.0/lib/avr-gcc/8/gcc/avr/8.4.0/include/**",