Skip to content

Instantly share code, notes, and snippets.

brunomlopes / strings-can-be-datetimes-on-ravendb35.cs
Created July 30, 2023 21:07
This test surfaces an issue on RavenDB 3.5 where strings containing datetimes are converted to datetimes and indexes might fail.
using System;
using System.Linq;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
using Raven.Tests.Helpers;
using Xunit;
namespace TestDateTimeOffsetsInRavenDb35
public class Entity
using System.Data.Common;
using System.Threading.Tasks;
using ServiceStack.OrmLite;
using StackExchange.Profiling;
using StackExchange.Profiling.Data;
using Xunit;
public class OrmLiteWithConnectionFactory
brunomlopes / ConvertTests.cs
Last active June 2, 2022 10:17
Test case for ConvertTo
public class TestConvertTo
public TestConvertTo()
// Adding this converter resolves the stack overflow, but it's not a generic solution
//IDictionary<string, string> Converter(Dictionary<string, string> input)
// if(input == null) return null;
// return input.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
brunomlopes / keymap.c
Last active May 5, 2021 18:53
A remix of the REPEAT key from precondition which allows for numeric repeat. Repeat works on key up, and while pressed, any numbers are counted to repeat. So, press T, then REPEAT,1,0 and it should repeat T 10 times. Currently it's failing at the modifiers
// Used to extract the basic tapping keycode from a dual-role key.
// Example: GET_TAP_KC(MT(MOD_RSFT, KC_E)) == KC_E
#define GET_TAP_KC(dual_role_key) dual_role_key & 0xFF
uint16_t repeat_last_keycode = KC_NO;
uint8_t repeat_last_modifier = 0;
uint8_t repeat_count = 0;
// Initialize variables holding the bitfield
// representation of active modifiers.
brunomlopes /
Created April 7, 2021 08:50
A quick parser for qmk keymap.c files, and via layouts
# %%
import json,math,itertools
input_file_path = r"C:\Users\bruno\OneDrive\Documents\QMK Via Layouts\sofle bl 2.4.json"
with open(input_file_path) as input:
exported_via_configuration = json.load(input)
layers = exported_via_configuration["layers"]
macros = exported_via_configuration["macros"]
brunomlopes / c_cpp_properties.json
Created March 17, 2021 00:06
vscode config for qml_firmware
"configurations": [
"name": "Mac",
"includePath": [
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",
brunomlopes /
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 /
Created April 20, 2018 17:35

Keybase proof

I hereby claim:

  • I am brunomlopes on github.
  • I am brunomlopes ( on keybase.
  • I have a public key ASDlTIWcOr-fqK6LqiNEYPgQZyRe4Ue-JJzU_0adb_O1Ugo

To claim this, I am signing this object:

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
public void ALoadShouldNotCauseADocumentToChange()
var documentStore = NewDocumentStore(activeBundles:"ScriptedIndexResults");
using (var session = documentStore.OpenSession())