Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘
|m/

Bogdan Mart Mart-Bogdan

🤘
|m/
View GitHub Profile
@Mart-Bogdan
Mart-Bogdan / md5chunks.py
Last active Oct 18, 2020 — forked from fmarani/md5chunks.py
calculate md5 hashes of chunks of a file, configurable block size
View md5chunks.py
#!/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
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;");
builder.Sql(
"alter table \"__EFMigrationsHistory\" add column IF NOT EXISTS created_ts timestamptz default now();"
);
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mart-bogdan on github.
  • I am winnie_ua (https://keybase.io/winnie_ua) on keybase.
  • I have a public key ASDR4oc_1BmeWWrAYTdggM_czCpD7-ZXFVyOGxsxwe9-dAo

To claim this, I am signing this object:

View CommandsBindingModule.java
/*
* 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 com.google.inject.AbstractModule;
import com.google.inject.multibindings.MapBinder;
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);
document.body.appendChild(e)
}
function h() {
@Mart-Bogdan
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
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.FromLogContext()
.Enrich.WithThreadId()
.Enrich.With(new HttpRequestIdEnricher())
.MinimumLevel.Verbose();
//.WriteTo.ColoredConsole(
////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
View ChangePassword.java
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{