Skip to content

Instantly share code, notes, and snippets.


Bogdan Mart Mart-Bogdan

View GitHub Profile
Mart-Bogdan /
Created Apr 10, 2022
Snippet to run SetUp/TeadDown in Rust Unit Tests
// Kudos Eric Opines
// This is bit modified post from his blog post.
mod tests {
use std::fs::read_dir;
use std::panic;
fn it_works() {
run_test(|| {
Mart-Bogdan /
Last active Oct 18, 2020 — forked from fmarani/
calculate md5 hashes of chunks of a file, configurable block size
#!/usr/bin/env python
from optparse import OptionParser
from pathlib import Path
import hashlib
import sys
parser = OptionParser()
parser.add_option("-b", "--blocksize", dest="blocksize", type=int, default=1024,
help="Specify blocksize", metavar="blocksize")
Mart-Bogdan / SmartMigrationsTable.cs
Created Sep 1, 2020
EF track migration apply time
View SmartMigrationsTable.cs
public partial class SmartMigrationsTable : Migration
protected override void Up(MigrationBuilder builder)
builder.Sql("alter table \"__EFMigrationsHistory\" add column IF NOT EXISTS id serial;");
"alter table \"__EFMigrationsHistory\" add column IF NOT EXISTS created_ts timestamptz default now();"

Keybase proof

I hereby claim:

  • I am mart-bogdan on github.
  • I am winnie_ua ( on keybase.
  • I have a public key ASDR4oc_1BmeWWrAYTdggM_czCpD7-ZXFVyOGxsxwe9-dAo

To claim this, I am signing this object:

* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
package ua.kpi.acts.samuel.agent.inject.modules;
import java.util.Set;
View harlem-shake.js
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
function h() {
Mart-Bogdan / Ef_Selects.cs
Created Jan 9, 2017
Samples of using selects with entity framework
View Ef_Selects.cs
public async Task<ICollection<Tuple<Site,ICollection<String>>>> GetSitesByUserIdAsync(int userId)
StringBuilder sb = new StringBuilder();
Action<string> action = s => sb.Append(s);
_context.Database.Log += action;
var res= await _context.UserSiteAccesses
.Where(p => p.UserId == userId && p.Accsess == "read")
.Select(p => new RwTuple<Site,ICollection<String>>
Mart-Bogdan / CommandExecution.cs
Created Jul 27, 2016
TaskCompletionSource sample
View CommandExecution.cs
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using SamuelServer.Common.Communication;
using SamuelServer.Common.Communication.Interfaces;
using SamuelServer.Common.Exceptions;
using SamuelServer.Common.Interfaces;
using SamuelServer.Common.Wrappers;
using SamuelServer.IOCCommon.Attributes;
View AlternativeInit.cs
private void InitSerilog()
var logPath=Context.Server.MapPath(@"~/Logs");
var factory = new LoggerConfiguration()
.Enrich.With(new HttpRequestIdEnricher())
////outputTemplate: "{Timestamp:o} [{Level}] [{SourceContext:l}] ({ThreadId}) [{NDC}]{NewLine}{Message}{NewLine}{Exception:l}"
View docx2doc.vbs
rem enum WdSaveFormat
const wdFormatDocument = 0 rem <-- DOC
const wdFormatDocument97 = 0
const wdFormatTemplate = 1
const wdFormatTemplate97 = 1
const wdFormatText = 2
const wdFormatTextLineBreaks = 3
const wdFormatDOSText = 4
const wdFormatDOSTextLineBreaks = 5